Rebuild all node_modules on npm install
Stuff like ripgrep needs to be refetched so we cannot bundle node_modules at all.
This commit is contained in:
@ -49,11 +49,14 @@ EOF
|
||||
|
||||
bundle_vscode() {
|
||||
mkdir -p "$VSCODE_OUT_PATH"
|
||||
rsync "$VSCODE_SRC_PATH/package.json" "$VSCODE_OUT_PATH"
|
||||
rsync "$VSCODE_SRC_PATH/yarn.lock" "$VSCODE_OUT_PATH"
|
||||
rsync "$VSCODE_SRC_PATH/node_modules" "$VSCODE_OUT_PATH"
|
||||
rsync "$VSCODE_SRC_PATH/out-vscode${MINIFY+-min}/" "$VSCODE_OUT_PATH/out"
|
||||
|
||||
rsync "$VSCODE_SRC_PATH/.build/extensions/" "$VSCODE_OUT_PATH/extensions"
|
||||
rm -Rf "$VSCODE_OUT_PATH/extensions/node_modules"
|
||||
rsync "$VSCODE_SRC_PATH/extensions/package.json" "$VSCODE_OUT_PATH/extensions"
|
||||
rsync "$VSCODE_SRC_PATH/extensions/yarn.lock" "$VSCODE_OUT_PATH/extensions"
|
||||
rsync "$VSCODE_SRC_PATH/extensions/postinstall.js" "$VSCODE_OUT_PATH/extensions"
|
||||
|
||||
mkdir -p "$VSCODE_OUT_PATH/resources/linux"
|
||||
rsync "$VSCODE_SRC_PATH/resources/linux/code.png" "$VSCODE_OUT_PATH/resources/linux/code.png"
|
||||
@ -68,26 +71,10 @@ bundle_vscode() {
|
||||
EOF
|
||||
) > "$VSCODE_OUT_PATH/product.json"
|
||||
|
||||
pushd "$VSCODE_OUT_PATH"
|
||||
yarn --production --frozen-lockfile --ignore-scripts
|
||||
popd
|
||||
|
||||
# We clear any native module builds.
|
||||
local native_modules
|
||||
mapfile -t native_modules < <(find "$VSCODE_OUT_PATH/node_modules" -name "binding.gyp" -exec dirname {} \;)
|
||||
local nm
|
||||
for nm in "${native_modules[@]}"; do
|
||||
rm -R "$nm/build"
|
||||
done
|
||||
|
||||
# We have to rename node_modules to node_modules.bundled to avoid them being ignored by yarn.
|
||||
local node_modules
|
||||
mapfile -t node_modules < <(find "$VSCODE_OUT_PATH" -depth -name "node_modules")
|
||||
local nm
|
||||
for nm in "${node_modules[@]}"; do
|
||||
rm -Rf "$nm.bundled"
|
||||
mv "$nm" "$nm.bundled"
|
||||
done
|
||||
# We remove the scripts field so that later on we can run
|
||||
# yarn to fetch node_modules if necessary without build scripts running.
|
||||
# We cannot use --no-scripts because we still want dependant package scripts to run.
|
||||
jq 'del(.scripts)' < "$VSCODE_SRC_PATH/package.json" > "$VSCODE_OUT_PATH/package.json"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
|
Reference in New Issue
Block a user