-
Notifications
You must be signed in to change notification settings - Fork 2.8k
V16: Sub-dependencies from workspaces are missing in the main package.json file #19416
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the distribution packaging script to correct workspace paths in the generated package.json file by renaming ./src entries to ./dist-cms, ensuring peer dependencies install correctly.
- Added mapping logic in
cleanse-pkg.jsto update workspace paths. - Renamed workspace path prefixes from
./srcto./dist-cms.
Comments suppressed due to low confidence (2)
src/Umbraco.Web.UI.Client/devops/publish/cleanse-pkg.js:16
- [nitpick] Add a unit test for
cleanse-pkg.jsthat verifies workspace paths are correctly transformed from './src' to './dist-cms' under various scenarios.
packageJson.workspaces = packageJson.workspaces.map((workspace) => {
src/Umbraco.Web.UI.Client/devops/publish/cleanse-pkg.js:16
- Add a guard to ensure
packageJson.workspacesexists and is an array before calling.map, to prevent runtime errors ifworkspacesis missing or not an array.
packageJson.workspaces = packageJson.workspaces.map((workspace) => {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR ensures all sub-dependencies from workspaces are hoisted into the main distributed package.json, and adds missing package manifest and build config files for several workspace packages.
- Added
package.jsonfortranslation,settings, andsegmentworkspaces. - Added
vite.config.tsfor thesettingsworkspace. - Extended the
cleanse-pkg.jsscript to hoist workspace dependencies topeerDependenciesand strip theworkspacesfield.
Reviewed Changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/.../translation/package.json | Adds missing package.json for the translation workspace. |
| src/.../settings/vite.config.ts | Adds Vite build configuration for the settings workspace. |
| src/.../settings/package.json | Adds missing package.json for the settings workspace. |
| src/.../segment/package.json | Adds missing package.json for the segment workspace. |
| src/Umbraco.Web.UI.Client/devops/publish/cleanse-pkg.js | Updates publish script to hoist each workspace’s dependencies into the root peerDependencies. |
Files not reviewed (1)
- src/Umbraco.Web.UI.Client/package-lock.json: Language not supported
Description
This hoists sub-dependencies found in workspaces to the main distributed
package.jsonfile, so that consumers can install all peer dependencies.Also added some missing package.json and vite.config.ts files, that was found when testing the build.
Fixes #19407
How to test
npm run build:for:npmand thennpm packIt should just log the generated ID and not complain about missing imports.