From 1807e067b03c49d50ac8bd03859ea534eb8f10d2 Mon Sep 17 00:00:00 2001 From: Andrew Duthie Date: Fri, 29 Oct 2021 11:37:20 -0400 Subject: [PATCH 1/3] Sync package-lock.json after engines revision **Why**: Because otherwise there are uncommitted changes on main when running `npm install` in a fresh clone. Linting already existed for this, but was not being run in CircleCI. --- .circleci/config.yml | 4 ++-- Makefile | 2 +- package-lock.json | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ff680a15..7556c97c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -40,8 +40,8 @@ jobs: - checkout - bundle-npm-install - run: - name: Lint JavaScript and Sass - command: npm run lint + name: Lint JavaScript, Sass, and lockfiles + command: make lint integration: working_directory: ~/identity-style-guide executor: ruby_browsers diff --git a/Makefile b/Makefile index 3ba14f65..227161ed 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,7 @@ validate-package-lock: package.json package-lock.json validate-lockfiles: validate-gemfile-lock validate-package-lock -lint: build-package +lint: ./node_modules/.bin/gulp lint make validate-lockfiles diff --git a/package-lock.json b/package-lock.json index 9ae8f3f2..dec686b2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -57,8 +57,8 @@ "yaml": "^1.10.2" }, "engines": { - "node": ">=10.x.x", - "npm": ">6.x.x" + "node": ">=12", + "npm": ">6" } }, "node_modules/@18f/eslint-plugin-identity": { From 787fd62ac14556b2eeeca4e828292525952cc0a0 Mon Sep 17 00:00:00 2001 From: Andrew Duthie Date: Fri, 29 Oct 2021 11:48:41 -0400 Subject: [PATCH 2/3] Restore build-package dependency Apparently it's needed (for testing that built components include all expected USWDS components) See also: npm prelint script --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 227161ed..3ba14f65 100644 --- a/Makefile +++ b/Makefile @@ -28,7 +28,7 @@ validate-package-lock: package.json package-lock.json validate-lockfiles: validate-gemfile-lock validate-package-lock -lint: +lint: build-package ./node_modules/.bin/gulp lint make validate-lockfiles From 1f03e9291dbecd6e6bee328cb1d44de8a0a555b8 Mon Sep 17 00:00:00 2001 From: Andrew Duthie Date: Fri, 29 Oct 2021 12:10:23 -0400 Subject: [PATCH 3/3] Add switch to correct Node version with latest NPM **Why**: CircleCI convenience image for Ruby includes older version of NPM predating lockfileVersion 2, and therefore complains about changes --- .circleci/config.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7556c97c..b3d262fd 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -8,8 +8,22 @@ executors: BUNDLER_VERSION: 2.2.20 commands: + node-install: + steps: + - run: + name: Switch Node.js version + command: | + wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash + export NVM_DIR="$HOME/.nvm" + . "$NVM_DIR/nvm.sh" --install --latest-npm + echo 'export NVM_DIR="$HOME/.nvm"' >> $BASH_ENV; + echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> $BASH_ENV; + - run: + name: Print Node.js version + command: node -v bundle-npm-install: steps: + - node-install - restore_cache: key: dependency-cache-ruby-2-7-{{ checksum "package-lock.json" }}-{{ checksum "Gemfile.lock" }} - run: