Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions packages/command-tests/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ async function main() {
) {
throw new Error("Expected mpk file to be generated, but it wasn't.");
}
checkWidgetBundleFiles();
}

async function testRelease() {
Expand All @@ -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(", ")}.`);
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the function is only used in the testRelease method, we might as well just inline it there. Also, we might be able to combine these checks with the mpk file check, since they essentially do the same check.

}

async function checkDependenciesFiles(isNative, boilerplate, version) {
Expand Down
4 changes: 4 additions & 0 deletions packages/pluggable-widgets-tools/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
5 changes: 3 additions & 2 deletions packages/pluggable-widgets-tools/configs/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we retarget the full path after #182? The widgetRoot path in that branch probably also uses full paths with drive letters.

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);
}
}
]),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
])
Expand Down
Loading