Skip to content

Commit de9b5b5

Browse files
committed
Readd linter, symlinking in prod, clarify usage.
1 parent c3dc8ce commit de9b5b5

File tree

7 files changed

+56
-13
lines changed

7 files changed

+56
-13
lines changed

.gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ release-gcp/
99
release-images/
1010
node_modules
1111
vendor/modules
12-
/node_modules.asar
1312
node-*
1413
/plugins
1514
/lib/coder-cloud-agent

ci/build/build-release.sh

+4
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ EOF
9999
# yarn to fetch node_modules if necessary without build scripts running.
100100
# We cannot use --no-scripts because we still want dependent package scripts to run.
101101
jq 'del(.scripts)' < "$VSCODE_SRC_PATH/package.json" > "$VSCODE_OUT_PATH/package.json"
102+
103+
pushd "$VSCODE_OUT_PATH"
104+
symlink_asar
105+
popd
102106
}
103107

104108
main "$@"

ci/build/npm-postinstall.sh

+13
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,26 @@ main() {
7676
fi
7777
}
7878

79+
# This is a copy of symlink_asar in ../lib.sh. Look there for details.
80+
symlink_asar() {
81+
rm -rf node_modules.asar
82+
if [ "${WINDIR-}" ]; then
83+
mklink /J node_modules.asar node_modules
84+
else
85+
ln -s node_modules node_modules.asar
86+
fi
87+
}
88+
7989
vscode_yarn() {
8090
echo 'Installing vendor dependencies...'
8191
cd vendor/modules/code-oss-dev
8292
yarn --production --frozen-lockfile
8393

94+
symlink_asar
95+
8496
cd extensions
8597
yarn --production --frozen-lockfile
98+
8699
for ext in */; do
87100
ext="${ext%/}"
88101
echo "extensions/$ext: installing dependencies"

ci/dev/fmt.sh

+8-8
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ main() {
3232
doctoc --title '# iPad' docs/ipad.md > /dev/null
3333
doctoc --title '# Termux' docs/termux.md > /dev/null
3434

35-
## TODO: replace with a method that generates fewer false positives.
36-
# if [[ ${CI-} && $(git ls-files --other --modified --exclude-standard) ]]; then
37-
# echo "Files need generation or are formatted incorrectly:"
38-
# git -c color.ui=always status | grep --color=no '\[31m'
39-
# echo "Please run the following locally:"
40-
# echo " yarn fmt"
41-
# exit 1
42-
# fi
35+
# TODO: replace with a method that generates fewer false positives.
36+
if [[ ${CI-} && $(git ls-files --other --modified --exclude-standard) ]]; then
37+
echo "Files need generation or are formatted incorrectly:"
38+
git -c color.ui=always status | grep --color=no '\[31m'
39+
echo "Please run the following locally:"
40+
echo " yarn fmt"
41+
exit 1
42+
fi
4343
}
4444

4545
main "$@"

ci/dev/postinstall.sh

+11-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,17 @@ main() {
1313
cd vendor
1414
echo 'Installing vendor dependencies...'
1515

16-
# Ignore scripts to prevent partial install which omits development dependencies.
17-
yarn install --modules-folder modules --ignore-scripts
16+
# * We install in 'modules' instead of 'node_modules' because VS Code's extensions
17+
# use a webpack config which cannot differentiate between its own node_modules
18+
# and itself being in a directory with the same name.
19+
#
20+
# * We ignore scripts because NPM/Yarn's default behavior is to assume that
21+
# devDependencies are not needed, and that even git repo based packages are
22+
# assumed to be compiled. Because the default behavior for VS Code's `postinstall`
23+
# assumes we're also compiled, this needs to be ignored.
24+
yarn install --modules-folder modules --ignore-scripts --frozen-lockfile
25+
26+
# Finally, run the vendor `postinstall`
1827
yarn run postinstall
1928
}
2029

ci/lib.sh

+18
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,21 @@ export OS
104104
# RELEASE_PATH is the destination directory for the release from the root.
105105
# Defaults to release
106106
RELEASE_PATH="${RELEASE_PATH-release}"
107+
108+
# VS Code bundles some modules into an asar which is an archive format that
109+
# works like tar. It then seems to get unpacked into node_modules.asar.
110+
#
111+
# I don't know why they do this but all the dependencies they bundle already
112+
# exist in node_modules so just symlink it. We have to do this since not only VS
113+
# Code itself but also extensions will look specifically in this directory for
114+
# files (like the ripgrep binary or the oniguruma wasm).
115+
symlink_asar() {
116+
rm -rf node_modules.asar
117+
if [ "${WINDIR-}" ]; then
118+
# mklink takes the link name first.
119+
mklink /J node_modules.asar node_modules
120+
else
121+
# ln takes the link name second.
122+
ln -s node_modules node_modules.asar
123+
fi
124+
}

vendor/yarn.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -250,9 +250,9 @@ [email protected]:
250250
commander "2.11.x"
251251
ws "^7.2.0"
252252

253-
code-oss-dev@cdr/vscode#50f8fff79d612104eed6eb067daf596031fe9f83:
253+
code-oss-dev@cdr/vscode#96a09a7846538c3bbedb6a2aeca729537bb8202b:
254254
version "1.60.0"
255-
resolved "https://codeload.github.com/cdr/vscode/tar.gz/50f8fff79d612104eed6eb067daf596031fe9f83"
255+
resolved "https://codeload.github.com/cdr/vscode/tar.gz/96a09a7846538c3bbedb6a2aeca729537bb8202b"
256256
dependencies:
257257
"@coder/logger" "^1.1.16"
258258
"@microsoft/applicationinsights-web" "^2.6.4"

0 commit comments

Comments
 (0)