fix: remove workspaces field from package.json and update uuid to v14 - #410
Merged
fabiankaegy merged 3 commits intoJul 23, 2026
Merged
Conversation
the published npm package shipped "workspaces": ["example/"], which makes npm treat the installed package as workspace-aware during dependency resolution and breaks npm overrides for transitive dependencies in consuming projects. - remove the workspaces field; example/ is now a standalone npm project installed via --prefix in the test-env scripts - add jest-environment-jsdom as an explicit devDependency (it was previously only available through workspace hoisting from example/) - update uuid from ^9.0.1 to ^14.0.1 and drop @types/uuid (uuid ships its own types); add jest-unit.config.js so jest transforms uuid's esm-only build fixes #408 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes an npm packaging issue where the published package.json included a workspaces field (breaking npm overrides in consuming projects), and updates the uuid dependency to a newer major version while keeping local e2e workflows working without npm workspaces.
Changes:
- Removed
"workspaces"from the publishedpackage.jsonand rewired test-env scripts to use a standaloneexample/project. - Updated
uuidto^14.0.1, removed@types/uuid, and addedjest-environment-jsdomas an explicit devDependency. - Added
jest-unit.config.jsto ensure Jest transformsuuid(ESM) undernode_modules, and updatedCONTRIBUTING.mdto reflect the new setup.
Reviewed changes
Copilot reviewed 3 out of 5 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| package.json | Removes workspace config, updates dependencies, and updates env scripts to run against the standalone example/ project. |
| jest-unit.config.js | Extends 10up-toolkit Jest config to transform uuid (ESM) instead of ignoring it under node_modules. |
| CONTRIBUTING.md | Updates contributor workflow docs for separate root + example/ installs/builds. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+73
to
+74
| "build-test-env": "npm run build && npm install --prefix example && npm run build --prefix example", | ||
| "start-test-env": "npm run start-env --prefix example && npm run import-media --prefix example", |
|
|
||
| ```bash | ||
| npm run build | ||
| npm install --prefix example |
|
|
||
| ```bash | ||
| npm run start | ||
| npm run build --prefix example |
regenerate package-lock.json with npm 10 (the version matching .nvmrc's node 20 used by CI): npm 10's resolver requires the nested stylelint@16 subtree under @wordpress/ui that npm 11 prunes, so a lockfile written by npm 11 fails `npm ci` on npm 10. additions only, no version changes; validated with `npm ci --dry-run` on both npm 10 and npm 11 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
npm@12 requires node >= 22, so `npm install -g npm@latest` now fails on the node 20 runners used by the publish workflow (pre-existing breakage on every pr) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
🎉 A new testing version of this package has been published to NPM. You can install it with |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of the Change
Fixes #408.
The published npm package shipped
"workspaces": ["example/"]in itspackage.json. While theexample/directory itself was already excluded from the tarball by thefilesallowlist, theworkspacesfield persisted in the publishedpackage.json, making npm treat the installed package as workspace-aware during dependency resolution in consuming projects — which breaks npmoverridesfor any transitive dependency of this package.Changes
workspacesfield frompackage.json(the actual fix from the issue).example/is now a standalone npm project.build-test-envbuilds the root package, runsnpm install --prefix example, then builds the example plugin;start-test-envuses--prefix exampleinstead of-w example/. This keeps the e2e CI workflow working, since rootnpm cino longer installs example's dependencies.jest-environment-jsdomas an explicit devDependency — regression fix uncovered while testing: it was previously only available through workspace hoisting from example's@wordpress/scriptstree, so removingworkspacessilently brokenpm test(10up-toolkit hardcodestestEnvironment: 'jsdom').uuidfrom^9.0.1to^14.0.1so consumers get a current uuid without resorting to overrides at all. Dropped@types/uuid(uuid ships its own types since v7). Both usage sites (content-picker,repeater) use the unchangedv4named export — no code changes needed.jest-unit.config.js(10up-toolkit's project-root override mechanism) wideningtransformIgnorePatternsso Jest transforms uuid's ESM-only build. uuid v13+ ships no CommonJS export condition; webpack-based consumer builds handle this transparently (verified below), but Jest needs the transform.package-lock.jsonloses the example workspace tree (verified semantically: 0 unexpected additions or version changes besides uuid and the jest-environment-jsdom tree);example/package-lock.jsonis newly committed for the now-standalone example project.CONTRIBUTING.mdfor the new two-project setup.CI fixes (follow-up commits)
.nvmrc's node 20 used by CI): npm 10's resolver requires a nestedstylelint@16subtree under@wordpress/uithat npm 11 prunes, so the initially npm 11-written lockfile failednpm cion the runners. Additions only, no version changes; validated withnpm ci --dry-rununder both npm 10 and npm 11.npm@11: npm@12 requires node >= 22, sonpm install -g npm@latestnow fails on the node 20 runners — thisrelease_testingbreakage predates this PR and hits every PR.Known unrelated failure
The Cypress e2e job fails with
Cannot destructure property 'documentElement' of 'z' as it is nullin every spec — the identical failure exists ondevelop(first seen in the July 16 run of the 1.22.3 release commit, a version-bump-only change), so it's pre-existing environment drift (likely wp-env pulling a newer WordPress), not caused by this PR. The rewiredbuild-test-env/start-test-envscripts themselves work: the CI run builds the example plugin, boots the environment, and executes all 35 tests.How to test the Change
npm ci && npm test && npm run build— unit tests and build pass.npm run build-test-env— full clean pipeline (root build → example install → example webpack build) succeeds, confirming a webpack consumer bundles ESM-only uuid@14 through the CJS dist output.npm pack, then in a fresh project add the tarball as a dependency with"overrides": { "uuid": "^14.0.0" }and runnpm install && npm ls uuid. The extracted tarball'spackage.jsonhas noworkspacesfield, andnpm ls uuidshows a single dedupeduuid@14.0.1— no nested stale copy. (With this change, no override is needed in the first place.)Changelog Entry
Credits
Props @mattradford-sage (issue report and suggested fix), @fabiankaegy
Checklist:
🤖 Generated with Claude Code