Skip to content

Commit 31bed98

Browse files
Update Node.js support to 18-20 from 12-16, dependencies, documentation, some practices (#19)
* Update name of repo for repository, homepage, bugs * Remove unused Grunt task 'ci' * Update sinon to 16 from 1.7, to fix circular dependency warnings involving fakeServer * Use github: syntax for package.repository * Update copyright range end to 2023 from 2019 * Update year in examples to 2023 from 2013 * Remove $ from example code blocks of type shell * Use const instead of var * Upgrade native actions (checkout, setup-node); remove repetition present in comments, names * Run on pull_request regardless of target branch * Run on push to main as well as master, pending rename * Fix Node.js version format (use N not N.x); also use array syntax * Add Node.js 18, 20; drop 12 * Replace deprecated 'es3: false' with 'esversion: 6' * Set minimum package.engines.node to 14 * Upgrade Grunt and plugins to latest * Upgrade mockery to 2.1 from 1.4 (soft major) * Update Mocha to 10.2 from 8.4 * Use const instead of var for some constants * Retire recommendation for grunt-cli installed globally * Make small changes to readme for clarity * Separate tool usage code blocks to allow them to be copied individually * Clarify inferred support policy * Recommend npm >=8 and update lockfile using this version (also upgrades lockfileVersion to 2 from 1) * Prepare version 4's details for README and MIGRATION; sunset <= 3 * Remove support symbols since their validity is affected by the passage of time * Fix build badge and info link * Rename job 'checkout_and_test' to 'test' * Recommend npm version 8 or above, or equivalent, in migration guide for v4 * End support for post-LTS Node.js versions 14 and 16 * Reverse change to support policy section pending discussion
1 parent 01ded41 commit 31bed98

File tree

8 files changed

+3066
-528
lines changed

8 files changed

+3066
-528
lines changed

.github/workflows/tests.yml

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,20 @@
1-
# This workflow will do a clean install of node dependencies, build the source code and run tests.
2-
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3-
4-
name: Build and lint
5-
61
on:
72
push:
8-
branches: # Run actions when code is committed to these branches
3+
branches:
94
- master
5+
- main
106
pull_request:
11-
branches: # Run actions when a PR is pushed based on one of these branches
12-
- master
137

148
jobs:
15-
checkout_and_test:
9+
test:
1610
runs-on: ubuntu-latest
1711
strategy:
1812
matrix:
19-
include:
20-
- node-version: 12.x
21-
- node-version: 14.x
22-
- node-version: 16.x
23-
13+
node-version: [18, 20]
2414
steps:
25-
- name: Checkout code from ${{ github.repository }}
26-
uses: actions/checkout@v2
27-
- name: Setup node
28-
uses: actions/setup-node@v2
15+
- uses: actions/checkout@v4
16+
- uses: actions/setup-node@v3
2917
with:
3018
node-version: ${{ matrix.node-version }}
31-
- name: Install dependencies
32-
run: npm ci
33-
- name: Run tests
34-
run: npm test
19+
- run: npm ci
20+
- run: npm test

Gruntfile.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module.exports = function (grunt) {
2020
jshint: {
2121
all: ['Gruntfile.js', 'lib/**/*.js', 'test/**/*.js'],
2222
options: {
23-
es3: false,
23+
esversion: 6,
2424
indent: 4,
2525
latedef: false,
2626
maxcomplexity: 5,
@@ -50,6 +50,5 @@ module.exports = function (grunt) {
5050
grunt.registerTask('lint', ['jshint']);
5151
grunt.registerTask('test', ['mochaTest']);
5252
grunt.registerTask('default', ['lint', 'test']);
53-
grunt.registerTask('ci', ['lint', 'test']);
5453

5554
};

MIGRATION.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
# Migration Guide
22

3-
Pa11y's API changes between major versions. This is a guide to help you make the switch when this happens.
3+
This package's API and/or supported set of environments changes between major versions. This is a guide to help you update your project to use a new major version.
44

5-
## Migrating from 2.x to 3.x
5+
## Migrating to 4 from 3
66

7-
Pa11y Webservice Client 3.x only supports Node.js v12 and higher, you'll need to upgrade to be able to use it.
7+
1. Upgrade to Node.js 18 or above.
88

9-
## Migrating from 1.x to 2.x
9+
## Migrating to 3 from 2
1010

11-
Pa11y Webservice Client 2.x only supports Node.js v8.0.0 and higher, you'll need to upgrade to be able to use it.
11+
1. Upgrade to Node.js 12 or above.
12+
13+
## Migrating to 2 from 1
14+
15+
1. Upgrade to Node.js 8 or above.

README.md

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,28 @@
22

33
This is a Node.js client library for [Pa11y Webservice][pa11y-webservice].
44

5-
[![NPM version][shield-npm]][info-npm]
5+
[![Latest version published to npm][shield-npm]][info-npm]
66
[![Node.js version support][shield-node]][info-node]
77
[![Build status][shield-build]][info-build]
88
[![LGPL-3.0 licensed][shield-license]][info-license]
99

1010
## Installing
1111

12-
Install Pa11y Webservice Node.js Client with npm:
12+
Add this client to your project with your preferred package manager. For example, to install it as a development dependency with npm:
1313

1414
```sh
15-
$ npm install pa11y-webservice-client-node
15+
npm install --save-dev pa11y-webservice-client-node
1616
```
1717

1818
## Usage
1919

20-
For more information on the actual webservice endpoints and resource types, [read the documentation][wiki-web-service].
20+
For information about Pa11y Webservice's endpoints and resource types, [read the documentation][wiki-web-service].
2121

2222
```js
23-
var createClient = require('pa11y-webservice-client-node');
23+
const createClient = require('pa11y-webservice-client-node');
2424

25-
// Create client with the base URL of the web-service
26-
var client = createClient('http://localhost:3000/');
25+
// Create client with the base URL of your instance of Pa11y Webservice
26+
const client = createClient('http://localhost:3000/');
2727

2828
// Create a task
2929
client.tasks.create({
@@ -53,8 +53,8 @@ client.tasks.results({}, function (err, results) {
5353

5454
// Get results for all tasks within a date range
5555
client.tasks.results({
56-
from: '2013-01-01',
57-
to: '2013-01-31'
56+
from: '2023-01-01',
57+
to: '2023-01-31'
5858
}, function (err, results) {
5959
// results = array of objects representing results, or null if an error occurred
6060
});
@@ -102,8 +102,8 @@ client.task('5231c687bbdf0f94fa000007').results({}, function (err, results) {
102102

103103
// Get results for a task within a date range
104104
client.task('5231c687bbdf0f94fa000007').results({
105-
from: '2013-01-01',
106-
to: '2013-01-31'
105+
from: '2023-01-01',
106+
to: '2023-01-31'
107107
}, function (err, results) {
108108
// results = array of objects representing results, or null if an error occurred
109109
});
@@ -130,21 +130,24 @@ client.task('5231c687bbdf0f94fa000007').result('523c0ee0ca452f0000000009').get({
130130

131131
## Contributing
132132

133-
There are many ways to contribute to Pa11y Webservice Node.js Client, we cover these in the [contributing guide](CONTRIBUTING.md) for this repo.
133+
There are many ways to contribute to Pa11y Webservice Node.js Client; we cover these in this repo's [contributing guide](CONTRIBUTING.md).
134134

135-
If you're ready to contribute some code, you'll need to clone the repo locally and run `npm install`. You'll also need [Grunt][grunt] to be installed globally in order to run tests, you can do this with `npm install -g grunt-cli`.
136-
137-
Now you'll be able to run the following commands:
135+
If you'd like to contribute code, get started by cloning the repo and running `npm install`. Now you'll be able to run the following commands. Please use these build tools to avoid your contribution being delayed by a lint error or a failing test:
138136

139137
```sh
140-
$ grunt # Run the lint and test tasks together
141-
$ grunt lint # Run JSHint with the correct config
142-
$ grunt test # Run unit tests
138+
# Lint your contribution
139+
grunt lint
143140
```
144141

145-
Code with lint errors or failing tests will not be accepted, please use the build tools outlined above.
142+
```sh
143+
# Test your contribution
144+
grunt test
145+
```
146146

147-
For users with push-access, don't commit to the master branch. Code should be in `develop` until it's ready to be released.
147+
```sh
148+
# Lint and test with a single command
149+
grunt
150+
```
148151

149152
## Support and Migration
150153

@@ -163,17 +166,17 @@ If you're opening issues related to these, please mention the version that the i
163166
## License
164167

165168
Licensed under the [GNU General Public License 3.0](LICENSE.txt).<br/>
166-
Copyright &copy; 2013–2019, Team Pa11y
169+
Copyright &copy; 2013–2023, Team Pa11y
167170

168171
[gpl]: http://www.gnu.org/licenses/gpl-3.0.html
169172
[grunt]: http://gruntjs.com/
170173
[pa11y-webservice]: https://github.com/pa11y/pa11y-webservice
171174
[wiki-web-service]: https://github.com/pa11y/pa11y-webservice/wiki/Web-Service-Endpoints
172-
[info-build]: https://github.com/pa11y/pa11y-webservice-client-node/actions/workflows/build-and-test.yml
175+
[info-build]: https://github.com/pa11y/pa11y-webservice-client-node/actions/workflows/tests.yml
173176
[info-license]: LICENSE
174177
[info-node]: package.json
175178
[info-npm]: https://www.npmjs.com/package/pa11y-webservice-client-node
176-
[shield-build]: https://github.com/pa11y/pa11y-webservice-client-node/actions/workflows/build-and-test.yml/badge.svg
179+
[shield-build]: https://github.com/pa11y/pa11y-webservice-client-node/actions/workflows/tests.yml/badge.svg
177180
[shield-license]: https://img.shields.io/badge/license-LGPL%203.0-blue.svg
178181
[shield-node]: https://img.shields.io/node/v/pa11y-webservice-client-node.svg
179182
[shield-npm]: https://img.shields.io/npm/v/pa11y-webservice-client-node.svg

0 commit comments

Comments
 (0)