Merge pull request #1328 from log4js-node/update-ci

ci: skip prettier on older Node.js (8.x, 10.x, 12.x)
This commit is contained in:
Lam Wei Li 2022-09-28 17:14:11 +08:00 committed by GitHub
commit ae75c368f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 4 deletions

View File

@ -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 }}

View File

@ -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"