Skip to content

Commit e7b6dcc

Browse files
committed
Build file update
1 parent 94c2f1e commit e7b6dcc

File tree

4 files changed

+63
-200
lines changed

4 files changed

+63
-200
lines changed

.eslintrc.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,8 @@ rules:
66
indent: [error, 2, { MemberExpression: "off", SwitchCase: 1 }]
77
no-trailing-spaces: error
88
no-unused-vars: [error, { vars: all, args: none, ignoreRestSiblings: true }]
9+
parserOptions:
10+
ecmaVersion: latest
11+
sourceType: module
12+
env:
13+
es6: true

.github/workflows/ci.yml

Lines changed: 54 additions & 196 deletions
Original file line numberDiff line numberDiff line change
@@ -5,206 +5,64 @@ on:
55
- push
66

77
jobs:
8-
test:
8+
build:
9+
name: Build and Verify
910
runs-on: ubuntu-latest
1011
strategy:
1112
fail-fast: false
1213
matrix:
13-
name:
14-
- Node.js 0.10
15-
- Node.js 0.12
16-
- io.js 1.x
17-
- io.js 2.x
18-
- io.js 3.x
19-
- Node.js 4.x
20-
- Node.js 5.x
21-
- Node.js 6.x
22-
- Node.js 7.x
23-
- Node.js 8.x
24-
- Node.js 9.x
25-
- Node.js 10.x
26-
- Node.js 11.x
27-
- Node.js 12.x
28-
- Node.js 13.x
29-
- Node.js 14.x
30-
- Node.js 15.x
31-
- Node.js 16.x
32-
- Node.js 17.x
33-
- Node.js 18.x
34-
- Node.js 19.x
35-
36-
include:
37-
- name: Node.js 0.10
38-
node-version: "0.10"
39-
40-
41-
- name: Node.js 0.12
42-
node-version: "0.12"
43-
44-
45-
- name: io.js 1.x
46-
node-version: "1.8"
47-
48-
49-
- name: io.js 2.x
50-
node-version: "2.5"
51-
52-
53-
- name: io.js 3.x
54-
node-version: "3.3"
55-
56-
57-
- name: Node.js 4.x
58-
node-version: "4.9"
59-
60-
61-
- name: Node.js 5.x
62-
node-version: "5.12"
63-
64-
65-
- name: Node.js 6.x
66-
node-version: "6.17"
67-
68-
69-
- name: Node.js 7.x
70-
node-version: "7.10"
71-
72-
73-
- name: Node.js 8.x
74-
node-version: "8.17"
75-
76-
77-
- name: Node.js 9.x
78-
node-version: "9.11"
79-
80-
81-
- name: Node.js 10.x
82-
node-version: "10.24"
83-
84-
85-
- name: Node.js 11.x
86-
node-version: "11.15"
87-
88-
89-
- name: Node.js 12.x
90-
node-version: "12.22"
91-
92-
93-
- name: Node.js 13.x
94-
node-version: "13.14"
95-
96-
97-
- name: Node.js 14.x
98-
node-version: "14.20"
99-
100-
- name: Node.js 15.x
101-
node-version: "15.14"
102-
103-
- name: Node.js 16.x
104-
node-version: "16.20"
105-
106-
- name: Node.js 17.x
107-
node-version: "17.9"
108-
109-
- name: Node.js 18.x
110-
node-version: "18.15"
111-
112-
- name: Node.js 19.x
113-
node-version: "19.7"
114-
14+
node-version:
15+
- 18.x
11516
steps:
116-
- uses: actions/checkout@v3
117-
118-
- name: Install Node.js ${{ matrix.node-version }}
119-
shell: bash -eo pipefail -l {0}
120-
run: |
121-
nvm install --default ${{ matrix.node-version }}
122-
dirname "$(nvm which ${{ matrix.node-version }})" >> "$GITHUB_PATH"
123-
124-
- name: Configure npm
125-
run: |
126-
npm config set loglevel error
127-
if [[ "$(npm config get package-lock)" == "true" ]]; then
128-
npm config set package-lock false
129-
else
130-
npm config set shrinkwrap false
131-
fi
132-
133-
- name: Install npm module(s) ${{ matrix.npm-i }}
134-
run: npm install --save-dev ${{ matrix.npm-i }}
135-
if: matrix.npm-i != ''
136-
137-
- name: Remove non-test dependencies
138-
run: npm rm --silent --save-dev connect-redis
139-
140-
- name: Setup Node.js version-specific dependencies
141-
shell: bash
142-
run: |
143-
# eslint for linting
144-
# - remove on Node.js < 12
145-
if [[ "$(cut -d. -f1 <<< "${{ matrix.node-version }}")" -lt 12 ]]; then
146-
node -pe 'Object.keys(require("./package").devDependencies).join("\n")' | \
147-
grep -E '^eslint(-|$)' | \
148-
sort -r | \
149-
xargs -n1 npm rm --silent --save-dev
150-
fi
151-
152-
- name: Install Node.js dependencies
153-
run: npm install
154-
155-
- name: List environment
156-
id: list_env
157-
shell: bash
158-
run: |
159-
echo "node@$(node -v)"
160-
echo "npm@$(npm -v)"
161-
npm -s ls ||:
162-
(npm -s ls --depth=0 ||:) | awk -F'[ @]' 'NR>1 && $2 { print $2 "=" $3 }' >> "$GITHUB_OUTPUT"
163-
164-
- name: Run tests
165-
shell: bash
166-
run: |
167-
npm run test-ci
168-
cp coverage/lcov.info "coverage/${{ matrix.name }}.lcov"
169-
170-
- name: Lint code
171-
if: steps.list_env.outputs.eslint != ''
172-
run: npm run lint
173-
174-
- name: Collect code coverage
175-
run: |
176-
mv ./coverage "./${{ matrix.name }}"
177-
mkdir ./coverage
178-
mv "./${{ matrix.name }}" "./coverage/${{ matrix.name }}"
179-
180-
- name: Upload code coverage
181-
uses: actions/upload-artifact@v3
182-
with:
183-
name: coverage
184-
path: ./coverage
185-
retention-days: 1
186-
187-
coverage:
188-
needs: test
17+
- name: Checkout
18+
uses: actions/checkout@v3
19+
with:
20+
fetch-depth: 0
21+
- name: Setup Node.js ${{ matrix.node-version }}
22+
uses: actions/setup-node@v3
23+
with:
24+
node-version: ${{ matrix.node-version }}
25+
cache: 'npm'
26+
- name: Install dependencies
27+
run: npm ci
28+
- name: Verify the integrity of provenance attestations and registry signatures for installed dependencies
29+
run: npm audit signatures
30+
test:
31+
name: Fast Tests
18932
runs-on: ubuntu-latest
33+
needs: build
34+
strategy:
35+
matrix:
36+
node-version:
37+
- 18.x
38+
- 19.x
39+
- 20.x
19040
steps:
191-
- uses: actions/checkout@v3
192-
193-
- name: Install lcov
194-
shell: bash
195-
run: sudo apt-get -y install lcov
196-
197-
- name: Collect coverage reports
198-
uses: actions/download-artifact@v3
199-
with:
200-
name: coverage
201-
path: ./coverage
202-
203-
- name: Merge coverage reports
204-
shell: bash
205-
run: find ./coverage -name lcov.info -exec printf '-a %q\n' {} \; | xargs lcov -o ./coverage/lcov.info
206-
207-
- name: Upload coverage report
208-
uses: coverallsapp/github-action@master
209-
with:
210-
github-token: ${{ secrets.GITHUB_TOKEN }}
41+
- name: Checkout
42+
uses: actions/checkout@v3
43+
with:
44+
fetch-depth: 0
45+
- name: Use Node.js ${{ matrix.node-version }}
46+
uses: actions/setup-node@v3
47+
with:
48+
node-version: ${{ matrix.node-version }}
49+
cache: 'npm'
50+
- run: npm ci
51+
- run: npm test
52+
release:
53+
name: Release
54+
if: github.ref == 'refs/heads/main' && success()
55+
needs: [build, test]
56+
runs-on: ubuntu-latest
57+
strategy:
58+
matrix:
59+
node-version:
60+
- 20.x
61+
steps:
62+
- name: Checkout
63+
uses: actions/checkout@v3
64+
- name: Semantic Release
65+
env:
66+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
68+
run: npx semantic-release

lib/router/layer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ function Layer(path, options, fn) {
4545
this.regexp = pathToRegexp(path, this.keys = [], opts);
4646

4747
// set fast path flags
48-
this.regexp.fast_star = path === '*'
49-
this.regexp.fast_slash = path === '/' && opts.end === false
48+
this.regexp.fast_star = path === '*';
49+
this.regexp.fast_slash = path === '/' && opts.end === false;
5050
}
5151

5252
/**

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"depd": "^2.0.0",
3939
"encodeurl": "^1.0.2",
4040
"escape-html": "^1.0.3",
41+
"eslint": "^8.55.0",
4142
"etag": "^1.8.1",
4243
"finalhandler": "^1.2.0",
4344
"fresh": "^0.5.2",
@@ -64,7 +65,6 @@
6465
"cookie-parser": "^1.4.6",
6566
"cookie-session": "^2.0.0",
6667
"ejs": "^3.1.9",
67-
"eslint": "^8.55.0",
6868
"express-session": "^1.17.3",
6969
"hbs": "^4.2.0",
7070
"marked": "^11.0.0",
@@ -86,7 +86,7 @@
8686
"lib/"
8787
],
8888
"scripts": {
89-
"lint": "eslint .",
89+
"pretest": "eslint .",
9090
"test": "NODE_ENV=test NO_DEPRECATION='body-parser,express' node --test"
9191
}
9292
}

0 commit comments

Comments
 (0)