@@ -60,21 +60,55 @@ jobs:
60
60
working-directory : test_apps/encore-app
61
61
dependency-versions : highest
62
62
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 "pnpm ls --filter $PACKAGE_NAME --json"
80
+ pnpm ls --filter $PACKAGE_NAME --json
81
+
82
+
83
+ echo "Resolved version for $PACKAGE_FROM_WORKSPACE: $RESOLVED_VERSION"
84
+
85
+
86
+ # Replace "link:" (pnpm) with "file:" (compatible with npm)
87
+ RESOLVED_VERSION=${RESOLVED_VERSION/link:/file:}
88
+
89
+ # Replace the package "workspace:*" with the actual version
90
+ echo "Replacing \"$PACKAGE_FROM_WORKSPACE\" with \"$RESOLVED_VERSION\" in $PACKAGE_ABSOLUTE_PATH/package.json"
91
+ sed -i "s|\"$PACKAGE_FROM_WORKSPACE\": \"workspace:\*\"|\"$PACKAGE_FROM_WORKSPACE\": \"$RESOLVED_VERSION\"|g" "$PACKAGE_ABSOLUTE_PATH/package.json"
92
+ done;
93
+ done
94
+
63
95
- working-directory : test_apps/encore-app
64
- run : pnpm install --ignore-workspace
96
+ run : npm install
65
97
66
98
- if : matrix.ux-packages-source == 'js-packages'
67
99
name : Install UX JS packages with a JS package manager
68
100
working-directory : test_apps/encore-app
69
101
run : |
70
102
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')
103
+ for PACKAGE_DATA in $(cd ../..; pnpm ls -r --json --depth -1 | jq 'map(select(.private != true))' | jq -c '.[]'); do
104
+ PACKAGE_NAME=$(echo $PACKAGE_DATA | jq -r '.name')
105
+ PACKAGE_ABSOLUTE_PATH=$(echo $PACKAGE_DATA | jq -r '.path')
73
106
PACKAGE_RELATIVE_PATH=$(realpath --relative-to=. "$PACKAGE_ABSOLUTE_PATH")
74
107
PACKAGES_TO_INSTALL="$PACKAGES_TO_INSTALL file:$PACKAGE_RELATIVE_PATH"
75
108
done
109
+
76
110
echo "Installing packages: $PACKAGES_TO_INSTALL"
77
- pnpm add --save-dev $PACKAGES_TO_INSTALL
111
+ npm add --save-dev $PACKAGES_TO_INSTALL
78
112
79
113
- name : Ensure UX packages are installed from "${{ env.EXPECTED_PATTERN }}"
80
114
working-directory : test_apps/encore-app
97
131
98
132
- name : Ensure project can be built in dev mode
99
133
working-directory : test_apps/encore-app
100
- run : pnpm run dev
134
+ run : npm run dev
101
135
102
136
- name : Ensure project can be built in prod mode
103
137
working-directory : test_apps/encore-app
104
- run : pnpm run build
138
+ run : npm run build
0 commit comments