Skip to content

Commit

Permalink
Merge 1d522fc into 33656be
Browse files Browse the repository at this point in the history
  • Loading branch information
kibertoad committed May 28, 2019
2 parents 33656be + 1d522fc commit b5181e9
Show file tree
Hide file tree
Showing 121 changed files with 652 additions and 670 deletions.
7 changes: 3 additions & 4 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
const warning = process.env['CI'] ? 2 : 1;

module.exports = {
parser: 'babel-eslint',
parserOptions: {
ecmaVersion: 2018,
},
extends: [
'eslint:recommended',
'plugin:import/errors',
Expand All @@ -17,9 +19,6 @@ module.exports = {
'prefer-const': warning,
'no-fallthrough': warning,
},
settings: {
'import/parser': 'babel-eslint',
},
env: {
node: true,
mocha: true,
Expand Down
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,9 @@ matrix:
env: DB="oracledb mssql mysql mysql2 postgres sqlite3" KNEX_TEST_TIMEOUT=60000
- node_js: '8'
env: TESTSCRIPT=test:nyc DB="oracledb mssql mysql mysql2 postgres sqlite3" KNEX_TEST_TIMEOUT=60000
- node_js: '6'
env: DB="oracledb mssql mysql mysql2 postgres sqlite3" KNEX_TEST_TIMEOUT=60000
install:
- npm i
- (echo $DB | grep oracledb) && npm install oracledb || true
- npm run build

before_script:
- npm run db:start
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ So if you like to write your own dialect, you can just inherit own dialect from
require('sqlite3-offline');
const Knex = require('knex');

const Dialect = require(`knex/lib/dialects/sqlite3/index.js`);
const Dialect = require(`knex/src/dialects/sqlite3/index.js`);
Dialect.prototype._driver = () => require('sqlite3-offline');

const knex = Knex({
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Node.js, featuring:
- a [thorough test suite](https://travis-ci.org/tgriesser/knex)
- the ability to [run in the Browser](http://knexjs.org/#Installation-browser)

Node.js versions 6+ are supported.
Node.js versions 8+ are supported.

[Read the full documentation to get started!](http://knexjs.org)
[Or check out our Recipes wiki to search for solutions to some specific problems](https://github.com/tgriesser/knex/wiki/Recipes)
Expand Down
22 changes: 0 additions & 22 deletions babel.config.js

This file was deleted.

2 changes: 1 addition & 1 deletion bin/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ function invoke(env) {
pending = fs
.readFileAsync(
path.dirname(env.modulePath) +
'/lib/migrate/stub/knexfile-' +
'/src/migrate/stub/knexfile-' +
type +
'.stub'
)
Expand Down
2 changes: 1 addition & 1 deletion bin/utils/cli-config-utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { DEFAULT_EXT, DEFAULT_TABLE_NAME } = require('./constants');
const { resolveClientNameWithAliases } = require('../../lib/helpers');
const { resolveClientNameWithAliases } = require('../../src/helpers');
const fs = require('fs');

function mkConfigObj(opts) {
Expand Down
22 changes: 1 addition & 21 deletions knex.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,8 @@
const { isNode6 } = require('./lib/util/version-helper');

// Knex.js
// --------------
// (c) 2013-present Tim Griesser
// Knex may be freely distributed under the MIT license.
// For details and documentation:
// http://knexjs.org

// Should be safe to remove after support for Node.js 6 is dropped
if (isNode6()) {
try {
const oldPromise = global.Promise;

require('@babel/polyfill');

// Preserve any Promise overrides set globally prior to importing knex
if (oldPromise) {
global.Promise = oldPromise;
}
} catch (e) {
throw new Error(
`You are using Node.js 6. Please consider upgrading to Node.js 8+ or add '@babel/polyfill' dependency to the project (knex will automatically load it).`
);
}
}

module.exports = require('./lib/index');
module.exports = require('./src/index');
32 changes: 9 additions & 23 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{
"name": "knex",
"version": "0.17.0",
"version": "0.18.0-next1",
"description": "A batteries-included SQL query & schema builder for Postgres, MySQL and SQLite3 and the Browser",
"main": "knex.js",
"types": "types/index.d.ts",
"engines": {
"node": ">=6"
"node": ">=8"
},
"dependencies": {
"@babel/polyfill": "^7.4.4",
"@types/bluebird": "^3.5.27",
"bluebird": "^3.5.5",
"colorette": "1.0.7",
Expand All @@ -33,14 +32,9 @@
]
},
"devDependencies": {
"@babel/cli": "^7.4.4",
"@babel/core": "^7.4.5",
"@babel/preset-env": "^7.4.5",
"@types/node": "^10.14.7",
"JSONStream": "^1.3.5",
"async": "^3.0.1",
"babel-eslint": "^10.0.1",
"babel-plugin-add-module-exports": "^1.0.2",
"chai": "^4.2.0",
"chai-subset-in-order": "^2.1.3",
"cli-testlab": "^1.4.0",
Expand Down Expand Up @@ -76,24 +70,16 @@
"webpack-cli": "^3.3.2"
},
"buildDependencies": [
"@babel/cli",
"babel-plugin-add-module-exports",
"@babel/preset-env",
"rimraf"
],
"scripts": {
"format": "prettier --write \"{src,bin,scripts,test}/**/*.js\"",
"build": "npm run babel",
"babel": "rimraf ./lib && babel src --out-dir lib --copy-files",
"debug:test": "mocha --inspect-brk --exit -t 0 test/index.js",
"debug:tape": "node --inspect-brk test/tape/index.js",
"coveralls": "nyc report --reporter=text-lcov | coveralls",
"dev": "rimraf ./lib && babel -w src --out-dir lib --copy-files",
"lint": "eslint \"src/**/*.js\" \"test/**/*.js\"",
"lint:types": "dtslint types",
"prepare": "npm run babel",
"prepublishOnly": "npm run babel",
"pretest": "npm run lint && npm run lint:types && npm run babel",
"pretest": "npm run lint && npm run lint:types",
"test": "mocha --exit -t 10000 test/index.js && npm run test:tape && npm run test:cli",
"test:nyc": "nyc mocha --exit --check-leaks --globals __core-js_shared__ -t 10000 test/index.js && npm run test:tape && npm run test:cli",
"test:sqlite": "cross-env DB=sqlite3 npm test",
Expand Down Expand Up @@ -127,11 +113,11 @@
"web": "https://github.com/tgriesser"
},
"browser": {
"./lib/migrate/Migrator.js": "./lib/util/noop.js",
"./lib/bin/cli.js": "./lib/util/noop.js",
"./lib/seed/Seeder.js": "./lib/util/noop.js",
"./src/migrate/Migrator.js": "./src/util/noop.js",
"./src/bin/cli.js": "./src/util/noop.js",
"./src/seed/Seeder.js": "./src/util/noop.js",
"mssql": false,
"mssql/lib/base": false,
"mssql/src/base": false,
"tedious": false,
"mysql": false,
"mysql2": false,
Expand All @@ -142,8 +128,8 @@
"oracledb": false
},
"react-native": {
"./lib/migrate": "./lib/util/noop.js",
"./lib/seed": "./lib/util/noop.js"
"./src/migrate": "./src/util/noop.js",
"./src/seed": "./src/util/noop.js"
},
"files": [
"CONTRIBUTING.md",
Expand Down
43 changes: 22 additions & 21 deletions src/client.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
import Promise from 'bluebird';
const Promise = require('bluebird');

import Raw from './raw';
import Ref from './ref';
import Runner from './runner';
import Formatter from './formatter';
import Transaction from './transaction';
const Raw = require('./raw');
const Ref = require('./ref');
const Runner = require('./runner');
const Formatter = require('./formatter');
const Transaction = require('./transaction');

import QueryBuilder from './query/builder';
import QueryCompiler from './query/compiler';
const QueryBuilder = require('./query/builder');
const QueryCompiler = require('./query/compiler');

import SchemaBuilder from './schema/builder';
import SchemaCompiler from './schema/compiler';
import TableBuilder from './schema/tablebuilder';
import TableCompiler from './schema/tablecompiler';
import ColumnBuilder from './schema/columnbuilder';
import ColumnCompiler from './schema/columncompiler';
const SchemaBuilder = require('./schema/builder');
const SchemaCompiler = require('./schema/compiler');
const TableBuilder = require('./schema/tablebuilder');
const TableCompiler = require('./schema/tablecompiler');
const ColumnBuilder = require('./schema/columnbuilder');
const ColumnCompiler = require('./schema/columncompiler');

import { Pool, TimeoutError } from 'tarn';
import inherits from 'inherits';
import { EventEmitter } from 'events';
const { Pool, TimeoutError } = require('tarn');
const inherits = require('inherits');
const { EventEmitter } = require('events');

import { makeEscape } from './query/string';
import { assign, uniqueId, cloneDeep, defaults } from 'lodash';
const { makeEscape } = require('./query/string');
const { assign, uniqueId, cloneDeep, defaults } = require('lodash');

import Logger from './logger';
const Logger = require('./logger');

const debug = require('debug')('knex:client');
const debugQuery = require('debug')('knex:query');
Expand Down Expand Up @@ -66,6 +66,7 @@ function Client(config = {}) {
this.valueForUndefined = null;
}
}

inherits(Client, EventEmitter);

assign(Client.prototype, {
Expand Down Expand Up @@ -372,4 +373,4 @@ assign(Client.prototype, {
},
});

export default Client;
module.exports = Client;
25 changes: 14 additions & 11 deletions src/dialects/mssql/index.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
// MSSQL Client
// -------
import { assign, map, flatten, values } from 'lodash';
import inherits from 'inherits';
const { assign, map, flatten, values } = require('lodash');
const inherits = require('inherits');

import Client from '../../client';
import Promise from 'bluebird';
const Client = require('../../client');
const Promise = require('bluebird');

import Formatter from '../../formatter';
import Transaction from './transaction';
import QueryCompiler from './query/compiler';
import SchemaCompiler from './schema/compiler';
import TableCompiler from './schema/tablecompiler';
import ColumnCompiler from './schema/columncompiler';
const Formatter = require('../../formatter');
const Transaction = require('./transaction');
const QueryCompiler = require('./query/compiler');
const SchemaCompiler = require('./schema/compiler');
const TableCompiler = require('./schema/tablecompiler');
const ColumnCompiler = require('./schema/columncompiler');

const { isArray } = Array;

Expand All @@ -37,6 +37,7 @@ function Client_MSSQL(config = {}) {

Client.call(this, config);
}

inherits(Client_MSSQL, Client);

assign(Client_MSSQL.prototype, {
Expand Down Expand Up @@ -85,6 +86,7 @@ assign(Client_MSSQL.prototype, {
this.pool.release(connection);
}
}

/* istanbul ignore next */
function _poolCreate() {
// implementation is copy-pasted from https://github.com/tediousjs/node-mssql/pull/614
Expand Down Expand Up @@ -133,6 +135,7 @@ assign(Client_MSSQL.prototype, {

// prevent calling resolve again on end event
let alreadyResolved = false;

function safeResolve(err) {
if (!alreadyResolved) {
alreadyResolved = true;
Expand Down Expand Up @@ -376,4 +379,4 @@ class MSSQL_Formatter extends Formatter {
}
}

export default Client_MSSQL;
module.exports = Client_MSSQL;
8 changes: 4 additions & 4 deletions src/dialects/mssql/query/compiler.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// MSSQL Query Compiler
// ------
import inherits from 'inherits';
import QueryCompiler from '../../../query/compiler';
const inherits = require('inherits');
const QueryCompiler = require('../../../query/compiler');

import { assign, isEmpty, compact, identity } from 'lodash';
const { assign, isEmpty, compact, identity } = require('lodash');

function QueryCompiler_MSSQL(client, builder) {
QueryCompiler.call(this, client, builder);
Expand Down Expand Up @@ -257,4 +257,4 @@ assign(QueryCompiler_MSSQL.prototype, {

// Set the QueryBuilder & QueryCompiler on the client object,
// in case anyone wants to modify things to suit their own purposes.
export default QueryCompiler_MSSQL;
module.exports = QueryCompiler_MSSQL;
8 changes: 4 additions & 4 deletions src/dialects/mssql/schema/columncompiler.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// MySQL Column Compiler
// -------
import inherits from 'inherits';
import ColumnCompiler from '../../../schema/columncompiler';
const inherits = require('inherits');
const ColumnCompiler = require('../../../schema/columncompiler');

import { assign } from 'lodash';
const { assign } = require('lodash');

function ColumnCompiler_MSSQL() {
ColumnCompiler.apply(this, arguments);
Expand Down Expand Up @@ -113,4 +113,4 @@ assign(ColumnCompiler_MSSQL.prototype, {
},
});

export default ColumnCompiler_MSSQL;
module.exports = ColumnCompiler_MSSQL;
8 changes: 4 additions & 4 deletions src/dialects/mssql/schema/compiler.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// MySQL Schema Compiler
// -------
import inherits from 'inherits';
import SchemaCompiler from '../../../schema/compiler';
const inherits = require('inherits');
const SchemaCompiler = require('../../../schema/compiler');

import { assign } from 'lodash';
const { assign } = require('lodash');

function SchemaCompiler_MSSQL(client, builder) {
SchemaCompiler.call(this, client, builder);
Expand Down Expand Up @@ -58,4 +58,4 @@ function prefixedTableName(prefix, table) {
return prefix ? `${prefix}.${table}` : table;
}

export default SchemaCompiler_MSSQL;
module.exports = SchemaCompiler_MSSQL;
Loading

0 comments on commit b5181e9

Please sign in to comment.