diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 3e39a82..488e2cb 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -26,13 +26,16 @@ jobs: # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ include: - node-version: 8.x - npm-i: "@commitlint/cli@9.x @commitlint/config-conventional@9.x eslint@6.x eslint-config-airbnb-base@14.x eslint-config-prettier@6.x fs-extra@8.x husky@6.x" + npm-i: "eslint@6.x eslint-config-airbnb-base@14.x eslint-config-prettier@6.x eslint-plugin-prettier@3.x fs-extra@8.x nyc@14.x tap@14.x" - node-version: 10.x - npm-i: "@commitlint/cli@12.x @commitlint/config-conventional@12.x eslint@7.x fs-extra@9.x husky@6.x" + npm-i: "eslint@7.x fs-extra@9.x nyc@14.x tap@14.x" - node-version: 12.x - npm-i: "@commitlint/cli@16.x @commitlint/config-conventional@16.x husky@7.x" + npm-i: "nyc@14.x tap@14.x" + + - node-version: 14.x + npm-i: "nyc@14.x tap@14.x" steps: - uses: actions/checkout@v3 @@ -57,6 +60,13 @@ jobs: echo "::set-output name=install::npm ci" fi + - name: Disable prettier on older Node.js (8.x, 10.x, 12.x) + run: | + sed -i '/"prettier": "prettier/d' package.json + echo Removed + sed -n '/"prettier": "prettier/p' package.json + if: contains(fromJson('["8.x", "10.x", "12.x"]'), matrix.node-version) + - name: Install downgraded modules ${{ matrix.npm-i }} run: | npm install --save-dev ${{ matrix.npm-i }} diff --git a/package.json b/package.json index e37de15..dd3610e 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,8 @@ }, "scripts": { "prepare": "is-ci || husky install", - "pretest": "prettier --check \"**/*.*\" && eslint \"lib/**/*.js\" \"test/**/*.js\"", + "pretest": "npm run prettier --if-present && eslint \"lib/**/*.js\" \"test/**/*.js\"", + "prettier": "prettier --check \"**/*.*\"", "prettier:fix": "prettier --write \"**/*.*\"", "test": "tap \"test/tap/**/*.js\" --cov --reporter=classic --timeout=45", "typings": "tsc -p types/tsconfig.json"