Skip to content

Commit

Permalink
Improve npm scripts (#1970)
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky authored Oct 15, 2020
1 parent 5645512 commit 0bd187c
Show file tree
Hide file tree
Showing 6 changed files with 247 additions and 43 deletions.
8 changes: 8 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ module.exports = {
// TODO: enable after dropping support for Node <11.4.0
'node/prefer-promises/fs': 2,
'node/prefer-promises/dns': 2,
// This does not work well in a monorepo
'node/shebang': 0,

'eslint-comments/no-unused-disable': 0,
'eslint-comments/no-use': [
Expand Down Expand Up @@ -166,6 +168,12 @@ module.exports = {
'fp/no-delete': 0,
},
},
{
files: ['scripts/**/*.js'],
rules: {
'node/no-unpublished-require': 0,
},
},
{
files: ['**/*.md'],
rules: {
Expand Down
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto eol=lf
23 changes: 11 additions & 12 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,33 @@ on:
tags: ['*']
pull_request:
types: [opened, synchronize, reopened]
env:
CI: 'true'
jobs:
build:
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
node: [8.17.0, 14]
node-version: [8.17.0, 14.x]
exclude:
- os: macOS-latest
node: 8.17.0
node-version: 8.17.0
- os: windows-latest
node: 8.17.0
node-version: 8.17.0
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Git checkout
uses: actions/checkout@v1
- name: Node.js ${{ matrix.node }}
- name: Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm install
run: npm ci
- name: Linting
run: npm run format
if: ${{ matrix.node == 14 }}
run: npm run format:ci
if: "${{ matrix.node-version == '14.x' }}"
- name: Tests
run: npm run test:ci
- name: Codecov test coverage
run: bash scripts/coverage.sh "${{ matrix.os }}" "${{ matrix.node }}"
run: bash scripts/coverage.sh "${{ matrix.os }}" "${{ matrix.node-version }}"
204 changes: 180 additions & 24 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 19 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,23 @@
"scripts": {
"postinstall": "npm run bootstrap",
"bootstrap": "lerna bootstrap",
"test": "npm run format && npm run test:dev",
"format": "run-s format:*",
"format:lint": "eslint --ignore-path .gitignore --fix --cache --format=codeframe --max-warnings=0 \"{.github,packages,scripts}/**/*.{js,md,html}\"",
"format:prettier": "prettier --ignore-path .gitignore --write --loglevel warn \"{.github,packages,scripts}/**/*.{js,md,html,yml,json}\" \"*.{js,md,htm,yml,json}\" \"!**/package-lock.json\" \"!package-lock.json\"",
"test:dev": "ava",
"test:ci": "nyc -r lcovonly -r text -r json ava",
"update-snapshots": "ava -u"
"test": "run-s format test:dev",
"format": "run-s format:check-fix:*",
"format:ci": "run-s format:check:*",
"format:check-fix:lint": "./scripts/run_on_error.js format:check:lint format:fix:lint",
"format:check:lint": "cross-env-shell eslint $npm_package_scriptsArgs_eslint",
"format:fix:lint": "cross-env-shell eslint --fix $npm_package_scriptsArgs_eslint",
"format:check-fix:prettier": "./scripts/run_on_error.js format:check:prettier format:fix:prettier",
"format:check:prettier": "cross-env-shell prettier --check $npm_package_scriptsArgs_prettier",
"format:fix:prettier": "cross-env-shell prettier --write $npm_package_scriptsArgs_prettier",
"test:dev": "run-s test:dev:*",
"test:ci": "run-s test:ci:*",
"test:dev:ava": "ava",
"test:ci:ava": "nyc -r lcovonly -r text -r json ava"
},
"scriptsArgs": {
"eslint": "--ignore-path .gitignore --cache --format=codeframe --max-warnings=0 \"{packages,scripts,.github}/**/*.{js,md,html}\"",
"prettier": "--ignore-path .gitignore --loglevel=warn \"{packages,scripts,.github}/**/*.{js,md,yml,json,html}\" \"*.{js,yml,json,html}\" \"!**/package-lock.json\" \"!package-lock.json\""
},
"husky": {
"hooks": {
Expand Down Expand Up @@ -52,6 +62,7 @@
"dependencies": {},
"devDependencies": {
"ava": "^2.4.0",
"cross-env": "^7.0.2",
"eslint": "^7.11.0",
"eslint-config-prettier": "^6.10.1",
"eslint-config-standard": "^14.1.1",
Expand All @@ -67,6 +78,7 @@
"eslint-plugin-standard": "^4.0.1",
"eslint-plugin-unicorn": "^22.0.0",
"eslint-plugin-you-dont-need-lodash-underscore": "^6.10.0",
"execa": "^4.0.3",
"husky": "^4.2.3",
"lerna": "^3.20.2",
"npm-run-all": "^4.1.5",
Expand Down
Loading

0 comments on commit 0bd187c

Please sign in to comment.