From b88d89e6adee8ea834fd1955c7cb154346eddfd2 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Mon, 6 Mar 2023 14:45:24 +0100 Subject: [PATCH] chore: add `engines` info to package.json (#192) --- .babelrc | 18 ------------------ babel.config.js | 13 +++++++++++++ package.json | 4 ++++ yarn.lock | 3 ++- 4 files changed, 19 insertions(+), 19 deletions(-) delete mode 100644 .babelrc create mode 100644 babel.config.js diff --git a/.babelrc b/.babelrc deleted file mode 100644 index b48f6c2..0000000 --- a/.babelrc +++ /dev/null @@ -1,18 +0,0 @@ -{ - "presets": [ - [ - "@babel/preset-env", - { - "targets": { - "node": "14" - } - } - ], - [ - "@babel/preset-typescript", - { - "allowDeclareFields": true - } - ] - ] -} diff --git a/babel.config.js b/babel.config.js new file mode 100644 index 0000000..8975c74 --- /dev/null +++ b/babel.config.js @@ -0,0 +1,13 @@ +/* eslint-disable import/no-extraneous-dependencies */ + +const semver = require('semver'); +const pkg = require('./package.json'); + +const supportedNodeVersion = semver.minVersion(pkg.engines.node).version; + +module.exports = { + presets: [ + ['@babel/preset-env', { targets: { node: supportedNodeVersion } }], + ['@babel/preset-typescript', { allowDeclareFields: true }], + ], +}; diff --git a/package.json b/package.json index a03750a..90c82dc 100644 --- a/package.json +++ b/package.json @@ -63,6 +63,7 @@ "jest": "^29.0.0", "jest-runner": "^29.0.0", "prettier": "^2.0.5", + "semver": "^7.3.8", "strip-ansi": "^6.0.0", "typescript": "^4.3.5" }, @@ -87,5 +88,8 @@ "resolutions": { "@types/node@*": "^14.18.23" }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + }, "packageManager": "yarn@3.4.1" } diff --git a/yarn.lock b/yarn.lock index 40b5d1e..6f46952 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2741,6 +2741,7 @@ __metadata: jest-worker: ^29.5.0 p-limit: ^3.1.0 prettier: ^2.0.5 + semver: ^7.3.8 strip-ansi: ^6.0.0 typescript: ^4.3.5 peerDependencies: @@ -5637,7 +5638,7 @@ __metadata: languageName: node linkType: hard -"semver@npm:^7.3.5, semver@npm:^7.3.7": +"semver@npm:^7.3.5, semver@npm:^7.3.7, semver@npm:^7.3.8": version: 7.3.8 resolution: "semver@npm:7.3.8" dependencies: