@@ -40,7 +40,7 @@ bundle_code_server() {
4040 {
4141 "commit": "$( git rev-parse HEAD) ",
4242 "scripts": {
43- "postinstall": "cd lib/vscode && yarn --production && cd extensions && yarn --production "
43+ "postinstall": "cd lib/vscode && npm rebuild # Builds native modules "
4444 }
4545 }
4646EOF
4949
5050bundle_vscode () {
5151 mkdir -p " $VSCODE_OUT_PATH "
52+ rsync " $VSCODE_SRC_PATH /package.json" " $VSCODE_OUT_PATH "
53+ rsync " $VSCODE_SRC_PATH /yarn.lock" " $VSCODE_OUT_PATH "
54+ rsync " $VSCODE_SRC_PATH /node_modules" " $VSCODE_OUT_PATH "
5255 rsync " $VSCODE_SRC_PATH /out-vscode${MINIFY+-min} /" " $VSCODE_OUT_PATH /out"
5356 rsync " $VSCODE_SRC_PATH /.build/extensions/" " $VSCODE_OUT_PATH /extensions"
54- rm -Rf " $VSCODE_OUT_PATH /extensions/node_modules"
55- rsync " $VSCODE_SRC_PATH /extensions/package.json" " $VSCODE_OUT_PATH /extensions"
56- rsync " $VSCODE_SRC_PATH /extensions/yarn.lock" " $VSCODE_OUT_PATH /extensions"
57- rsync " $VSCODE_SRC_PATH /extensions/postinstall.js" " $VSCODE_OUT_PATH /extensions"
5857
5958 mkdir -p " $VSCODE_OUT_PATH /resources/linux"
6059 rsync " $VSCODE_SRC_PATH /resources/linux/code.png" " $VSCODE_OUT_PATH /resources/linux/code.png"
6160
62- rsync " $VSCODE_SRC_PATH /yarn.lock" " $VSCODE_OUT_PATH "
63-
6461 # Adds the commit and date to product.json
6562 jq --slurp ' .[0] * .[1]' " $VSCODE_SRC_PATH /product.json" <(
6663 cat << EOF
@@ -71,12 +68,17 @@ bundle_vscode() {
7168EOF
7269 ) > " $VSCODE_OUT_PATH /product.json"
7370
74- # We remove the scripts field so that later on we can run
75- # yarn to fetch node_modules if necessary without build scripts
76- # being ran.
77- # We cannot use --no-scripts because we still want dependant package scripts to run
78- # for native modules to be rebuilt.
79- jq ' del(.scripts)' < " $VSCODE_SRC_PATH /package.json" > " $VSCODE_OUT_PATH /package.json"
71+ pushd " $VSCODE_OUT_PATH "
72+ yarn --production --ignore-scripts
73+ popd
74+
75+ # Now we clear any native module builds.
76+ local nativeModules
77+ mapfile -t nativeModules < <( find " $VSCODE_OUT_PATH /node_modules" -name " binding.gyp" -exec dirname {} \; )
78+ local nm
79+ for nm in " ${nativeModules[@]} " ; do
80+ rm -R " $nm /build"
81+ done
8082}
8183
8284main " $@ "
0 commit comments