Skip to content

Commit

Permalink
Run npm prune before install.
Browse files Browse the repository at this point in the history
- [`npm prune`](https://docs.npmjs.com/cli/prune) will clean up useless packages under `node_modules`.
- Otherwise, the useless packages may affect normal runtime by accident.
  • Loading branch information
lijunle committed Dec 2, 2015
1 parent 4e979c7 commit ce5858d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/templates/deploy.bash.node.template
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ selectNodeVersion
# 3. Install npm packages
if [ -e "$DEPLOYMENT_TARGET/package.json" ]; then
cd "$DEPLOYMENT_TARGET"
eval $NPM_CMD prune --production
eval $NPM_CMD install --production
exitWithMessageOnError "npm failed"
cd - > /dev/null
Expand Down
1 change: 1 addition & 0 deletions lib/templates/deploy.batch.node.template
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ call :SelectNodeVersion
:: 3. Install npm packages
IF EXIST "%DEPLOYMENT_TARGET%\package.json" (
pushd "%DEPLOYMENT_TARGET%"
call :ExecuteCmd !NPM_CMD! prune --production
call :ExecuteCmd !NPM_CMD! install --production
IF !ERRORLEVEL! NEQ 0 goto error
popd
Expand Down
1 change: 1 addition & 0 deletions lib/templates/deploy.posh.node.template
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ selectNodeVersion
if (Test-Path "$DEPLOYMENT_TARGET\package.json") {
pushd "$DEPLOYMENT_TARGET"
try {
iex "$NPM_CMD prune --production"
iex "$NPM_CMD install --production"
} catch {
exitWithMessageOnError "npm failed"
Expand Down

0 comments on commit ce5858d

Please sign in to comment.