Skip to content

Commit 0707351

Browse files
Update support policy, tooling, and docs (#22)
* Remove Grunt and JSHint * Require `npm@10` * Publish with Node 18 * Introduce `eslint` and `pa11y-lint-config@3` * Remove comments where they repeat item name * Update `package.description` in common with webservice's description of itself * Fix linting errors and warnings * Update readme to reflect renaming of `err` to `error` * In the workflow, update `npm` and lint using commands that exist * Replace mentions of Grunt in readme * Describe how to test the workflows locally * Upgrade to `sinon@17` from `16` * Rename `LICENSE.txt` to `LICENSE` to match our other repos * Introduce the standard `.editorconfig` * Replace `npm` fixing to `10` with `lockfile-version` fixing to `2` * Set `.nvmrc` to current minimum, `18` * Pull out the linting step * Rename publishing job to `publish` from `build` * Update support policy to agreed version * Update support table * Remove duplicated advice about opening issue * Fix link to license
1 parent 05ebdf9 commit 0707351

File tree

15 files changed

+1496
-2062
lines changed

15 files changed

+1496
-2062
lines changed

.editorconfig

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_size = 4
7+
indent_style = tab
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
indent_style = space
13+
trim_trailing_whitespace = false
14+
15+
[*.yml]
16+
indent_style = space
17+
indent_size = 2
18+
19+
[package.json]
20+
indent_style = space
21+
indent_size = 2

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
coverage

.eslintrc.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
'use strict';
2+
3+
const pa11yConfig = require('pa11y-lint-config/eslint/es2017');
4+
5+
const config = {
6+
...pa11yConfig,
7+
parserOptions: {
8+
ecmaVersion: 2020
9+
}
10+
};
11+
12+
module.exports = config;

.github/workflows/publish.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@ on:
44
workflow_dispatch:
55
inputs:
66
dryRun:
7-
description: "Dry run only"
7+
description: Dry run only
88
required: true
99
default: true
1010
type: boolean
11-
11+
1212
jobs:
13-
build:
13+
publish:
1414
runs-on: ubuntu-latest
1515
steps:
1616
- uses: actions/checkout@v4
1717
- uses: actions/setup-node@v3
1818
with:
19-
node-version: 20
20-
registry-url: "https://registry.npmjs.org"
19+
node-version: 18
20+
registry-url: https://registry.npmjs.org
2121
- run: npm ci
2222

2323
- name: Publish package

.github/workflows/tests.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@ on:
55
pull_request:
66

77
jobs:
8+
lint:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: actions/setup-node@v3
13+
with:
14+
node-version: 18
15+
- run: npm ci
16+
- run: npm run lint
17+
818
test:
919
runs-on: ubuntu-latest
1020
strategy:

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
lockfile-version=2

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
18

Gruntfile.js

Lines changed: 0 additions & 54 deletions
This file was deleted.

LICENSE.txt renamed to LICENSE

File renamed without changes.

README.md

Lines changed: 55 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -30,100 +30,100 @@ client.tasks.create({
3030
name: 'Nature Home Page',
3131
url: 'nature.com',
3232
standard: 'WCAG2AA'
33-
}, function (err, task) {
33+
}, function (error, task) {
3434
// task = object representing the new task, or null if an error occurred
3535
});
3636

3737
// Get all tasks
38-
client.tasks.get({}, function (err, tasks) {
38+
client.tasks.get({}, function (error, tasks) {
3939
// tasks = array of objects representing tasks, or null if an error occurred
4040
});
4141

4242
// Get all tasks with last results included for each
4343
client.tasks.get({
4444
lastres: true
45-
}, function (err, tasks) {
45+
}, function (error, tasks) {
4646
// tasks = array of objects representing tasks, or null if an error occurred
4747
});
4848

4949
// Get results for all tasks
50-
client.tasks.results({}, function (err, results) {
50+
client.tasks.results({}, function (error, results) {
5151
// results = array of objects representing results, or null if an error occurred
5252
});
5353

5454
// Get results for all tasks within a date range
5555
client.tasks.results({
5656
from: '2023-01-01',
5757
to: '2023-01-31'
58-
}, function (err, results) {
58+
}, function (error, results) {
5959
// results = array of objects representing results, or null if an error occurred
6060
});
6161

6262
// Get results for all tasks with full details
6363
client.tasks.results({
6464
full: true
65-
}, function (err, results) {
65+
}, function (error, results) {
6666
// results = array of objects representing results, or null if an error occurred
6767
});
6868

6969
// Get a task by ID
70-
client.task('5231c687bbdf0f94fa000007').get({}, function (err, task) {
70+
client.task('5231c687bbdf0f94fa000007').get({}, function (error, task) {
7171
// task = object representing the requested task, or null if an error occurred
7272
});
7373

7474
// Get a task by ID with last results included
7575
client.task('5231c687bbdf0f94fa000007').get({
7676
lastres: true
77-
}, function (err, task) {
77+
}, function (error, task) {
7878
// task = object representing the requested task, or null if an error occurred
7979
});
8080

8181
// Edit a task by ID
8282
client.task('5231c687bbdf0f94fa000007').edit({
8383
name: 'New name'
84-
}, function (err, task) {
84+
}, function (error, task) {
8585
// task = object representing the newly updated task, or null if an error occurred
8686
});
8787

8888
// Delete a task by ID
89-
client.task('5231c687bbdf0f94fa000007').remove(function (err) {
89+
client.task('5231c687bbdf0f94fa000007').remove(function (error) {
9090
// err = null if task was deleted, or an Error object if something went wrong
9191
});
9292

9393
// Run a task by ID
94-
client.task('5231c687bbdf0f94fa000007').run(function (err) {
94+
client.task('5231c687bbdf0f94fa000007').run(function (error) {
9595
// err = null if task is running, or an Error object if something went wrong
9696
});
9797

9898
// Get results for a task
99-
client.task('5231c687bbdf0f94fa000007').results({}, function (err, results) {
99+
client.task('5231c687bbdf0f94fa000007').results({}, function (error, results) {
100100
// results = array of objects representing results, or null if an error occurred
101101
});
102102

103103
// Get results for a task within a date range
104104
client.task('5231c687bbdf0f94fa000007').results({
105105
from: '2023-01-01',
106106
to: '2023-01-31'
107-
}, function (err, results) {
107+
}, function (error, results) {
108108
// results = array of objects representing results, or null if an error occurred
109109
});
110110

111111
// Get results for a task with full details
112112
client.task('5231c687bbdf0f94fa000007').results({
113113
full: true
114-
}, function (err, results) {
114+
}, function (error, results) {
115115
// results = array of objects representing results, or null if an error occurred
116116
});
117117

118118
// Get a result by ID
119-
client.task('5231c687bbdf0f94fa000007').result('523c0ee0ca452f0000000009').get({}, function (err, result) {
119+
client.task('5231c687bbdf0f94fa000007').result('523c0ee0ca452f0000000009').get({}, function (error, result) {
120120
// task = object representing the requested result, or null if an error occurred
121121
});
122122

123123
// Get a result by ID with full details
124124
client.task('5231c687bbdf0f94fa000007').result('523c0ee0ca452f0000000009').get({
125125
full: true
126-
}, function (err, result) {
126+
}, function (error, result) {
127127
// task = object representing the requested result, or null if an error occurred
128128
});
129129
```
@@ -136,40 +136,64 @@ If you'd like to contribute code, get started by cloning the repo and running `n
136136

137137
```sh
138138
# Lint your contribution
139-
grunt lint
139+
npm run lint
140140
```
141141

142142
```sh
143143
# Test your contribution
144-
grunt test
144+
npm test
145+
```
146+
147+
### Testing the GitHub Actions workflows
148+
149+
This project's GitHub Actions workflows can be tested locally using [nektos/act](https://github.com/nektos/act), which can be installed with Homebrew:
150+
151+
```sh
152+
brew install act
153+
```
154+
155+
To validate the syntax of a workflow:
156+
157+
```sh
158+
# Validate the publishing workflow, by triggering a 'release' event
159+
act --dryrun release
145160
```
146161

147162
```sh
148-
# Lint and test with a single command
149-
grunt
163+
# Validate the testing workflow
164+
act --dryrun push
150165
```
151166

167+
To run the testing workflow locally:
168+
169+
```sh
170+
# Run the testing workflow, with Node.js 18 only
171+
act push --matrix node-version:18
172+
```
173+
174+
Add `--verbose` for more output.
175+
152176
## Support and Migration
153177

154-
Major versions are normally supported for 6 months after their last minor release. This means that patch-level changes will be added and bugs will be fixed. The table below outlines the end-of-support dates for major versions, and the last minor release for that version.
178+
> [!NOTE]
179+
> We maintain a [migration guide](MIGRATION.md) to help you migrate between major versions.
155180
156-
We also maintain a [migration guide](MIGRATION.md) to help you migrate.
181+
When we release a new major version we will continue to support the previous major version for 6 months. This support will be limited to fixes for critical bugs and security issues. If you're opening an issue related to this project, please mention the specific version that the issue affects.
157182

158-
| :grey_question: | Major Version | Last Release | Node.js Versions | Support End Date |
159-
| :-------------- | :------------ | :----------- | :--------------- | :--------------- |
160-
| :heart: | 3 | N/A | 12+ | N/A |
161-
| :hourglass: | 2 | 2.0.0 | 8+ | 2022-05-26 |
162-
| :skull: | 1 | 1.2.1 | 0.10+ | 2020-01-05 |
183+
The following table lists the major versions available and, for each previous major version, its end-of-support date, and its final minor version released.
163184

164-
If you're opening issues related to these, please mention the version that the issue relates to.
185+
| Major version | Final minor version | Node.js support | Support end date |
186+
| :-------------- | :------------------ | :----------------------- | :--------------- |
187+
| `3` | | `>= 12` | ✅ Current major version |
188+
| `2` | `2.0` | `8`, `10` | 2022-05-26 |
189+
| `1` | `1.2` | `0.10`, `0.12`, `4`, `6` | 2020-01-05 |
165190

166191
## License
167192

168-
Licensed under the [GNU General Public License 3.0](LICENSE.txt).<br/>
169-
Copyright &copy; 20132023, Team Pa11y
193+
Licensed under the [GNU General Public License 3.0][info-license].
194+
Copyright &copy; 2013-2023, Team Pa11y
170195

171196
[gpl]: http://www.gnu.org/licenses/gpl-3.0.html
172-
[grunt]: http://gruntjs.com/
173197
[pa11y-webservice]: https://github.com/pa11y/pa11y-webservice
174198
[wiki-web-service]: https://github.com/pa11y/pa11y-webservice/wiki/Web-Service-Endpoints
175199
[info-build]: https://github.com/pa11y/pa11y-webservice-client-node/actions/workflows/tests.yml

0 commit comments

Comments
 (0)