Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Use Babel 7 (#2813)
* WIP changes

* Use Babel 7

* Fix build

* Fix Node 6 compatibility (apparently Babel has no idea how to transform Object.values)

* Try ignoring "expected behaviour" error (babel/babel-loader#152)

* Coverage dropped since less code gets generated now, time to revisit threshold
  • Loading branch information
kibertoad authored and elhigu committed Sep 26, 2018
1 parent 776a115 commit 093f722
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 39 deletions.
14 changes: 0 additions & 14 deletions .babelconfig.js

This file was deleted.

3 changes: 0 additions & 3 deletions .babelrc

This file was deleted.

1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -5,6 +5,7 @@

- Use datetime2 for MSSQL datetime + timestamp types. This change is incompatible with MSSQL older than 2008 #2757
- Knex.VERSION() method was removed, run "require('knex/package').version" instead #2776
- Knex transpilation now targets Node.js 6, meaning it will no longer run on older Node.js versions #2813

### New features:

Expand Down
22 changes: 22 additions & 0 deletions babel.config.js
@@ -0,0 +1,22 @@
'use strict';

const isDev = process.env.npm_lifecycle_event === 'dev';

module.exports = function(api) {
const presets = [
[
'@babel/preset-env',
Object.assign(
{},
isDev ? { targets: { node: 'current' } } : { targets: { node: 6 } }
),
],
];
const plugins = ['add-module-exports'];

api.cache(() => process.env.NODE_ENV); // Invalidate cache when building for a different environment
return {
presets,
plugins,
};
};
36 changes: 16 additions & 20 deletions package.json
Expand Up @@ -7,15 +7,14 @@
"node": ">=6"
},
"dependencies": {
"babel-runtime": "^6.26.0",
"bluebird": "^3.5.1",
"bluebird": "^3.5.2",
"chalk": "2.4.1",
"commander": "^2.17.1",
"commander": "^2.18.0",
"debug": "3.1.0",
"inherits": "~2.0.3",
"interpret": "^1.1.0",
"liftoff": "2.5.0",
"lodash": "^4.17.10",
"lodash": "^4.17.11",
"minimist": "1.2.0",
"mkdirp": "^0.5.1",
"pg-connection-string": "2.0.0",
Expand All @@ -33,11 +32,11 @@
"devDependencies": {
"JSONStream": "^1.3.4",
"async": "^2.6.1",
"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",
"babel-preset-env": "^1.7.0",
"@babel/cli": "^7.1.0",
"@babel/core": "^7.1.0",
"@babel/preset-env": "^7.1.0",
"babel-eslint": "^9.0.0",
"babel-plugin-add-module-exports": "^1.0.0",
"chai": "^4.1.2",
"chai-subset-in-order": "^2.1.2",
"coveralls": "^3.0.2",
Expand All @@ -55,9 +54,9 @@
"nyc": "^13.0.1",
"pg": "^7.4.3",
"pg-query-stream": "^1.1.1",
"prettier": "^1.14.2",
"prettier": "^1.14.3",
"rimraf": "^2.6.2",
"sinon": "^6.3.3",
"sinon": "^6.3.4",
"sinon-chai": "^3.2.0",
"source-map-support": "^0.5.9",
"sqlite3": "^4.0.2",
Expand All @@ -67,12 +66,9 @@
"toxiproxy-node-client": "^2.0.6"
},
"buildDependencies": [
"babel-cli",
"@babel/cli",
"babel-plugin-add-module-exports",
"babel-plugin-lodash",
"babel-plugin-transform-runtime",
"babel-preset-es2015",
"babel-preset-es2015-loose",
"@babel/preset-env",
"rimraf"
],
"scripts": {
Expand All @@ -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",
"oracledb:test": "docker rmi -f --no-prune knex-test-oracledb && docker build -f scripts/oracle-tests-Dockerfile --tag knex-test-oracledb . && docker run --rm -i -t -e KNEX_TEST_TIMEOUT=$KNEX_TEST_TIMEOUT -e NODE_VER=$NODE_VER knex-test-oracledb",
"mssql:init": "docker-compose -f scripts/mssql-docker-compose.yml up --no-start && docker-compose -f scripts/mssql-docker-compose.yml start",
"postmssql:init": "node scripts/wait-for-mssql-server.js && npm run mssql:logs || (npm run mssql:logs;false)",
Expand Down Expand Up @@ -155,9 +151,9 @@
"tonicExampleFilename": "scripts/runkit-example.js",
"nyc": {
"check-coverage": true,
"lines": 85,
"statements": 83,
"lines": 84,
"statements": 82,
"functions": 83,
"branches": 72
"branches": 69
}
}
4 changes: 2 additions & 2 deletions src/dialects/sqlite3/schema/tablecompiler.js
@@ -1,7 +1,7 @@
import inherits from 'inherits';
import TableCompiler from '../../../schema/tablecompiler';

import { filter } from 'lodash';
import { filter, values } from 'lodash';

// Table Compiler
// -------
Expand Down Expand Up @@ -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.pushQuery({
sql: `PRAGMA table_info(${this.tableName()})`,
output(pragma) {
Expand Down

0 comments on commit 093f722

Please sign in to comment.