Skip to content

Commit b27ceeb

Browse files
committed
Prune dev dependencies when building release
1 parent be062d0 commit b27ceeb

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

ci/build/build-release.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,15 @@ EOF
8585
) > "$RELEASE_PATH/package.json"
8686
mv npm-shrinkwrap.json "$RELEASE_PATH"
8787

88-
rsync ci/build/npm-postinstall.sh "$RELEASE_PATH/postinstall.sh"
89-
9088
if [ "$KEEP_MODULES" = 1 ]; then
9189
rsync node_modules/ "$RELEASE_PATH/node_modules"
90+
# Remove dev dependencies.
91+
pushd "$RELEASE_PATH"
92+
npm prune --production
93+
popd
9294
fi
95+
96+
rsync ci/build/npm-postinstall.sh "$RELEASE_PATH/postinstall.sh"
9397
}
9498

9599
bundle_vscode() {
@@ -108,7 +112,9 @@ bundle_vscode() {
108112
# need it for the npm package.
109113
rsync_opts+=(--exclude /node)
110114

111-
# Exclude Node modules.
115+
# Exclude Node modules. Note that these will already only include production
116+
# dependencies, so if we do keep them there is no need to do any
117+
# post-processing to remove dev dependencies.
112118
if [[ $KEEP_MODULES = 0 ]]; then
113119
rsync_opts+=(--exclude node_modules)
114120
fi

0 commit comments

Comments
 (0)