Skip to content
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

Merged
merged 7 commits into from Sep 26, 2018
Merged

Use Babel 7 #2813

merged 7 commits into from Sep 26, 2018

Conversation

@kibertoad
Copy link
Collaborator

@kibertoad kibertoad commented Sep 19, 2018

Implements #2793

@@ -0,0 +1,22 @@
'use strict';

This comment has been minimized.

@kibertoad

kibertoad Sep 19, 2018
Author Collaborator

babel.config.js is the officially recommended way to configure Babel

'@babel/preset-env',
Object.assign(
{},
isDev ? { targets: { node: 'current' } } : { targets: { node: '6' } }

This comment has been minimized.

@kibertoad

kibertoad Sep 19, 2018
Author Collaborator

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.

@@ -7,7 +7,7 @@
"node": ">=6"
},
"dependencies": {
"babel-runtime": "^6.26.0",
"@babel/runtime": "^7.0.0",

This comment has been minimized.

@kibertoad

kibertoad Sep 19, 2018
Author Collaborator

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",

This comment has been minimized.

@kibertoad

kibertoad Sep 19, 2018
Author Collaborator

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 } }

This comment has been minimized.

@kibertoad

kibertoad Sep 19, 2018
Author Collaborator

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.

@@ -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",

This comment has been minimized.

@kibertoad

kibertoad Sep 19, 2018
Author Collaborator

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,

This comment has been minimized.

@kibertoad

kibertoad Sep 19, 2018
Author Collaborator

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);

This comment has been minimized.

@kibertoad

kibertoad Sep 19, 2018
Author Collaborator

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.

@kibertoad
Copy link
Collaborator Author

@kibertoad kibertoad commented Sep 25, 2018

@elhigu Is this one missing anything?

@elhigu
Copy link
Member

@elhigu elhigu commented Sep 26, 2018

Very nice +1

@elhigu elhigu merged commit 093f722 into knex:master Sep 26, 2018
1 of 2 checks passed
1 of 2 checks passed
coverage/coveralls Coverage decreased (-1.03%) to 84.687%
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@kibertoad kibertoad deleted the kibertoad:feature/babel-7 branch Sep 26, 2018
@ricardograca ricardograca mentioned this pull request Sep 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants