New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use Babel 7 #2813
Use Babel 7 #2813
Conversation
@@ -0,0 +1,22 @@ | |||
'use strict'; | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
babel.config.js is the officially recommended way to configure Babel
babel.config.js
Outdated
'@babel/preset-env', | ||
Object.assign( | ||
{}, | ||
isDev ? { targets: { node: 'current' } } : { targets: { node: '6' } } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we do not officially support Node versions below 6, I've explicitly locked transpilation at that version. This results in much more readable (and debuggable) code being generated.
package.json
Outdated
@@ -7,7 +7,7 @@ | |||
"node": ">=6" | |||
}, | |||
"dependencies": { | |||
"babel-runtime": "^6.26.0", | |||
"@babel/runtime": "^7.0.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need this?
"babel-cli": "^6.26.0", | ||
"babel-eslint": "^8.2.6", | ||
"babel-plugin-add-module-exports": "^0.2.1", | ||
"babel-plugin-transform-runtime": "^6.23.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've removed transform-runtime since it seems to be mostly useful when building to very old Node versions and using it causes babel/babel-loader#152
'@babel/preset-env', | ||
Object.assign( | ||
{}, | ||
isDev ? { targets: { node: 'current' } } : { targets: { node: 6 } } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we do not officially support Node versions below 6, I've explicitly locked transpilation at that version. This results in much more readable (and debuggable) code being generated.
…rm Object.values)
@@ -89,7 +85,7 @@ | |||
"pre_test": "npm run lint", | |||
"tape": "node test/tape/index.js | tap-spec", | |||
"debug_tape": "node --inspect-brk test/tape/index.js", | |||
"test": "npm run pre_test && nyc mocha --exit --check-leaks -t 10000 -R spec test/index.js && npm run tape", | |||
"test": "npm run pre_test && nyc mocha --exit --check-leaks --globals __core-js_shared__ -t 10000 -R spec test/index.js && npm run tape", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ignore for "core-js_shared" was added since currently there is no way around it, Tedious brings babel-runtime into test execution and that results in an expected leakage (see babel/babel-loader#152). This is not a problem with Knex nor something we should address.
@@ -155,9 +151,9 @@ | |||
"tonicExampleFilename": "scripts/runkit-example.js", | |||
"nyc": { | |||
"check-coverage": true, | |||
"lines": 85, | |||
"statements": 83, | |||
"lines": 84, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We generate more concise code now, this decreased coverage slightly.
@@ -132,7 +132,7 @@ TableCompiler_SQLite3.prototype.renameColumn = function(from, to) { | |||
|
|||
TableCompiler_SQLite3.prototype.dropColumn = function() { | |||
const compiler = this; | |||
const columns = Object.values(arguments); | |||
const columns = values(arguments); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apparently Object.values is one thing that Babel has no idea how to transpile (see https://github.com/IBM/carbon-components-react/issues/638), and polyfilling just for this one case feels like an overkill.
@elhigu Is this one missing anything? |
Very nice +1 |
Implements #2793