Skip to content

Override existing asar symlink in postinstall #3369

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
merged 1 commit into from
May 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ VS Code v1.56
### Bug Fixes

- fix: Check the logged user instead of $USER #3330 @videlanicolas
- fix: Fix broken node_modules.asar symlink in npm package #3355 @code-asher

### Documentation

Expand Down
19 changes: 11 additions & 8 deletions ci/build/npm-postinstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,21 @@ main() {
fi
}

# This is a copy of symlink_asar in ../lib.sh. Look there for details.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we import that lib and share code instead of duplicating it? we have a general problem (especially in our other projects) that we have unnecessary copies of things, and that often results in inconsistencies between those files over time

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that makes a lot of sense, in fact they were already out of sync with this version using -e and the other using -L. I opened #3371

symlink_asar() {
rm -f node_modules.asar
if [ "${WINDIR-}" ]; then
mklink /J node_modules.asar node_modules
else
ln -s node_modules node_modules.asar
fi
}

vscode_yarn() {
cd lib/vscode
yarn --production --frozen-lockfile

# This is a copy of symlink_asar in ../lib.sh. Look there for details.
if [ ! -e node_modules.asar ]; then
if [ "${WINDIR-}" ]; then
mklink /J node_modules.asar node_modules
else
ln -s node_modules node_modules.asar
fi
fi
symlink_asar

cd extensions
yarn --production --frozen-lockfile
Expand Down
15 changes: 7 additions & 8 deletions ci/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,12 @@ RELEASE_PATH="${RELEASE_PATH-release}"
# Code itself but also extensions will look specifically in this directory for
# files (like the ripgrep binary or the oniguruma wasm).
symlink_asar() {
if [ ! -L node_modules.asar ]; then
if [ "${WINDIR-}" ]; then
# mklink takes the link name first.
mklink /J node_modules.asar node_modules
else
# ln takes the link name second.
ln -s node_modules node_modules.asar
fi
rm -f node_modules.asar
if [ "${WINDIR-}" ]; then
# mklink takes the link name first.
mklink /J node_modules.asar node_modules
else
# ln takes the link name second.
ln -s node_modules node_modules.asar
fi
}