Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Node.js support to 18-20 from 12-16, dependencies, documentation, some practices #19

Merged
merged 31 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
e5cb4dd
Update name of repo for repository, homepage, bugs
danyalaytekin Oct 4, 2023
b35be14
Remove unused Grunt task 'ci'
danyalaytekin Oct 4, 2023
5947cfc
Update sinon to 16 from 1.7, to fix circular dependency warnings invo…
danyalaytekin Oct 4, 2023
9d92fbe
Use github: syntax for package.repository
danyalaytekin Oct 4, 2023
760fc62
Update copyright range end to 2023 from 2019
danyalaytekin Oct 4, 2023
d84be46
Update year in examples to 2023 from 2013
danyalaytekin Oct 4, 2023
2f0e95c
Remove $ from example code blocks of type shell
danyalaytekin Oct 4, 2023
d00cdff
Use const instead of var
danyalaytekin Oct 4, 2023
70f9e08
Upgrade native actions (checkout, setup-node); remove repetition pres…
danyalaytekin Oct 4, 2023
edb1aa0
Run on pull_request regardless of target branch
danyalaytekin Oct 4, 2023
0e4186c
Run on push to main as well as master, pending rename
danyalaytekin Oct 4, 2023
32b7a1e
Fix Node.js version format (use N not N.x); also use array syntax
danyalaytekin Oct 5, 2023
6e1a8b3
Add Node.js 18, 20; drop 12
danyalaytekin Oct 5, 2023
56eb6e0
Replace deprecated 'es3: false' with 'esversion: 6'
danyalaytekin Oct 5, 2023
5433995
Set minimum package.engines.node to 14
danyalaytekin Oct 5, 2023
f026437
Upgrade Grunt and plugins to latest
danyalaytekin Oct 5, 2023
7ec88c3
Upgrade mockery to 2.1 from 1.4 (soft major)
danyalaytekin Oct 5, 2023
ec5d45c
Update Mocha to 10.2 from 8.4
danyalaytekin Oct 5, 2023
deffcb1
Use const instead of var for some constants
danyalaytekin Oct 5, 2023
85c7323
Retire recommendation for grunt-cli installed globally
danyalaytekin Oct 5, 2023
bf55836
Make small changes to readme for clarity
danyalaytekin Oct 5, 2023
a3e5c44
Separate tool usage code blocks to allow them to be copied individually
danyalaytekin Oct 5, 2023
e774ac6
Clarify inferred support policy
danyalaytekin Oct 5, 2023
7558950
Recommend npm >=8 and update lockfile using this version (also upgrad…
danyalaytekin Oct 5, 2023
c16a654
Prepare version 4's details for README and MIGRATION; sunset <= 3
danyalaytekin Oct 5, 2023
c17bfa5
Remove support symbols since their validity is affected by the passag…
danyalaytekin Oct 5, 2023
9c4d1c5
Fix build badge and info link
danyalaytekin Oct 5, 2023
7fc14d8
Rename job 'checkout_and_test' to 'test'
danyalaytekin Oct 5, 2023
e84b8bb
Recommend npm version 8 or above, or equivalent, in migration guide f…
danyalaytekin Oct 5, 2023
84c7ec9
End support for post-LTS Node.js versions 14 and 16
danyalaytekin Oct 6, 2023
78836b1
Reverse change to support policy section pending discussion
danyalaytekin Oct 6, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 8 additions & 22 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,20 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests.
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Build and lint

on:
push:
branches: # Run actions when code is committed to these branches
branches:
- master
- main
danyalaytekin marked this conversation as resolved.
Show resolved Hide resolved
pull_request:
branches: # Run actions when a PR is pushed based on one of these branches
- master

jobs:
checkout_and_test:
test:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- node-version: 12.x
- node-version: 14.x
- node-version: 16.x

node-version: [18, 20]
steps:
- name: Checkout code from ${{ github.repository }}
uses: actions/checkout@v2
- name: Setup node
uses: actions/setup-node@v2
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test
- run: npm ci
- run: npm test
3 changes: 1 addition & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = function (grunt) {
jshint: {
all: ['Gruntfile.js', 'lib/**/*.js', 'test/**/*.js'],
options: {
es3: false,
esversion: 6,
danyalaytekin marked this conversation as resolved.
Show resolved Hide resolved
indent: 4,
latedef: false,
maxcomplexity: 5,
Expand Down Expand Up @@ -50,6 +50,5 @@ module.exports = function (grunt) {
grunt.registerTask('lint', ['jshint']);
grunt.registerTask('test', ['mochaTest']);
grunt.registerTask('default', ['lint', 'test']);
grunt.registerTask('ci', ['lint', 'test']);

};
14 changes: 9 additions & 5 deletions MIGRATION.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
# Migration Guide

Pa11y's API changes between major versions. This is a guide to help you make the switch when this happens.
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.

## Migrating from 2.x to 3.x
## Migrating to 4 from 3

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

## Migrating from 1.x to 2.x
## Migrating to 3 from 2

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.
1. Upgrade to Node.js 12 or above.

## Migrating to 2 from 1

1. Upgrade to Node.js 8 or above.
49 changes: 26 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,28 @@

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

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

## Installing

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

```sh
$ npm install pa11y-webservice-client-node
npm install --save-dev pa11y-webservice-client-node
```

## Usage

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

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

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

// Create a task
client.tasks.create({
Expand Down Expand Up @@ -53,8 +53,8 @@ client.tasks.results({}, function (err, results) {

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

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

## Contributing

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

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`.

Now you'll be able to run the following commands:
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:

```sh
$ grunt # Run the lint and test tasks together
$ grunt lint # Run JSHint with the correct config
$ grunt test # Run unit tests
# Lint your contribution
grunt lint
```

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

For users with push-access, don't commit to the master branch. Code should be in `develop` until it's ready to be released.
```sh
# Lint and test with a single command
grunt
```
danyalaytekin marked this conversation as resolved.
Show resolved Hide resolved

## Support and Migration

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

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

[gpl]: http://www.gnu.org/licenses/gpl-3.0.html
[grunt]: http://gruntjs.com/
[pa11y-webservice]: https://github.com/pa11y/pa11y-webservice
[wiki-web-service]: https://github.com/pa11y/pa11y-webservice/wiki/Web-Service-Endpoints
[info-build]: https://github.com/pa11y/pa11y-webservice-client-node/actions/workflows/build-and-test.yml
[info-build]: https://github.com/pa11y/pa11y-webservice-client-node/actions/workflows/tests.yml
[info-license]: LICENSE
[info-node]: package.json
[info-npm]: https://www.npmjs.com/package/pa11y-webservice-client-node
[shield-build]: https://github.com/pa11y/pa11y-webservice-client-node/actions/workflows/build-and-test.yml/badge.svg
[shield-build]: https://github.com/pa11y/pa11y-webservice-client-node/actions/workflows/tests.yml/badge.svg
[shield-license]: https://img.shields.io/badge/license-LGPL%203.0-blue.svg
[shield-node]: https://img.shields.io/node/v/pa11y-webservice-client-node.svg
[shield-npm]: https://img.shields.io/npm/v/pa11y-webservice-client-node.svg
Loading