Skip to content

Commit

Permalink
build: set minimum runtime Node.js version to 12.20.0
Browse files Browse the repository at this point in the history
Node.js =12.20.0 added support for exports field.
Node.js =12.19.0 added support for imports field.

Both of these fields are used by integrated ApiDOM.

[email protected] doesn't yet support package.json imports
field. Next version will, more info in:
jestjs/jest#12270.

Refs #2744
  • Loading branch information
char0n committed Jan 5, 2023
1 parent 533545f commit dcb9c3f
Show file tree
Hide file tree
Showing 9 changed files with 19,064 additions and 64 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Use Node.js 12.4.x
- name: Use Node.js 12.20.0
uses: actions/setup-node@v2
with:
node-version: 12.4.x
node-version: 12.20.0
registry-url: https://npm.pkg.github.com/
scope: "@swagger-api"
- name: Cache Node Modules
Expand All @@ -84,7 +84,7 @@ jobs:
with:
name: commonjs

- name: Run commonjs build artifacts on Node.js 12.4.x
- name: Run commonjs build artifacts on Node.js 12.20.0
run: node -p "require('./commonjs')"

- name: Use Node 14.x
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Swagger Client Version | Release Date | OpenAPI Spec compatibility | Notes

### Runtime

- Node.js `>=` 12.4.x
- Node.js `>=`12.20.0
- `swagger-client` works in the latest versions of Chrome, Safari, Firefox, and Edge.

## Security contact
Expand Down
2 changes: 1 addition & 1 deletion babel.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = {
corejs: { version: 3 },
useBuiltIns: false,
targets: {
node: '12.4',
node: '12.20.0',
},
forceAllTransforms: false,
ignoreBrowserslistConfig: true,
Expand Down
16 changes: 16 additions & 0 deletions config/jest/jest.artifact-commonjs.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,20 @@ module.exports = {
rootDir: path.join(__dirname, '..', '..'),
testEnvironment: 'node',
testMatch: ['**/test/build-artifacts/commonjs.js'],
moduleNameMapper: {
/**
* This is here only until next version of Jest is released - 29.4.x.
* Jest doesn't support package.json imports fields now, so we have
* to provide this workaround.
*
* More information in https://github.com/facebook/jest/issues/12270.
*
*/
'#buffer':
'<rootDir>/node_modules/@swagger-api/apidom-reference/cjs/util/polyfills/buffer/protocol-import.cjs',
'#fs':
'<rootDir>/node_modules/@swagger-api/apidom-reference/cjs/util/polyfills/fs/protocol-import.cjs',
'#util':
'<rootDir>/node_modules/@swagger-api/apidom-reference/cjs/util/polyfills/util/protocol-import.cjs',
},
};
16 changes: 16 additions & 0 deletions config/jest/jest.artifact-es.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,20 @@ module.exports = {
rootDir: path.join(__dirname, '..', '..'),
testEnvironment: 'node',
testMatch: ['**/test/build-artifacts/es.js'],
moduleNameMapper: {
/**
* This is here only until next version of Jest is released - 29.4.x.
* Jest doesn't support package.json imports fields now, so we have
* to provide this workaround.
*
* More information in https://github.com/facebook/jest/issues/12270.
*
*/
'#buffer':
'<rootDir>/node_modules/@swagger-api/apidom-reference/cjs/util/polyfills/buffer/protocol-import.cjs',
'#fs':
'<rootDir>/node_modules/@swagger-api/apidom-reference/cjs/util/polyfills/fs/protocol-import.cjs',
'#util':
'<rootDir>/node_modules/@swagger-api/apidom-reference/cjs/util/polyfills/util/protocol-import.cjs',
},
};
14 changes: 14 additions & 0 deletions config/jest/jest.unit.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,20 @@ module.exports = {
moduleNameMapper: {
'formdata-node/lib/cjs/fileFromPath.js':
'<rootDir>/node_modules/formdata-node/lib/cjs/fileFromPath.js',
/**
* This is here only until next version of Jest is released - 29.4.x.
* Jest doesn't support package.json imports fields now, so we have
* to provide this workaround.
*
* More information in https://github.com/facebook/jest/issues/12270.
*
*/
'#buffer':
'<rootDir>/node_modules/@swagger-api/apidom-reference/cjs/util/polyfills/buffer/protocol-import.cjs',
'#fs':
'<rootDir>/node_modules/@swagger-api/apidom-reference/cjs/util/polyfills/fs/protocol-import.cjs',
'#util':
'<rootDir>/node_modules/@swagger-api/apidom-reference/cjs/util/polyfills/util/protocol-import.cjs',
},
testPathIgnorePatterns: [
'<rootDir>/node_modules/',
Expand Down
15 changes: 2 additions & 13 deletions docs/development/setting-up.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,11 @@
### Prerequisites

- git, any version
- NPM >=6.12.x
- Node.js >=16.16
- NPM >=8.11.0

Generally, we recommend following guidelines from [Node.js Releases](https://nodejs.org/en/about/releases/) to only use `Current`, `Active LTS` or `Maintenance LTS` releases.

Current Node.js:
- Node.js 16.x
- NPM >=7.10.x

Current Node.js Active LTS:
- Node.js >=14.x
- NPM >=6.14.x

Current Node.js Maintenance LTS:
- Node.js >12.4
- NPM >=6.12.x

### Steps

1. `git clone https://github.com/swagger-api/swagger-js.git`
Expand Down
Loading

0 comments on commit dcb9c3f

Please sign in to comment.