-
-
Notifications
You must be signed in to change notification settings - Fork 376
[Map] Allows Bridges JavaScript assets to be installed with npm
when using file:vendor/symfony/ux-*-map/assets
#2983
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
Merged
Conversation
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
…n using `file:vendor/symfony/ux-*-map/assets`
4689dbc
to
1667af7
Compare
Kocal
commented
Aug 8, 2025
Comment on lines
-57
to
-77
- name: Manually replacing "workspace:*" references | ||
run: | | ||
# npm does not support "workspace:*" references, so we need to replace them with the actual package path | ||
for PACKAGE_DATA in $(pnpm ls -r --json --depth -1 | jq 'map(select(.private != true))' | jq -c '.[]'); do | ||
PACKAGE=$(echo $PACKAGE_DATA | jq -r '.name') | ||
PACKAGE_PATH=$(echo $PACKAGE_DATA | jq -r '.path') | ||
|
||
echo "🔍 Searching for \"workspace:*\" references in $PACKAGE_PATH/package.json" | ||
|
||
# Manually replace "workspace:" constraints with the actual package version, it ensure packages can be installed with npm | ||
jq -rc '[(.dependencies // {}) + (.devDependencies // {}) | to_entries[] | select(.value == "workspace:*") | .key][]' "$PACKAGE_PATH/package.json" | while read -r PACKAGE_FROM_WORKSPACE ; do | ||
echo "ℹ️ Found \"$PACKAGE_FROM_WORKSPACE\" with \"workspace:*\"" | ||
|
||
PACKAGE_FROM_WORKSPACE_PATH=$(pnpm ls --filter $PACKAGE_FROM_WORKSPACE --json --depth -1 | jq -r '.[].path') | ||
echo "ℹ️ The package \"$PACKAGE_FROM_WORKSPACE\" is located in \"$PACKAGE_FROM_WORKSPACE_PATH\" directory" | ||
|
||
echo "⚒️ Replacing \"$PACKAGE_FROM_WORKSPACE\" with \"file:$PACKAGE_FROM_WORKSPACE_PATH\" in $PACKAGE_PATH/package.json" | ||
sed -i "s|\"$PACKAGE_FROM_WORKSPACE\": \"workspace:\*\"|\"$PACKAGE_FROM_WORKSPACE\": \"file:$PACKAGE_FROM_WORKSPACE_PATH\"|g" "$PACKAGE_PATH/package.json" | ||
done; | ||
done | ||
|
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.
This is not needed anymore :)
This was referenced Aug 8, 2025
Thanks Hugo. |
Kocal
added a commit
that referenced
this pull request
Aug 14, 2025
This PR was merged into the 2.x branch. Discussion ---------- [Pkg] Ensure UX Map assets are built first | Q | A | ------------- | --- | Bug fix? | no | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Docs? | no <!-- required for new features --> | Issues | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead --> | License | MIT Since #2983, I'm starting to see some CI jobs that runs `pnpm build` to fail because the topological order is not respected anymore when using `packageExtensions` (I will see if an issue on pnpm exists). See https://github.com/symfony/ux/actions/runs/16974598463/job/48120135015?pr=3000 for example: ``` Run pnpm install --frozen-lockfile && pnpm run build Scope: all 20 workspace projects Lockfile is up to date, resolution step is skipped Progress: resolved 1, reused 0, downloaded 0, added 0 Packages: +424 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Progress: resolved 424, reused 424, downloaded 0, added 423 Progress: resolved 424, reused 424, downloaded 0, added 424, done devDependencies: + `@biomejs`/biome 2.1.2 + `@testing`-library/dom 10.4.0 + `@testing`-library/jest-dom 6.6.3 + `@types`/node 22.16.5 + lightningcss 1.30.1 + pkg-types 2.2.0 + playwright 1.54.1 + tinyglobby 0.2.14 + tsup 8.5.0 + vitest 3.2.4 ╭ Warning ─────────────────────────────────────────────────────────────────────╮ │ │ │ Ignored build scripts: core-js-pure, esbuild, msw, swup. │ │ Run "pnpm approve-builds" to pick which dependencies should be allowed │ │ to run scripts. │ │ │ ╰──────────────────────────────────────────────────────────────────────────────╯ Done in 1.9s using pnpm v10.13.1 > `@2`.27.0 build /home/runner/work/ux/ux > pnpm run -r --aggregate-output build Scope: 19 of 20 workspace projects src/Cropperjs/assets build$ tsx ../../../bin/build_package.ts . src/Cropperjs/assets build: CLI Building entry: src/controller.ts, src/style.css src/Cropperjs/assets build: CLI Using tsconfig: ../../../tsconfig.packages.json src/Cropperjs/assets build: CLI tsup v8.5.0 src/Cropperjs/assets build: CLI Target: es2021 src/Cropperjs/assets build: CLI Cleaning output folder src/Cropperjs/assets build: ESM Build start src/Cropperjs/assets build: [Symfony UX] Minified CSS file: /home/runner/work/ux/ux/src/Cropperjs/assets/dist/style.css src/Cropperjs/assets build: [Symfony UX] Renamed dist/style.css to dist/style.min.css src/Cropperjs/assets build: ESM dist/controller.js 991.00 B src/Cropperjs/assets build: ESM dist/style.css 32.00 B src/Cropperjs/assets build: ESM ⚡️ Build success in 116ms src/Cropperjs/assets build: DTS Build start src/Cropperjs/assets build: DTS ⚡️ Build success in 3054ms src/Cropperjs/assets build: DTS dist/controller.d.ts 369.00 B src/Cropperjs/assets build: Done src/Dropzone/assets build$ tsx ../../../bin/build_package.ts . src/Dropzone/assets build: CLI Building entry: src/controller.ts, src/style.css src/Dropzone/assets build: CLI Using tsconfig: ../../../tsconfig.packages.json src/Dropzone/assets build: CLI tsup v8.5.0 src/Dropzone/assets build: CLI Target: es2021 src/Dropzone/assets build: CLI Cleaning output folder src/Dropzone/assets build: ESM Build start src/Dropzone/assets build: [Symfony UX] Minified CSS file: /home/runner/work/ux/ux/src/Dropzone/assets/dist/style.css src/Dropzone/assets build: [Symfony UX] Renamed dist/style.css to dist/style.min.css src/Dropzone/assets build: ESM dist/controller.js 2.92 KB src/Dropzone/assets build: ESM dist/style.css 943.00 B src/Dropzone/assets build: ESM ⚡️ Build success in 78ms src/Dropzone/assets build: DTS Build start src/Dropzone/assets build: DTS ⚡️ Build success in 3015ms src/Dropzone/assets build: DTS dist/controller.d.ts 723.00 B src/Dropzone/assets build: Done src/Autocomplete/assets build$ tsx ../../../bin/build_package.ts . src/Autocomplete/assets build: CLI Building entry: src/controller.ts src/Autocomplete/assets build: CLI Using tsconfig: ../../../tsconfig.packages.json src/Autocomplete/assets build: CLI tsup v8.5.0 src/Autocomplete/assets build: CLI Target: es2021 src/Autocomplete/assets build: CLI Cleaning output folder src/Autocomplete/assets build: ESM Build start src/Autocomplete/assets build: ESM dist/controller.js 14.99 KB src/Autocomplete/assets build: ESM ⚡️ Build success in 62ms src/Autocomplete/assets build: DTS Build start src/Autocomplete/assets build: DTS ⚡️ Build success in 3635ms src/Autocomplete/assets build: DTS dist/controller.d.ts 1.95 KB src/Autocomplete/assets build: Done src/Chartjs/assets build$ tsx ../../../bin/build_package.ts . src/Chartjs/assets build: CLI Building entry: src/controller.ts src/Chartjs/assets build: CLI Using tsconfig: ../../../tsconfig.packages.json src/Chartjs/assets build: CLI tsup v8.5.0 src/Chartjs/assets build: CLI Target: es2021 src/Chartjs/assets build: CLI Cleaning output folder src/Chartjs/assets build: ESM Build start src/Chartjs/assets build: ESM dist/controller.js 2.26 KB src/Chartjs/assets build: ESM ⚡️ Build success in 56ms src/Chartjs/assets build: DTS Build start src/Chartjs/assets build: DTS ⚡️ Build success in 3692ms src/Chartjs/assets build: DTS dist/controller.d.ts 352.00 B src/Chartjs/assets build: Done src/Map/src/Bridge/Google/assets build$ tsx ../../../../../../bin/build_package.ts . src/Map/src/Bridge/Google/assets build: CLI Building entry: src/map_controller.ts src/Map/src/Bridge/Google/assets build: CLI Using tsconfig: ../../../../../../tsconfig.packages.json src/Map/src/Bridge/Google/assets build: CLI tsup v8.5.0 src/Map/src/Bridge/Google/assets build: CLI Target: es2021 src/Map/src/Bridge/Google/assets build: CLI Cleaning output folder src/Map/src/Bridge/Google/assets build: ESM Build start Error: /src/Bridge/Google/assets build: ✘ [ERROR] Could not resolve "`@symfony`/ux-map" src/Map/src/Bridge/Google/assets build: src/map_controller.ts:24:49: src/Map/src/Bridge/Google/assets build: 24 │ import AbstractMapController, { IconTypes } from '`@symfony`/ux-map'; src/Map/src/Bridge/Google/assets build: ╵ ~~~~~~~~~~~~~~~~~ src/Map/src/Bridge/Google/assets build: You can mark the path "`@symfony`/ux-map" as external to exclude it from the bundle, which will remove this error and leave the unresolved path in the bundle. src/Map/src/Bridge/Google/assets build: ESM Build failed src/Map/src/Bridge/Google/assets build: /home/runner/work/ux/ux/node_modules/.pnpm/esbuild@0.25.8/node_modules/esbuild/lib/main.js:1467 src/Map/src/Bridge/Google/assets build: let error = new Error(text); src/Map/src/Bridge/Google/assets build: ^ src/Map/src/Bridge/Google/assets build: Error: Build failed with 1 error: src/Map/src/Bridge/Google/assets build: src/map_controller.ts:24:49: ERROR: Could not resolve "`@symfony`/ux-map" src/Map/src/Bridge/Google/assets build: at failureErrorWithLog (/home/runner/work/ux/ux/node_modules/.pnpm/esbuild@0.25.8/node_modules/esbuild/lib/main.js:1467:15) src/Map/src/Bridge/Google/assets build: at /home/runner/work/ux/ux/node_modules/.pnpm/esbuild@0.25.8/node_modules/esbuild/lib/main.js:926:25 src/Map/src/Bridge/Google/assets build: at runOnEndCallbacks (/home/runner/work/ux/ux/node_modules/.pnpm/esbuild@0.25.8/node_modules/esbuild/lib/main.js:1307:45) src/Map/src/Bridge/Google/assets build: at buildResponseToResult (/home/runner/work/ux/ux/node_modules/.pnpm/esbuild@0.25.8/node_modules/esbuild/lib/main.js:924:7) src/Map/src/Bridge/Google/assets build: at /home/runner/work/ux/ux/node_modules/.pnpm/esbuild@0.25.8/node_modules/esbuild/lib/main.js:951:16 src/Map/src/Bridge/Google/assets build: at responseCallbacks.<computed> (/home/runner/work/ux/ux/node_modules/.pnpm/esbuild@0.25.8/node_modules/esbuild/lib/main.js:603:9) src/Map/src/Bridge/Google/assets build: at handleIncomingPacket (/home/runner/work/ux/ux/node_modules/.pnpm/esbuild@0.25.8/node_modules/esbuild/lib/main.js:658:12) src/Map/src/Bridge/Google/assets build: at Socket.readFromStdout (/home/runner/work/ux/ux/node_modules/.pnpm/esbuild@0.25.8/node_modules/esbuild/lib/main.js:581:7) src/Map/src/Bridge/Google/assets build: at Socket.emit (node:events:518:28) src/Map/src/Bridge/Google/assets build: at addChunk (node:internal/streams/readable:561:12) { src/Map/src/Bridge/Google/assets build: errors: [Getter/Setter], src/Map/src/Bridge/Google/assets build: warnings: [Getter/Setter] src/Map/src/Bridge/Google/assets build: } src/Map/src/Bridge/Google/assets build: Node.js v22.11.0 src/Map/src/Bridge/Google/assets build: Failed /home/runner/work/ux/ux/src/Map/src/Bridge/Google/assets: ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL `@symfony`/ux-google-map@2.29.1 build: `tsx ../../../../../../bin/build_package.ts .` Exit status 1 ELIFECYCLE Command failed with exit code 1. ``` I suggest to modify the `pnpm build` root script to build UX Map assets first. Commits ------- f564b47 [Pkg] Ensure UX Map assets are built first
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.
Alternative to #2982.
Moving the
"@symfony/ux-map": "workspace:*"
requirements outside the package.json allows the Bridges JavaScript assets to be installed withnpm
when@symfony/ux-leaflet-map
(or@symfony/ux-google-map
) is using constraint versionfile:vendor/symfony/ux-leaflet-map/assets
(orfile:vendor/symfony/ux-google-map/assets
) in the user application.This is possible to this super feature from pnpm: packageExtensions, which allows to override some part of package definitions in file
pnpm-workspace.yaml
:@symfony/ux-map
is a dependency of@symfony/ux-leaflet-map
and@symfony/ux-google-map
🎉workspace:*
anymore in anypackage.json
🎉It is not possible to defines
packageExtensions.devDependencies
, so I usedpackageExtensions.dependencies
instead but that's fine.@symfony/ux-map
is not referenced in anypackage.json
when runningpnpm pack
insrc/Bridge/*/assets
.