Skip to content

Commit 7760153

Browse files
authored
chore: separate 'lint' from 'test' (#149)
Also test with node v20 instead of v19.
1 parent 2a6ea19 commit 7760153

File tree

10 files changed

+50
-19
lines changed

10 files changed

+50
-19
lines changed

.ci/run-install.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ function run_install {
88
npm --prefix $ROOT/$1 install
99
}
1010

11+
run_install "utils"
1112
run_install "helpers"
1213
run_install "loggers/winston"
1314
run_install "loggers/morgan"

.ci/run-lint.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env bash
2+
3+
set -euxo pipefail
4+
ROOT=$PWD
5+
6+
function run_lint {
7+
echo "=== Running $1 lint ==="
8+
npm --prefix $ROOT/$1 run lint
9+
}
10+
11+
run_lint "utils"
12+
run_lint "helpers"
13+
run_lint "loggers/winston"
14+
run_lint "loggers/morgan"
15+
run_lint "loggers/pino"

.github/workflows/test.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,22 @@ permissions:
1414
contents: read
1515

1616
jobs:
17+
lint:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v3
21+
- uses: actions/setup-node@v3
22+
with:
23+
node-version: 18
24+
- run: .ci/run-install.sh
25+
- run: .ci/run-lint.sh
26+
1727
test:
1828
runs-on: ubuntu-latest
1929
strategy:
2030
fail-fast: false
2131
matrix:
22-
node-version: [10, 12, 14, 16, 18, 19]
32+
node-version: [10, 12, 14, 16, 18, 20]
2333
steps:
2434
- uses: actions/checkout@v3
2535
- uses: actions/setup-node@v3

Makefile

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,17 @@ clean:
1515
(cd loggers/pino && rm -rf node_modules)
1616
(cd utils && rm -rf node_modules)
1717

18-
.PHONY: check
19-
check: check-license-headers
20-
(cd helpers && npx standard)
21-
(cd loggers/winston && npx standard)
22-
(cd loggers/morgan && npx standard)
23-
(cd loggers/pino && npx standard)
24-
(cd utils && npx standard)
18+
.PHONY: lint
19+
lint: check-license-headers
20+
./.ci/run-lint.sh
2521

2622
.PHONY: fmt
2723
fmt:
28-
(cd helpers && npx standard --fix)
29-
(cd loggers/winston && npx standard --fix)
30-
(cd loggers/morgan && npx standard --fix)
31-
(cd loggers/pino && npx standard --fix)
32-
(cd utils && npx standard --fix)
24+
(cd helpers && npm run lint:fix)
25+
(cd loggers/winston && npm run lint:fix)
26+
(cd loggers/morgan && npm run lint:fix)
27+
(cd loggers/pino && npm run lint:fix)
28+
(cd utils && npm run lint:fix)
3329

3430
.PHONY: test
3531
test:

helpers/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
},
1818
"homepage": "https://github.com/elastic/ecs-logging-nodejs/blob/main/helpers/README.md",
1919
"scripts": {
20-
"test": "standard && tap --no-check-coverage --timeout ${TAP_TIMEOUT:-10} test/*.test.js"
20+
"lint": "standard",
21+
"lint:fix": "standard --fix",
22+
"test": "tap --no-check-coverage --timeout ${TAP_TIMEOUT:-10} test/*.test.js"
2123
},
2224
"engines": {
2325
"node": ">=10"

loggers/morgan/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@
2929
},
3030
"homepage": "https://github.com/elastic/ecs-logging-nodejs/blob/main/loggers/morgan/README.md",
3131
"scripts": {
32-
"test": "standard && tap --timeout ${TAP_TIMEOUT:-10} test/*.test.js"
32+
"lint": "standard",
33+
"lint:fix": "standard --fix",
34+
"test": "tap --timeout ${TAP_TIMEOUT:-10} test/*.test.js"
3335
},
3436
"engines": {
3537
"node": ">=10"

loggers/pino/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,9 @@
3030
},
3131
"homepage": "https://github.com/elastic/ecs-logging-nodejs/blob/main/loggers/pino/README.md",
3232
"scripts": {
33-
"test": "standard && tap --timeout ${TAP_TIMEOUT:-10} test/*.test.js"
33+
"lint": "standard",
34+
"lint:fix": "standard --fix",
35+
"test": "tap --timeout ${TAP_TIMEOUT:-10} test/*.test.js"
3436
},
3537
"engines": {
3638
"node": ">=10"

loggers/winston/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@
3131
"homepage": "https://github.com/elastic/ecs-logging-nodejs/blob/main/loggers/winston/README.md",
3232
"scripts": {
3333
"bench": "./benchmarks/bench",
34-
"test": "standard && tap --timeout ${TAP_TIMEOUT:-10} test/*.test.js"
34+
"lint": "standard",
35+
"lint:fix": "standard --fix",
36+
"test": "tap --timeout ${TAP_TIMEOUT:-10} test/*.test.js"
3537
},
3638
"engines": {
3739
"node": ">=10"

utils/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"author": "Tomas Della Vedova",
88
"license": "Apache-2.0",
99
"scripts": {
10-
"check": "standard"
10+
"lint": "standard",
11+
"lint:fix": "standard --fix"
1112
},
1213
"devDependencies": {
1314
"js-yaml": "^3.13.1",

utils/pre-commit-hook.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
set -o errexit
66
set -o pipefail
77

8-
make check
8+
make lint

0 commit comments

Comments
 (0)