Skip to content

Commit

Permalink
mgr/dashboard: Replace "npm install" with "npm ci"
Browse files Browse the repository at this point in the history
"npm ci" is the recommended command to install dependencies
in a continuous integration system.

It will make sure node_modules is empty and that the version in
"package-lock.json" match the ones in "package.json"

Signed-off-by: Tiago Melo <tmelo@suse.com>
  • Loading branch information
tspmelo committed Jul 31, 2018
1 parent 7299ee3 commit b4fc13d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
7 changes: 4 additions & 3 deletions make-dist
Expand Up @@ -80,11 +80,12 @@ build_dashboard_frontend() {
TEMP_DIR=`mktemp -d`
$CURR_DIR/src/tools/setup-virtualenv.sh --python=$(_python_autoselect) $TEMP_DIR
$TEMP_DIR/bin/pip install nodeenv
$TEMP_DIR/bin/nodeenv -p -n 8.10.0
$TEMP_DIR/bin/nodeenv -p --node=8.11.3
cd src/pybind/mgr/dashboard/frontend
. $TEMP_DIR/bin/activate
npm install
npm run build -- --prod
npm i -g npm --unsafe-perm
npm ci
npm run build -- --prod --progress=false
deactivate
cd $CURR_DIR
rm -rf $TEMP_DIR
Expand Down
4 changes: 2 additions & 2 deletions src/pybind/mgr/dashboard/CMakeLists.txt
Expand Up @@ -34,7 +34,7 @@ add_custom_command(
OUTPUT "${mgr-dashboard-nodeenv}/bin/npm"
COMMAND ${CMAKE_SOURCE_DIR}/src/tools/setup-virtualenv.sh --python=${MGR_PYTHON_EXECUTABLE} ${mgr-dashboard-nodeenv}
COMMAND ${mgr-dashboard-nodeenv}/bin/pip install nodeenv
COMMAND ${mgr-dashboard-nodeenv}/bin/nodeenv -p -n 8.11.3
COMMAND ${mgr-dashboard-nodeenv}/bin/nodeenv -p --node=8.11.3
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "dashboard nodeenv is being installed"
)
Expand All @@ -45,7 +45,7 @@ add_custom_target(mgr-dashboard-nodeenv

add_npm_command(
OUTPUT "${CMAKE_SOURCE_DIR}/src/pybind/mgr/dashboard/frontend/node_modules"
COMMAND npm install
COMMAND npm i -g npm@6.2.0 --unsafe-perm && npm ci
DEPENDS frontend/package.json
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src/pybind/mgr/dashboard/frontend
COMMENT "dashboard frontend dependencies are being installed"
Expand Down
2 changes: 1 addition & 1 deletion src/pybind/mgr/dashboard/HACKING.rst
Expand Up @@ -16,7 +16,7 @@ Prerequisites
~~~~~~~~~~~~~

* Node 8.9.0 or higher
* NPM 5.5.1 or higher
* NPM 5.7.0 or higher

nodeenv:
During Ceph's build we create a virtualenv with ``node`` and ``npm``
Expand Down
2 changes: 1 addition & 1 deletion src/pybind/mgr/dashboard/run-frontend-e2e-tests.sh
Expand Up @@ -49,7 +49,7 @@ fi
cd $DASH_DIR/frontend
jq '.["/api/"].target'=$BASE_URL proxy.conf.json.sample | jq '.["/ui-api/"].target'=$BASE_URL > proxy.conf.json
. $BUILD_DIR/src/pybind/mgr/dashboard/node-env/bin/activate
npm install
npm ci

if [ $DEVICE == "chrome" ]; then
npm run e2e || stop
Expand Down

0 comments on commit b4fc13d

Please sign in to comment.