File: npm-install

package info (click to toggle)
cockpit 239-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 67,268 kB
  • sloc: javascript: 245,474; ansic: 72,273; python: 23,634; xml: 6,155; sh: 2,919; makefile: 923; sed: 5
file content (41 lines) | stat: -rwxr-xr-x 965 bytes parent folder | download
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
36
37
38
39
40
41
#!/bin/sh -eux

# Development dependencies: See tools/README.node_modules

srcdir=`dirname $0`
test -z "$srcdir" && srcdir=.
top_srcdir="${srcdir}/.."

(test -f "${top_srcdir}/src/ws/cockpit.service.in") || {
    echo "**Error**: Directory '${top_srcdir}' does not look like the top-level Cockpit directory"
    exit 1
}

cd "${top_srcdir}"

npm_version=$(npm --version)
if test ${npm_version%%.*} -lt 3; then
  echo npm version greater than 3.0.0 required, but you have ${npm_version} installed
  exit 1
fi

# causes devDependencies to be skipped
unset NODE_ENV

test -d node_modules && npm prune

retries='3'
while ! npm install; do
  # npm install is flaky, and when it fails, it usually leaves
  # node_modules in a corrupt state, so if that happens, start over
  # again from scratch
  retries=$((${retries}-1))
  if test ${retries} -eq 0; then
    echo 'failed to install nodejs modules'
    exit 1
  fi

  rm -rf node_modules
done

touch node_modules/.stamp