Skip to content

Commit

Permalink
Require Node.js 14.18+ (#760)
Browse files Browse the repository at this point in the history
Closes #738.
  • Loading branch information
72636c authored Feb 9, 2022
1 parent b92d0f9 commit 45a40b3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
13 changes: 13 additions & 0 deletions .changeset/big-actors-heal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
"skuba": major
---

deps: Require Node.js 14.18+

Node.js 12 will reach end of life by April 2022. The `semantic-release` package and stable `--enable-source-maps` flag necessitate this new minimum version.

Consider upgrading the Node.js version for your project across:

- `.nvmrc`
- `package.json#/engines/node`
- CI/CD configuration (`.buildkite/pipeline.yml`, `Dockerfile`, etc.)
11 changes: 4 additions & 7 deletions jest/moduleNameMapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const {
/**
* Set a default `src` module alias for backward compatibility.
*
* TODO: drop this default in skuba v4.
* TODO: drop this default in skuba v5.
*/
const DEFAULT_PATHS = { src: ['src'], 'src/*': ['src/*'] };

Expand All @@ -20,8 +20,7 @@ const DEFAULT_PATHS = { src: ['src'], 'src/*': ['src/*'] };
*/
const getConfigFromDisk = () => {
const filename =
// TODO: drop Node.js 12 compatibility and switch to ?? in skuba v4.
findConfigFile('.', sys.fileExists.bind(this)) || 'tsconfig.json';
findConfigFile('.', sys.fileExists.bind(this)) ?? 'tsconfig.json';

return readConfigFile(filename, sys.readFile.bind(this)).config;
};
Expand All @@ -33,8 +32,7 @@ module.exports.createModuleNameMapper = (getConfig = getConfigFromDisk) => {
const parsedConfig = parseJsonConfigFileContent(json, sys, '.');

const paths = Object.fromEntries(
// TODO: drop Node.js 12 compatibility and switch to ?? in skuba v4.
Object.entries(parsedConfig.options.paths || DEFAULT_PATHS).flatMap(
Object.entries(parsedConfig.options.paths ?? DEFAULT_PATHS).flatMap(
([key, values]) => [
// Pass through the input path entry almost verbatim.
// We trim a trailing slash because TypeScript allows `import 'src'`
Expand Down Expand Up @@ -66,8 +64,7 @@ module.exports.createModuleNameMapper = (getConfig = getConfigFromDisk) => {
),
);

// TODO: drop Node.js 12 compatibility and switch to ?? in skuba v4.
const prefix = path.join('<rootDir>', parsedConfig.options.baseUrl || '.');
const prefix = path.join('<rootDir>', parsedConfig.options.baseUrl ?? '.');

const moduleNameMapper = pathsToModuleNameMapper(paths, { prefix });

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"skuba": "lib/skuba.js"
},
"engines": {
"node": ">=12"
"node": ">=14.18"
},
"version": "3.17.2",
"main": "lib/index.js",
Expand Down

0 comments on commit 45a40b3

Please sign in to comment.