forked from jhipster/jhipster-registry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
npmw
executable file
·33 lines (27 loc) · 836 Bytes
/
npmw
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
#!/bin/sh
basedir=`dirname "$0"`
if [ -f "$basedir/mvnw" ]; then
bindir="$basedir/target/node"
repodir="$basedir/target/node/node_modules"
installCommand="$basedir/mvnw -Pwebapp frontend:install-node-and-npm@install-node-and-npm"
PATH="$basedir/$builddir/:$PATH"
NPM_EXE="$basedir/$builddir/node_modules/npm/bin/npm-cli.js"
NODE_EXE="$basedir/$builddir/node"
else
bindir="$basedir/build/node/bin"
repodir="$basedir/build/node/lib/node_modules"
installCommand="$basedir/gradlew npmSetup"
fi
PATH="$bindir:$PATH"
NPM_EXE="$repodir/npm/bin/npm-cli.js"
NODE_EXE="$bindir/node"
if ! [ -x "$NPM_EXE" ]; then
$installCommand || true
fi
if ! [ -x "$NPM_EXE" ]; then
echo "Using npm installed globally"
npm "$@"
else
echo "Using npm installed locally $($NODE_EXE $NPM_EXE --version)"
$NODE_EXE $NPM_EXE "$@"
fi