Skip to content

Commit 54ebcf9

Browse files
authored
Distribute @wp-playground/client without any package.json dependencies (#2426)
## Motivation for the change, related issues `@wp-playground/client` doesn't make a single import, but its `package.json` [lists 27 dependencies](https://www.npmjs.com/package/@wp-playground/client?activeTab=dependencies) coming from the NX package-json executor. This PR ensures it has zero dependencies. ## Testing Instructions (or ideally a Blueprint) Run `nx reset; nx build playground-client` and confirm the `dist/packages/playground/client/package.json` file has no dependencies.
1 parent 491de5d commit 54ebcf9

File tree

3 files changed

+27
-1
lines changed

3 files changed

+27
-1
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,22 @@ jobs:
318318
exit 1
319319
fi
320320
npx nx affected --target=build --parallel=3 --verbose
321+
- name: Confirm the built Playground client package.json file has no dependencies listed
322+
run: |
323+
if [ ! -f dist/packages/playground/client/package.json ]; then
324+
echo "Error: dist/packages/playground/client/package.json not found"
325+
echo "This is a regression from https://github.com/WordPress/playground/pull/1000"
326+
exit 1
327+
fi
328+
329+
DEPENDENCIES=$(jq '.dependencies // {}' dist/packages/playground/client/package.json)
330+
if [ "$DEPENDENCIES" != "{}" ]; then
331+
echo "Error: @wp-playground/client package.json has dependencies listed:"
332+
echo "$DEPENDENCIES"
333+
exit 1
334+
else
335+
echo "✓ @wp-playground/client package.json has no dependencies listed"
336+
fi
321337
322338
# Deploy documentation job
323339
deploy_docs:

packages/nx-extensions/src/executors/package-json/executor.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,15 @@ async function buildPackageJson(
156156
}
157157
packageJson.main = main;
158158

159+
// Playground-client is a dependency-less package. Let's make sure it can be installed
160+
// without bringing in any other packages.
161+
if ('playground-client' === context.projectName) {
162+
delete packageJson.overrides;
163+
delete packageJson.dependencies;
164+
delete packageJson.devDependencies;
165+
delete packageJson.optionalDependencies;
166+
}
167+
159168
fs.writeFileSync(
160169
options.outputPath + '/package.json',
161170
serializeJson(packageJson)

packages/playground/client/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,6 @@
4141
"engines": {
4242
"node": ">=20.18.3",
4343
"npm": ">=10.1.0"
44-
}
44+
},
45+
"dependencies": {}
4546
}

0 commit comments

Comments
 (0)