Skip to content

Commit 553980a

Browse files
authored
Drop Node16 support (inrupt#901)
* Update devDependencies * No longer run CI on Node 16 * Upgrade prod dependencies * Storybook migration * Changelog * Lint * Fix unit test issue * Remove fetch polyfills
1 parent 90481a2 commit 553980a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+21967
-52679
lines changed

Diff for: .babelrc.json

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"sourceType": "unambiguous",
3+
"presets": [
4+
[
5+
"@babel/preset-env",
6+
{
7+
"targets": {
8+
"chrome": 100,
9+
"safari": 15,
10+
"firefox": 91
11+
}
12+
}
13+
],
14+
"@babel/preset-typescript",
15+
"@babel/preset-react"
16+
],
17+
"plugins": []
18+
}

Diff for: .eslintrc.js

+5
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ module.exports = {
2222
"no-shadow": ["warn", { allow: ["fetch"] }],
2323
"react/require-default-props": "warn",
2424
"react/default-props-match-prop-types": "warn",
25+
"react/function-component-definition": "off",
2526
noImplicitAny: "off",
27+
// FIXME: re-enable the following
28+
"react/no-unstable-nested-components": "off",
29+
"react/jsx-no-bind": "off",
30+
"react/jsx-no-constructed-context-values": "off"
2631
},
2732
};

Diff for: .github/workflows/ci.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
strategy:
1717
matrix:
18-
node-version: ["20.x", "18.x", "16.x"]
18+
node-version: ["20.x", "18.x"]
1919
steps:
2020
- uses: actions/checkout@v3
2121
- uses: actions/setup-node@v4

Diff for: .github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Prepare for publication to npm
1616
uses: actions/setup-node@v4
1717
with:
18-
node-version: "16.x"
18+
node-version-file: ".nvmrc"
1919
registry-url: "https://registry.npmjs.org"
2020
cache: npm
2121
- run: npm ci

Diff for: .storybook/main.js

+23-18
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
module.exports = {
2-
core: {
3-
builder: "webpack5",
2+
framework: {
3+
name: "@storybook/react-webpack5",
4+
options: {}
45
},
5-
framework: '@storybook/react',
6+
67
staticDirs: ["../public"],
78
stories: ["../stories/**/*.stories.@(tsx|mdx)"],
8-
addons: [
9-
{
10-
name: '@storybook/addon-essentials',
11-
// https://github.com/storybookjs/storybook/issues/17996#issuecomment-1134810729
12-
options: {
13-
'actions': false,
14-
}
15-
},
16-
{
17-
name: "@storybook/addon-storysource",
18-
options: {
19-
sourceLoaderOptions: {
20-
injectStoryParameters: false,
21-
},
9+
10+
addons: [{
11+
name: '@storybook/addon-essentials',
12+
// https://github.com/storybookjs/storybook/issues/17996#issuecomment-1134810729
13+
options: {
14+
'actions': false,
15+
}
16+
}, {
17+
name: "@storybook/addon-storysource",
18+
options: {
19+
sourceLoaderOptions: {
20+
injectStoryParameters: false,
2221
},
2322
},
24-
],
23+
}, "@storybook/addon-mdx-gfm"],
24+
2525
typescript: {
2626
check: false,
2727
checkOptions: {},
@@ -32,7 +32,12 @@ module.exports = {
3232
prop.parent ? !/node_modules/.test(prop.parent.fileName) : true,
3333
},
3434
},
35+
3536
webpackFinal: async (config) => {
3637
return config;
3738
},
39+
40+
docs: {
41+
autodocs: true
42+
}
3843
};

Diff for: CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
44

55
## Unreleased
66

7+
### Breaking changes
8+
9+
- Node 16 is no longer supported, this requires Node 18 or higher to be built.
10+
711
## 2.9.1 ( December 19, 2023)
812

913
- Use non-deprecated events API from solid-client-authn-js

Diff for: jest.config.ts

+20-20
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
/**
2-
* Copyright 2020 Inrupt Inc.
3-
*
4-
* Permission is hereby granted, free of charge, to any person obtaining a copy
5-
* of this software and associated documentation files (the "Software"), to deal in
6-
* the Software without restriction, including without limitation the rights to use,
7-
* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
8-
* Software, and to permit persons to whom the Software is furnished to do so,
9-
* subject to the following conditions:
10-
*
11-
* The above copyright notice and this permission notice shall be included in
12-
* all copies or substantial portions of the Software.
13-
*
14-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15-
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
16-
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
17-
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
18-
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
19-
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20-
*/
1+
//
2+
// Copyright Inrupt Inc.
3+
//
4+
// Permission is hereby granted, free of charge, to any person obtaining a copy
5+
// of this software and associated documentation files (the "Software"), to deal in
6+
// the Software without restriction, including without limitation the rights to use,
7+
// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
8+
// Software, and to permit persons to whom the Software is furnished to do so,
9+
// subject to the following conditions:
10+
//
11+
// The above copyright notice and this permission notice shall be included in
12+
// all copies or substantial portions of the Software.
13+
//
14+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15+
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
16+
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
17+
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
18+
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
19+
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20+
//
2121
export default {
2222
// Automatically clear mock calls and instances between every test
2323
clearMocks: true,

Diff for: jest.setup.ts

+60-21
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,61 @@
1-
/**
2-
* Copyright 2020 Inrupt Inc.
3-
*
4-
* Permission is hereby granted, free of charge, to any person obtaining a copy
5-
* of this software and associated documentation files (the "Software"), to deal in
6-
* the Software without restriction, including without limitation the rights to use,
7-
* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
8-
* Software, and to permit persons to whom the Software is furnished to do so,
9-
* subject to the following conditions:
10-
*
11-
* The above copyright notice and this permission notice shall be included in
12-
* all copies or substantial portions of the Software.
13-
*
14-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15-
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
16-
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
17-
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
18-
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
19-
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20-
*/
1+
//
2+
// Copyright Inrupt Inc.
3+
//
4+
// Permission is hereby granted, free of charge, to any person obtaining a copy
5+
// of this software and associated documentation files (the "Software"), to deal in
6+
// the Software without restriction, including without limitation the rights to use,
7+
// copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
8+
// Software, and to permit persons to whom the Software is furnished to do so,
9+
// subject to the following conditions:
10+
//
11+
// The above copyright notice and this permission notice shall be included in
12+
// all copies or substantial portions of the Software.
13+
//
14+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15+
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
16+
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
17+
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
18+
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
19+
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20+
//
2121

22-
import "@inrupt/jest-jsdom-polyfills";
22+
// import "@inrupt/jest-jsdom-polyfills";
23+
if (
24+
typeof globalThis.TextEncoder === "undefined" ||
25+
typeof globalThis.TextDecoder === "undefined"
26+
) {
27+
const utils = require("util");
28+
globalThis.TextEncoder = utils.TextEncoder;
29+
globalThis.TextDecoder = utils.TextDecoder;
30+
// TextEncoder references a Uint8Array constructor different than the global
31+
// one used by users in tests. The following enforces the same constructor to
32+
// be referenced by both.
33+
// FIXME: currently this doesn't work, and must be set in a custom environment.
34+
globalThis.Uint8Array = Uint8Array;
35+
}
36+
37+
if (
38+
typeof globalThis.crypto !== "undefined" &&
39+
// jsdom doesn't implement the subtle Web Crypto API
40+
typeof globalThis.crypto.subtle === "undefined"
41+
) {
42+
// Requires OPENSSL_CONF=/dev/null (see https://github.com/nodejs/node/discussions/43184)
43+
const {
44+
Crypto: WCrypto,
45+
CryptoKey: WCryptoKey,
46+
} = require("@peculiar/webcrypto");
47+
Object.assign(globalThis.crypto, new WCrypto());
48+
globalThis.CryptoKey = WCryptoKey;
49+
}
50+
51+
// Node.js doesn't support Blob or File, so we're polyfilling those with
52+
// https://github.com/web-std/io
53+
if (typeof globalThis.Blob === "undefined") {
54+
const stdBlob = require("@web-std/blob");
55+
globalThis.Blob = stdBlob.Blob;
56+
}
57+
58+
if (typeof globalThis.File === "undefined") {
59+
const stdFile = require("@web-std/file");
60+
globalThis.File = stdFile.File;
61+
}

0 commit comments

Comments
 (0)