Update process for web script build

This commit is contained in:
Tim Griesser 2015-04-29 17:11:52 -04:00
parent ff76297506
commit c40b1339aa
13 changed files with 6247 additions and 9707 deletions

View File

@ -1,17 +0,0 @@
Master:
## Master Changes:
- Transactions are immediately invoked as A+ promises - #470
- Nested transactions automatically become savepoints,
with commit & rollback committing or rolling back to the savepoint
- Migrations are now wrapped in transactions where possible
- Using Pool2 in favor of generic-pool-redux
- Support for strong-oracle driver, #580
- Subqueries in insert statements, #627
- Allow mysql2 to use non-default port, #588
- Support creating & dropping extensions in PostgreSQL, #540
- Support for nested having, #572
- CLI support for knexfiles that do not provide environment keys, #527
- Added sqlite3 dialect version of whereRaw/andWhereRaw (#477).
- Support object syntax for joins, similar to "where" #743

File diff suppressed because it is too large Load Diff

View File

@ -21,6 +21,10 @@ assign(Client_MariaSQL.prototype, {
driverName: 'mariasql',
_driver: function() {
return require('mariasql')
},
// Get a raw connection, called by the `pool` whenever a new
// connection needs to be added to the pool.
acquireRawConnection: function() {

View File

@ -29,6 +29,10 @@ assign(Client_MySQL.prototype, {
driverName: 'mysql',
_driver: function() {
return require('mysql')
},
QueryCompiler: QueryCompiler,
SchemaCompiler: SchemaCompiler,

View File

@ -25,6 +25,10 @@ assign(Client_MySQL2.prototype, {
// The "dialect", for reference elsewhere.
driverName: 'mysql2',
_driver: function() {
return require('mysql2')
},
// Get a raw connection, called by the `pool` whenever a new
// connection needs to be added to the pool.
acquireRawConnection: function() {

View File

@ -35,6 +35,10 @@ assign(Client_Oracle.prototype, {
driverName: 'oracle',
_driver: function() {
return require('oracle')
},
Transaction: Transaction,
Formatter: Formatter,

View File

@ -37,6 +37,10 @@ assign(Client_PG.prototype, {
driverName: 'pg',
_driver: function() {
return require('pg')
},
wrapIdentifier: function(value) {
if (value === '*') return value;
var matched = value.match(/(.*?)(\[[0-9]\])/);

View File

@ -28,6 +28,10 @@ assign(Client_SQLite3.prototype, {
driverName: 'sqlite3',
_driver: function() {
return require('sqlite3')
},
SchemaCompiler: SchemaCompiler,
QueryCompiler: QueryCompiler,

View File

@ -11,13 +11,8 @@ function Client_StrongOracle() {
}
inherits(Client_StrongOracle, Client_Oracle);
Client_StrongOracle.prototype.initializeDriver = function() {
try {
this.driver = require(this.driverName)()
} catch (e) {
console.log(e)
helpers.exit('Knex: run\n$ npm install ' + this.driverName + ' --save')
}
Client_StrongOracle.prototype._driver = function() {
return require('strong-oracle')()
}
Client_StrongOracle.prototype.driverName = 'strong-oracle'

View File

@ -19,7 +19,7 @@ function makeClient(trx, client) {
var trxClient = Object.create(client.constructor.prototype)
trxClient.config = client.config
trxClient.connectionSettings = connectionSettings
trxClient.connectionSettings = client.connectionSettings
trxClient.transacting = true
trxClient.on('query', function(arg) {

View File

@ -52,9 +52,8 @@
"webpack": "^1.8.9"
},
"scripts": {
"tape": "tape ./test/tape/index.js",
"build": "gulp build",
"plaintest": "mocha --check-leaks -t 10000 -b -R spec test/index.js && npm run tape",
"plaintest": "mocha --check-leaks -t 10000 -b -R spec test/index.js && node test/tape/index.js && gulp jshint",
"test": "istanbul --config=test/.istanbul.yml cover _mocha -- --check-leaks -t 5000 -b -R spec test/index.js && npm run tape && npm run jshint",
"coveralls": "cat ./test/coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
"jshint": "gulp jshint",
@ -80,11 +79,19 @@
"web": "https://github.com/tgriesser"
},
"browser": {
"pg-query-stream": false,
"bluebird/js/main/promise": "./lib/util/bluebird.js",
"./lib/migrate/index.js": "./lib/migrate/index.web.js",
"./lib/bin/cli.js": "lodash/utility/noop",
"./lib/seed/index.js": "lodash/utility/noop"
"./lib/migrate/index.js": "lodash/utility/noop",
"./lib/bin/cli.js": "lodash/utility/noop",
"./lib/seed/index.js": "lodash/utility/noop",
"pool2": "lodash/utility/noop",
"mysql": false,
"mysql2": false,
"mariasql": false,
"pg": false,
"pg-query-stream":false,
"oracle": false,
"strong-oracle": false,
"sqlite3": false
},
"files": [
"README.md",

17
scripts/build.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash -e
webpack=node_modules/.bin/webpack
rm -rf tmp
mkdir tmp
rm -rf build
mkdir build
cp -r lib tmp/lib
cp knex.js tmp
node -p 'p=require("./package");p.main="lib";p.scripts=p.devDependencies=undefined;JSON.stringify(p,null,2)' > tmp/package.json
$webpack --config scripts/webpack.config.js tmp build/knex.js
rm -rf tmp

30
scripts/webpack.config.js Normal file
View File

@ -0,0 +1,30 @@
var webpack = require('webpack');
var plugins = []
var externals = [{
"bluebird": {
root: "Promise",
commonjs2: "bluebird",
commonjs: "bluebird",
amd: "bluebird"
},
"lodash": {
root: "_",
commonjs2: "lodash",
commonjs: "lodash",
amd: "lodash"
}
}]
module.exports = {
output: {
library: 'Knex',
libraryTarget: 'umd'
},
externals: externals,
plugins: plugins
};