diff --git a/packages/command-tests/commands.js b/packages/command-tests/commands.js index 236e5bf7..b5da6a21 100644 --- a/packages/command-tests/commands.js +++ b/packages/command-tests/commands.js @@ -228,6 +228,7 @@ async function main() { ) { throw new Error("Expected mpk file to be generated, but it wasn't."); } + checkWidgetBundleFiles(); } async function testRelease() { @@ -244,6 +245,18 @@ async function main() { ) { throw new Error("Expected mpk file to be generated, but it wasn't."); } + checkWidgetBundleFiles(); + } + + function checkWidgetBundleFiles() { + // XML files copied into the staging dir before zipping; missing here means a broken mpk. + const stagingDir = join(workDir, "dist", "tmp", "widgets"); + const missing = ["package.xml", `${widgetPackageJson.widgetName}.xml`].filter( + f => !existsSync(join(stagingDir, f)) + ); + if (missing.length) { + throw new Error(`Expected widget bundle files in mpk, but missing: ${missing.join(", ")}.`); + } } async function checkDependenciesFiles(isNative, boilerplate, version) { diff --git a/packages/pluggable-widgets-tools/CHANGELOG.md b/packages/pluggable-widgets-tools/CHANGELOG.md index 91c7297b..aa700345 100644 --- a/packages/pluggable-widgets-tools/CHANGELOG.md +++ b/packages/pluggable-widgets-tools/CHANGELOG.md @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## [Unreleased] +### Fixed + +- We fixed an issue on Windows where the generated `.mpk` was missing the widget's `.xml` files and icon/tile PNGs. + ### Changed - We replaced `ts-jest` with `@swc/jest` as the Jest transform (3–5× faster for TSX-heavy test suites) and switched the test runner from `jest-jasmine2` to `jest-circus`. diff --git a/packages/pluggable-widgets-tools/configs/rollup.config.mjs b/packages/pluggable-widgets-tools/configs/rollup.config.mjs index 4998ce2d..b6015387 100644 --- a/packages/pluggable-widgets-tools/configs/rollup.config.mjs +++ b/packages/pluggable-widgets-tools/configs/rollup.config.mjs @@ -320,9 +320,10 @@ export default async args => { clear({ targets: [outDir, mpkDir] }), command([ () => { - cp(join(sourcePath, "src/**/*.xml"), outDir); + // Re-target join(widgetRoot,...) after PR #182. + cp("src/**/*.xml", outDir); if (existsSync(`src/${widgetName}.icon.png`) || existsSync(`src/${widgetName}.tile.png`)) { - cp(join(sourcePath, `src/${widgetName}.@(tile|icon)?(.dark).png`), outDir); + cp(`src/${widgetName}.@(tile|icon)?(.dark).png`, outDir); } } ]), diff --git a/packages/pluggable-widgets-tools/configs/rollup.config.native.mjs b/packages/pluggable-widgets-tools/configs/rollup.config.native.mjs index 72316abb..f8171edc 100644 --- a/packages/pluggable-widgets-tools/configs/rollup.config.native.mjs +++ b/packages/pluggable-widgets-tools/configs/rollup.config.native.mjs @@ -257,9 +257,10 @@ export default async args => { clear({ targets: [outDir, mpkDir] }), command([ () => { - cp(join(sourcePath, "src/**/*.xml"), outDir); + // Re-target join(widgetRoot,...) after PR #182. + cp("src/**/*.xml", outDir); if (existsSync(`src/${widgetName}.icon.png`) || existsSync(`src/${widgetName}.tile.png`)) { - cp(join(sourcePath, `src/${widgetName}.@(tile|icon)?(.dark).png`), outDir); + cp(`src/${widgetName}.@(tile|icon)?(.dark).png`, outDir); } } ])