forked from heroku/heroku-buildpack-nodejs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dependencies.sh
35 lines (32 loc) · 1001 Bytes
/
dependencies.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
install_node_modules() {
local build_dir=${1:-}
if [ -e $build_dir/package.json ]; then
cd $build_dir
echo "Pruning any extraneous modules"
npm prune --unsafe-perm --userconfig $build_dir/.npmrc 2>&1
if [ -e $build_dir/npm-shrinkwrap.json ]; then
echo "Installing node modules (package.json + shrinkwrap)"
else
echo "Installing node modules (package.json)"
fi
npm install --unsafe-perm --userconfig $build_dir/.npmrc 2>&1
else
echo "Skipping (no package.json)"
fi
}
rebuild_node_modules() {
local build_dir=${1:-}
if [ -e $build_dir/package.json ]; then
cd $build_dir
echo "Rebuilding any native modules"
npm rebuild 2>&1
if [ -e $build_dir/npm-shrinkwrap.json ]; then
echo "Installing any new modules (package.json + shrinkwrap)"
else
echo "Installing any new modules (package.json)"
fi
npm install --unsafe-perm --userconfig $build_dir/.npmrc 2>&1
else
echo "Skipping (no package.json)"
fi
}