Permalink
Browse files

Upgrading to Babel 6 (#1617)

* Upgrading to Babel 6
* Fix assignment issue in mssql
* Drop Travis for node 0.10
  • Loading branch information...
1 parent ad859a7 commit 0b25f6bd0c1b956527ee850bd42a3912611c9dad @tgriesser committed on GitHub Aug 9, 2016
Showing with 31 additions and 15 deletions.
  1. +8 −0 .babelrc
  2. +0 −1 .travis.yml
  3. +13 −9 package.json
  4. +1 −0 scripts/release.sh
  5. +6 −2 src/dialects/mssql/index.js
  6. +3 −3 src/migrate/index.js
View
@@ -0,0 +1,8 @@
+{
+ "presets": ["es2015-loose"],
+ "plugins": [
+ "lodash",
+ "transform-runtime",
+ "add-module-exports"
+ ]
+}
View
@@ -4,7 +4,6 @@ sudo: false
language: node_js
node_js:
- - '0.10'
- '0.12'
- '4'
- '5'
View
@@ -4,6 +4,7 @@
"description": "A batteries-included SQL query & schema builder for Postgres, MySQL and SQLite3 and the Browser",
"main": "knex.js",
"dependencies": {
+ "babel-runtime": "^6.11.6",
"bluebird": "^3.3.4",
"chalk": "^1.0.0",
"commander": "^2.2.0",
@@ -24,8 +25,13 @@
"devDependencies": {
"JSONStream": "^1.0.3",
"async": "^0.9.0",
- "babel": "^5.2.17",
+ "babel-cli": "^6.11.4",
"babel-eslint": "^5.0.0",
+ "babel-plugin-add-module-exports": "^0.2.1",
+ "babel-plugin-lodash": "^3.2.6",
+ "babel-plugin-transform-runtime": "^6.12.0",
+ "babel-preset-es2015": "^6.13.2",
+ "babel-preset-es2015-loose": "^7.0.0",
"chai": "^2.3.0",
"coveralls": "~2.11.1",
"eslint": "2.2.0",
@@ -46,19 +52,18 @@
"sqlite3": "^3.0.5",
"tap-spec": "^4.0.0",
"tape": "^4.0.0",
- "through": "^2.3.4",
- "webpack": "^1.13.0"
+ "through": "^2.3.4"
},
"scripts": {
- "babel": "babel -L -D src/ --out-dir lib/ --source-maps=inline",
- "build": "./scripts/build.sh",
+ "build": "npm run babel",
+ "babel": "rm -rf ./lib && babel src --out-dir lib --copy-files",
"coveralls": "cat ./test/coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
- "dev": "babel -L -D -w src/ --out-dir lib/",
+ "dev": "rm -rf ./lib && babel -w src --out-dir lib --copy-files",
"lint": "eslint src/**",
"plaintest": "mocha --check-leaks -b -R spec test/index.js && npm run tape",
- "prepublish": "npm run build",
+ "prepublish": "npm run babel",
"tape": "node test/tape/index.js | tap-spec",
- "test": "npm run lint && npm run babel && istanbul --config=test/.istanbul.yml cover node_modules/mocha/bin/_mocha -- --check-leaks -b -R spec test/index.js && npm run tape && (npm run build && echo BUILD TEST OK || echo BUILD TEST FAILED)"
+ "test": "npm run lint && istanbul --config=test/.istanbul.yml cover node_modules/mocha/bin/_mocha -- --check-leaks -b -R spec test/index.js && npm run tape"
},
"bin": {
"knex": "./lib/bin/cli.js"
@@ -103,7 +108,6 @@
"README.md",
"src/*",
"lib/*",
- "build/*",
"knex.js",
"LICENSE",
"CHANGELOG.md"
View
@@ -23,6 +23,7 @@ next_ref="v$next_version"
git add -u
+npm run build
npm test
update_version 'package.json' $next_version
@@ -101,7 +101,9 @@ assign(Client_MSSQL.prototype, {
stream.on('end', resolver);
let { sql } = obj
if (!sql) return resolver()
- if (obj.options) ({ sql } = assign({sql}, obj.options))
+ if (obj.options) {
+ sql = assign({sql}, obj.options)
+ }
const req = (connection.tx_ || connection).request();
//req.verbose = true;
req.multiple = true;
@@ -126,7 +128,9 @@ assign(Client_MSSQL.prototype, {
return new Promise(function(resolver, rejecter) {
let { sql } = obj
if (!sql) return resolver()
- if (obj.options) ({ sql } = assign({sql}, obj.options))
+ if (obj.options) {
+ sql = assign({sql}, obj.options)
+ }
const req = (connection.tx_ || connection).request();
// req.verbose = true;
req.multiple = true;
@@ -6,8 +6,8 @@ import mkdirp from 'mkdirp';
import Promise from '../promise';
import * as helpers from '../helpers';
import {
- assign, bind, chain, difference, each, filter, get, includes, isBoolean,
- isEmpty, isUndefined, map, template
+ assign, bind, difference, each, filter, get, includes, isBoolean,
+ isEmpty, isUndefined, map, max, template
} from 'lodash'
import inherits from 'inherits';
@@ -78,7 +78,7 @@ export default class Migrator {
this.config = this.setConfig(config);
return this._listCompleted(config)
.then((completed) => {
- const val = chain(completed).map(value => value.split('_')[0]).max().value();
+ const val = max(map(completed, value => value.split('_')[0]));
return (isUndefined(val) ? 'none' : val);
})
}

0 comments on commit 0b25f6b

Please sign in to comment.