Skip to content

Commit

Permalink
Upgrading to Babel 6 (#1617)
Browse files Browse the repository at this point in the history
* Upgrading to Babel 6
* Fix assignment issue in mssql
* Drop Travis for node 0.10
  • Loading branch information
tgriesser committed Aug 9, 2016
1 parent ad859a7 commit 0b25f6b
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 15 deletions.
8 changes: 8 additions & 0 deletions .babelrc
@@ -0,0 +1,8 @@
{
"presets": ["es2015-loose"],
"plugins": [
"lodash",
"transform-runtime",
"add-module-exports"
]
}
1 change: 0 additions & 1 deletion .travis.yml
Expand Up @@ -4,7 +4,6 @@ sudo: false
language: node_js

node_js:
- '0.10'
- '0.12'
- '4'
- '5'
Expand Down
22 changes: 13 additions & 9 deletions package.json
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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"
Expand Down Expand Up @@ -103,7 +108,6 @@
"README.md",
"src/*",
"lib/*",
"build/*",
"knex.js",
"LICENSE",
"CHANGELOG.md"
Expand Down
1 change: 1 addition & 0 deletions scripts/release.sh
Expand Up @@ -23,6 +23,7 @@ next_ref="v$next_version"

git add -u

npm run build
npm test

update_version 'package.json' $next_version
Expand Down
8 changes: 6 additions & 2 deletions src/dialects/mssql/index.js
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/migrate/index.js
Expand Up @@ -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';

Expand Down Expand Up @@ -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);
})
}
Expand Down

0 comments on commit 0b25f6b

Please sign in to comment.