Skip to content

Commit b016370

Browse files
committed
Override existing asar symlink in postinstall
This ensures the link is correct. Should fix coder#3355.
1 parent 825a40e commit b016370

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

ci/build/npm-postinstall.sh

+11-8
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,21 @@ main() {
5656
fi
5757
}
5858

59+
# This is a copy of symlink_asar in ../lib.sh. Look there for details.
60+
symlink_asar() {
61+
rm -f node_modules.asar
62+
if [ "${WINDIR-}" ]; then
63+
mklink /J node_modules.asar node_modules
64+
else
65+
ln -s node_modules node_modules.asar
66+
fi
67+
}
68+
5969
vscode_yarn() {
6070
cd lib/vscode
6171
yarn --production --frozen-lockfile
6272

63-
# This is a copy of symlink_asar in ../lib.sh. Look there for details.
64-
if [ ! -e node_modules.asar ]; then
65-
if [ "${WINDIR-}" ]; then
66-
mklink /J node_modules.asar node_modules
67-
else
68-
ln -s node_modules node_modules.asar
69-
fi
70-
fi
73+
symlink_asar
7174

7275
cd extensions
7376
yarn --production --frozen-lockfile

ci/lib.sh

+7-8
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,12 @@ RELEASE_PATH="${RELEASE_PATH-release}"
112112
# Code itself but also extensions will look specifically in this directory for
113113
# files (like the ripgrep binary or the oniguruma wasm).
114114
symlink_asar() {
115-
if [ ! -L node_modules.asar ]; then
116-
if [ "${WINDIR-}" ]; then
117-
# mklink takes the link name first.
118-
mklink /J node_modules.asar node_modules
119-
else
120-
# ln takes the link name second.
121-
ln -s node_modules node_modules.asar
122-
fi
115+
rm -f node_modules.asar
116+
if [ "${WINDIR-}" ]; then
117+
# mklink takes the link name first.
118+
mklink /J node_modules.asar node_modules
119+
else
120+
# ln takes the link name second.
121+
ln -s node_modules node_modules.asar
123122
fi
124123
}

0 commit comments

Comments
 (0)