diff --git a/packages/command-tests/commands.js b/packages/command-tests/commands.js index 236e5bf7..adfeeeb0 100644 --- a/packages/command-tests/commands.js +++ b/packages/command-tests/commands.js @@ -218,31 +218,31 @@ async function main() { async function testBuild() { await execAsync("npm run build", workDir, logger); - if ( - !existsSync( - join( - workDir, - `/dist/${widgetPackageJson.version}/${widgetPackageJson.packagePath}.${widgetPackageJson.widgetName}.mpk` - ) - ) - ) { - throw new Error("Expected mpk file to be generated, but it wasn't."); - } + checkWidgetBundleFiles(); } async function testRelease() { rm("-rf", join(workDir, "dist")); await execAsync("npm run release", workDir, logger); + checkWidgetBundleFiles(); + } - if ( - !existsSync( - join( - workDir, - `/dist/${widgetPackageJson.version}/${widgetPackageJson.packagePath}.${widgetPackageJson.widgetName}.mpk` - ) - ) - ) { - throw new Error("Expected mpk file to be generated, but it wasn't."); + function checkWidgetBundleFiles() { + const stagingDir = join(workDir, "dist", "tmp", "widgets"); + const mpkFile = join( + workDir, + "dist", + widgetPackageJson.version, + `${widgetPackageJson.packagePath}.${widgetPackageJson.widgetName}.mpk` + ); + const requiredFiles = [ + mpkFile, + join(stagingDir, "package.xml"), + join(stagingDir, `${widgetPackageJson.widgetName}.xml`) + ]; + const missing = requiredFiles.filter(f => !existsSync(f)); + if (missing.length) { + throw new Error(`Expected widget bundle files in mpk, but missing: ${missing.join(", ")}.`); } } 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..4f584b9f 100644 --- a/packages/pluggable-widgets-tools/configs/rollup.config.mjs +++ b/packages/pluggable-widgets-tools/configs/rollup.config.mjs @@ -320,9 +320,9 @@ export default async args => { clear({ targets: [outDir, mpkDir] }), command([ () => { - cp(join(sourcePath, "src/**/*.xml"), outDir); + 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..f864e3b9 100644 --- a/packages/pluggable-widgets-tools/configs/rollup.config.native.mjs +++ b/packages/pluggable-widgets-tools/configs/rollup.config.native.mjs @@ -257,9 +257,9 @@ export default async args => { clear({ targets: [outDir, mpkDir] }), command([ () => { - cp(join(sourcePath, "src/**/*.xml"), outDir); + 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); } } ])