Skip to content

Commit 1efc5f1

Browse files
fix: use npm and yarn consistently in build and release (#5852)
* refactor: remove keytar dep in cross-compile * refactor: try other keytar package * refactor: remove keytar step in cross-compile * fix: manually remove keytar * try this first * I think this is it * Revert "I think this is it" This reverts commit 5c566b0. * okay this is it * fixup * try legacy peer * remove keytar before standalone * wrong path * maybe * revert: change *npm* back to npm* * revert: don't uninstall keytar * fix: use npm run standalone-release * fixup formatting * Revert "refactor: remove yarn.lock steps (#5850)" This reverts commit 907747d. * fixup: remove the --exclude * refactor: remove yarn.lock check Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
1 parent ef5865f commit 1efc5f1

File tree

3 files changed

+13
-21
lines changed

3 files changed

+13
-21
lines changed

.github/workflows/release.yaml

+4-5
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ jobs:
7070
# NOTE: && here is deliberate - GitHub puts each line in its own `.sh`
7171
# file when running inside a docker container.
7272
- name: Build standalone release
73-
run: source scl_source enable devtoolset-9 && yarn release:standalone
73+
run: source scl_source enable devtoolset-9 && npm run release:standalone
7474

7575
- name: Fetch dependencies from cache
7676
id: cache-node-modules
@@ -172,9 +172,6 @@ jobs:
172172
env:
173173
PACKAGE: ${{ format('g++-{0}', matrix.prefix) }}
174174

175-
- name: Install keytar dependencies
176-
run: sudo apt install -y libsecret-1-dev
177-
178175
- name: Download npm package
179176
uses: actions/download-artifact@v3
180177
with:
@@ -183,6 +180,8 @@ jobs:
183180
- name: Decompress npm package
184181
run: tar -xzf package.tar.gz
185182

183+
# NOTE@jsjoeio - npm fails here
184+
# so use yarn
186185
- name: Build standalone release
187186
run: yarn release:standalone
188187

@@ -239,7 +238,7 @@ jobs:
239238
run: tar -xzf package.tar.gz
240239

241240
- name: Build standalone release
242-
run: yarn release:standalone
241+
run: npm run release:standalone
243242

244243
- name: Fetch dependencies from cache
245244
id: cache-node-modules

ci/build/build-release.sh

+3
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ bundle_code_server() {
5656
}
5757
EOF
5858
) > "$RELEASE_PATH/package.json"
59+
rsync yarn.lock "$RELEASE_PATH"
5960
mv npm-shrinkwrap.json "$RELEASE_PATH"
6061

6162
rsync ci/build/npm-postinstall.sh "$RELEASE_PATH/postinstall.sh"
@@ -96,10 +97,12 @@ bundle_vscode() {
9697
"$VSCODE_SRC_PATH/remote/package.json" \
9798
"$VSCODE_SRC_PATH/package.json" > "$VSCODE_OUT_PATH/package.json"
9899

100+
rsync "$VSCODE_SRC_PATH/remote/yarn.lock" "$VSCODE_OUT_PATH/yarn.lock"
99101
mv "$VSCODE_SRC_PATH/remote/npm-shrinkwrap.json" "$VSCODE_OUT_PATH/npm-shrinkwrap.json"
100102

101103
# Include global extension dependencies as well.
102104
rsync "$VSCODE_SRC_PATH/extensions/package.json" "$VSCODE_OUT_PATH/extensions/package.json"
105+
rsync "$VSCODE_SRC_PATH/extensions/yarn.lock" "$VSCODE_OUT_PATH/extensions/yarn.lock"
103106
mv "$VSCODE_SRC_PATH/extensions/npm-shrinkwrap.json" "$VSCODE_OUT_PATH/extensions/npm-shrinkwrap.json"
104107
rsync "$VSCODE_SRC_PATH/extensions/postinstall.mjs" "$VSCODE_OUT_PATH/extensions/postinstall.mjs"
105108
}

ci/build/npm-postinstall.sh

+6-16
Original file line numberDiff line numberDiff line change
@@ -128,24 +128,14 @@ install_with_yarn_or_npm() {
128128
# NOTE@edvincent: We want to keep using the package manager that the end-user was using to install the package.
129129
# This also ensures that when *we* run `yarn` in the development process, the yarn.lock file is used.
130130
case "${npm_config_user_agent-}" in
131-
*npm*)
132-
if [ -f "yarn.lock" ]; then
133-
echo "yarn.lock file present, running in development mode. use yarn to install code-server!"
134-
exit 1
135-
else
136-
# HACK: NPM's use of semver doesn't like resolving some peerDependencies that vscode (upstream) brings in the form of pre-releases.
137-
# The legacy behavior doesn't complain about pre-releases being used, falling back to that for now.
138-
# See https://github.com//pull/5071
139-
npm install --unsafe-perm --legacy-peer-deps --omit=dev
140-
fi
131+
npm*)
132+
# HACK: NPM's use of semver doesn't like resolving some peerDependencies that vscode (upstream) brings in the form of pre-releases.
133+
# The legacy behavior doesn't complain about pre-releases being used, falling back to that for now.
134+
# See https://github.com//pull/5071
135+
npm install --unsafe-perm --legacy-peer-deps --omit=dev
141136
;;
142137
yarn*)
143-
if [ -f "yarn.lock" ]; then
144-
yarn --production --frozen-lockfile --no-default-rc
145-
else
146-
echo "yarn.lock file not present, not running in development mode. use npm to install code-server!"
147-
exit 1
148-
fi
138+
yarn --production --frozen-lockfile --no-default-rc
149139
;;
150140
*)
151141
echo "Could not determine which package manager is being used to install code-server"

0 commit comments

Comments
 (0)