From 5cc2339bf0adc8e6e675981b62562b5becc5ca3e Mon Sep 17 00:00:00 2001 From: Pierre Gordon Date: Wed, 31 Mar 2021 15:09:54 -0400 Subject: [PATCH] Enforce npm v7 for project and CI environment --- .github/workflows/build-test-measure.yml | 54 ++++++++++++++++++++++++ .nvmrc | 2 +- package.json | 4 ++ 3 files changed, 59 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-test-measure.yml b/.github/workflows/build-test-measure.yml index 1ed07ce380c..446b56f1cc9 100644 --- a/.github/workflows/build-test-measure.yml +++ b/.github/workflows/build-test-measure.yml @@ -33,6 +33,15 @@ jobs: - name: Checkout uses: actions/checkout@v2 + - name: Read .nvmrc + run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)" + id: nvm + + - name: Setup Node + uses: actions/setup-node@v2 + with: + node-version: ${{ steps.nvm.outputs.NVMRC }} + - name: Get npm cache directory id: npm-cache run: echo "::set-output name=dir::$(npm config get cache)" @@ -62,6 +71,15 @@ jobs: - name: Checkout uses: actions/checkout@v2 + - name: Read .nvmrc + run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)" + id: nvm + + - name: Setup Node + uses: actions/setup-node@v2 + with: + node-version: ${{ steps.nvm.outputs.NVMRC }} + - name: Get npm cache directory id: npm-cache run: echo "::set-output name=dir::$(npm config get cache)" @@ -186,6 +204,15 @@ jobs: - name: Checkout uses: actions/checkout@v2 + - name: Read .nvmrc + run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)" + id: nvm + + - name: Setup Node + uses: actions/setup-node@v2 + with: + node-version: ${{ steps.nvm.outputs.NVMRC }} + - name: Get npm cache directory id: npm-cache run: echo "::set-output name=dir::$(npm config get cache)" @@ -229,6 +256,15 @@ jobs: with: php-version: '7.4' + - name: Read .nvmrc + run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)" + id: nvm + + - name: Setup Node + uses: actions/setup-node@v2 + with: + node-version: ${{ steps.nvm.outputs.NVMRC }} + - name: Get Composer Cache Directory id: composer-cache run: echo "::set-output name=dir::$(composer config cache-files-dir)" @@ -363,6 +399,15 @@ jobs: sleep 1 done + - name: Read .nvmrc + run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)" + id: nvm + + - name: Setup Node + uses: actions/setup-node@v2 + with: + node-version: ${{ steps.nvm.outputs.NVMRC }} + - name: Get Composer Cache Directory id: composer-cache run: echo "::set-output name=dir::$(composer config cache-files-dir)" @@ -468,6 +513,15 @@ jobs: with: php-version: '7.4' + - name: Read .nvmrc + run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)" + id: nvm + + - name: Setup Node + uses: actions/setup-node@v2 + with: + node-version: ${{ steps.nvm.outputs.NVMRC }} + - name: Get Composer Cache Directory id: composer-cache run: | diff --git a/.nvmrc b/.nvmrc index b009dfb9d9f..60d3b2f4a4c 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -lts/* +15 diff --git a/package.json b/package.json index d88b70ab267..90e407a04ba 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,10 @@ "bugs": { "url": "https://github.com/ampproject/amp-wp/issues" }, + "engines": { + "node": ">= 15", + "npm": ">= 7" + }, "dependencies": { "@babel/polyfill": "7.12.1", "@wordpress/api-fetch": "3.22.0",