From 7ac26d1b48529afa88d664b276477795c841b746 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Fri, 17 Sep 2021 10:00:10 +0200 Subject: [PATCH] fix: target correct version of node in babel config (#125) --- .babelrc | 12 ------------ babel.config.js | 10 ++++++++++ package.json | 3 ++- 3 files changed, 12 insertions(+), 13 deletions(-) delete mode 100644 .babelrc create mode 100644 babel.config.js diff --git a/.babelrc b/.babelrc deleted file mode 100644 index 2547b5b..0000000 --- a/.babelrc +++ /dev/null @@ -1,12 +0,0 @@ -{ - "presets": [ - [ - "@babel/preset-env", - { - "targets": { - "node": "6" - } - } - ] - ] -} diff --git a/babel.config.js b/babel.config.js new file mode 100644 index 0000000..e6ccaf3 --- /dev/null +++ b/babel.config.js @@ -0,0 +1,10 @@ +/* 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 } }]], +}; diff --git a/package.json b/package.json index a3230b3..ddc4a88 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,8 @@ "jest-watch-select-projects": "^2.0.0", "jest-watch-typeahead": "^0.6.4", "prettier": "1.19.1", - "rimraf": "^3.0.2" + "rimraf": "^3.0.2", + "semver": "^6.3.0" }, "peerDependencies": { "eslint": "^6 || ^7",