From 05ae96b663072ec010b60e79f5de274e4a2d2469 Mon Sep 17 00:00:00 2001 From: CM Lubinski Date: Mon, 14 May 2018 16:29:04 -0400 Subject: [PATCH] Add grunt-cli as a dependency. Rather than requiring users install grunt-cli globally (which can introduce version problems), we'll be explicit that it's a dependency. Since grunt may not be in the global env anymore, we'll also switch to using package.json's `scripts` attr. This bumps out version to 8.4.2 in preparation of our next release. It resolves #508 --- .travis.yml | 1 - Dockerfile | 1 - README.md | 9 ++++----- frontendbuild.sh | 2 +- regulations/static/config/npm-shrinkwrap.json | 2 +- regulations/static/config/package.json | 6 +++++- tox.ini | 4 ++-- 7 files changed, 13 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index 480072ab7..1ca0759f1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,7 +28,6 @@ before_install: - nvm use 6.9.2 install: - pip install tox-travis - - npm install -g grunt-cli script: - ./frontendbuild.sh - if [ "$INTEGRATION_TESTS" = "true" ] && [ "$TRAVIS_PULL_REQUEST" = "false" ]; then ./devops/integration-tests.sh; else tox; fi diff --git a/Dockerfile b/Dockerfile index bdfdef2f2..10b443e8c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,6 @@ RUN apt-get update \ && apt-get install -y $PIP_PACKAGE \ && rm -rf /var/lib/apt/lists/* RUN $PIP_CMD install --upgrade pip setuptools -RUN npm install --quiet -g grunt-cli COPY ["manage.py", "package.json", "example-config.json", "setup.py", "frontendbuild.sh", "Gruntfile.js", ".babelrc", ".eslintignore", ".eslintrc", "/app/src/"] COPY ["regulations", "/app/src/regulations"] diff --git a/README.md b/README.md index c43d992bd..3e5e387e5 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,6 @@ line interface using npm: ```sh cd regulations-site npm install -npm install -g grunt-cli ``` Once all of the above is complete, you may run tests and linting across @@ -126,10 +125,10 @@ There are a number of tasks configured in [Gruntfile.js](Gruntfile.js). On the last lines, you will find tasks that group subtasks into common goals. These include: -* `grunt test` runs JS lint and unit tests. -* `grunt mocha_stanbul` runs only JS unit tests. -* `grunt build-dev` builds a development version of the frontend assets. -* `grunt build-dist` or just `grunt` builds a production version of the +* `npm run grunt test` runs JS lint and unit tests. +* `npm run grunt mocha_stanbul` runs only JS unit tests. +* `npm run grunt build-dev` builds a development version of the frontend assets. +* `npm run grunt build-dist` or just `grunt` builds a production version of the frontend assets (including minification, etc.) ## Integration tests diff --git a/frontendbuild.sh b/frontendbuild.sh index ffe47800c..ce95f93cf 100755 --- a/frontendbuild.sh +++ b/frontendbuild.sh @@ -7,4 +7,4 @@ if [ ! -f config.json ]; then fi npm install --quiet -grunt build-dist +npm run grunt build-dist diff --git a/regulations/static/config/npm-shrinkwrap.json b/regulations/static/config/npm-shrinkwrap.json index 18a78713f..7e5d6e359 100644 --- a/regulations/static/config/npm-shrinkwrap.json +++ b/regulations/static/config/npm-shrinkwrap.json @@ -1,6 +1,6 @@ { "name": "regulations-site", - "version": "8.1.0", + "version": "8.4.2", "dependencies": { "argparse": { "version": "1.0.9", diff --git a/regulations/static/config/package.json b/regulations/static/config/package.json index e9180644c..1903cb625 100644 --- a/regulations/static/config/package.json +++ b/regulations/static/config/package.json @@ -1,6 +1,6 @@ { "name": "regulations-site", - "version": "8.4.0", + "version": "8.4.2", "homepage": "https://eregs.github.io/", "contributors": [ { @@ -47,6 +47,7 @@ "expect.js": "~0.2.0", "grunt": "^0.4.5", "grunt-browserify": "^5.0.0", + "grunt-cli": "^1.2.0", "grunt-contrib-copy": "^1.0.0", "grunt-contrib-cssmin": "^1.0.1", "grunt-env": "^0.4.4", @@ -94,6 +95,9 @@ "underscore": "^1.8.3", "urijs": "^1.18.10" }, + "scripts": { + "grunt": "grunt" + }, "config": { "travis-cov": { "threshold": 70 diff --git a/tox.ini b/tox.ini index 5b09781a9..19d3713b9 100644 --- a/tox.ini +++ b/tox.ini @@ -41,10 +41,10 @@ whitelist_externals = sh [testenv:jstests] deps = -commands = grunt test-js +commands = npm run grunt test-js skip_install = True skipsdist = True -whitelist_externals = grunt +whitelist_externals = npm [testenv:integration] deps =