V16: Sub-dependencies from workspaces are missing in the main package.json file#19416
Merged
iOvergaard merged 8 commits intorelease/16.0from May 26, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
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) => {
Contributor
There was a problem hiding this comment.
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
nielslyngsoe
approved these changes
May 26, 2025
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
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.