@@ -60,21 +60,51 @@ jobs:
6060 working-directory : test_apps/encore-app
6161 dependency-versions : highest
6262
63+ - name : Manually replacing "workspace:*" references
64+ run : |
65+ for PACKAGE_DATA in $(cd ../..; pnpm ls -r --json --depth -1 | jq 'map(select(.private != true))' | jq -c '.[]'); do
66+ PACKAGE_NAME=$(echo $PACKAGE_DATA | jq -r '.name')
67+ PACKAGE_ABSOLUTE_PATH=$(echo $PACKAGE_DATA | jq -r '.path')
68+
69+ # Manually replace "workspace:" constraints with the actual package version, it ensure packages can be installed with npm
70+ jq -rc '[(.dependencies // {}) + (.devDependencies // {}) | to_entries[] | select(.value == "workspace:*") | .key][]' "$PACKAGE_ABSOLUTE_PATH/package.json" | while read -r PACKAGE_FROM_WORKSPACE ; do
71+ # Extract the resolved version of the package from the workspace, e.g.: "link:../../../../assets"
72+ RESOLVED_VERSION=$(pnpm ls --filter $PACKAGE_NAME --json | jq -r --arg PACKAGE_FROM_WORKSPACE $PACKAGE_FROM_WORKSPACE '
73+ .[].dependencies // {} + .[].devDependencies // {} |
74+ to_entries[] |
75+ select(.value.from == $PACKAGE_FROM_WORKSPACE) |
76+ .value.version
77+ ')
78+
79+ echo "Resolved version for $PACKAGE_FROM_WORKSPACE: $RESOLVED_VERSION"
80+
81+
82+ # Replace "link:" (pnpm) with "file:" (compatible with npm)
83+ RESOLVED_VERSION=${RESOLVED_VERSION/link:/file:}
84+
85+ # Replace the package "workspace:*" with the actual version
86+ echo "Replacing \"$PACKAGE_FROM_WORKSPACE\" with \"$RESOLVED_VERSION\" in $PACKAGE_ABSOLUTE_PATH/package.json"
87+ sed -i "s|\"$PACKAGE_FROM_WORKSPACE\": \"workspace:\*\"|\"$PACKAGE_FROM_WORKSPACE\": \"$RESOLVED_VERSION\"|g" "$PACKAGE_ABSOLUTE_PATH/package.json"
88+ done;
89+ done
90+
6391 - working-directory : test_apps/encore-app
64- run : pnpm install --ignore-workspace
92+ run : npm install
6593
6694 - if : matrix.ux-packages-source == 'js-packages'
6795 name : Install UX JS packages with a JS package manager
6896 working-directory : test_apps/encore-app
6997 run : |
7098 PACKAGES_TO_INSTALL=''
71- for PACKAGE in $(cd ../..; pnpm ls -r --json --depth -1 | jq 'map(select(.private != true))' | jq -c '.[]'); do
72- PACKAGE_ABSOLUTE_PATH=$(echo $PACKAGE | jq -r '.path')
99+ for PACKAGE_DATA in $(cd ../..; pnpm ls -r --json --depth -1 | jq 'map(select(.private != true))' | jq -c '.[]'); do
100+ PACKAGE_NAME=$(echo $PACKAGE_DATA | jq -r '.name')
101+ PACKAGE_ABSOLUTE_PATH=$(echo $PACKAGE_DATA | jq -r '.path')
73102 PACKAGE_RELATIVE_PATH=$(realpath --relative-to=. "$PACKAGE_ABSOLUTE_PATH")
74103 PACKAGES_TO_INSTALL="$PACKAGES_TO_INSTALL file:$PACKAGE_RELATIVE_PATH"
75104 done
105+
76106 echo "Installing packages: $PACKAGES_TO_INSTALL"
77- pnpm add --save-dev $PACKAGES_TO_INSTALL
107+ npm add --save-dev $PACKAGES_TO_INSTALL
78108
79109 - name : Ensure UX packages are installed from "${{ env.EXPECTED_PATTERN }}"
80110 working-directory : test_apps/encore-app
97127
98128 - name : Ensure project can be built in dev mode
99129 working-directory : test_apps/encore-app
100- run : pnpm run dev
130+ run : npm run dev
101131
102132 - name : Ensure project can be built in prod mode
103133 working-directory : test_apps/encore-app
104- run : pnpm run build
134+ run : npm run build
0 commit comments