mirror of
https://github.com/knex/knex.git
synced 2025-12-27 15:08:47 +00:00
Moving bin/cli outside of src to allow install from master
This commit is contained in:
parent
48a2ee1648
commit
d1a55a907d
@ -1,5 +1,5 @@
|
||||
|
||||
# 0.12.0 - (unreleased)
|
||||
# 0.12.0 - 13 Sep, 2016
|
||||
|
||||
- Remove build / built files, #1616
|
||||
- Upgrade to Babel 6, #1617
|
||||
@ -9,6 +9,7 @@
|
||||
- Oracle id sequence now handles manual inserts, #906
|
||||
- Cleanup PG escaping, fix #1602, #1548
|
||||
- Pool2 error event is left unhandled, allowing the server to crash and restart rather than end up in a bad state
|
||||
- Added [`with`](#Builder-with) to builder for [common table expressions](https://www.postgresql.org/docs/9.4/static/queries-with.html), #1599
|
||||
|
||||
# 0.11.10 - 9 Aug, 2016
|
||||
|
||||
|
||||
@ -1,16 +1,15 @@
|
||||
#!/usr/bin/env node
|
||||
/* eslint no-console:0 */
|
||||
|
||||
import Liftoff from 'liftoff';
|
||||
import Promise from 'bluebird';
|
||||
import interpret from 'interpret';
|
||||
import path from 'path';
|
||||
import chalk from 'chalk';
|
||||
import tildify from 'tildify';
|
||||
import commander from 'commander';
|
||||
const argv = require('minimist')(process.argv.slice(2));
|
||||
const fs = Promise.promisifyAll(require('fs'));
|
||||
const cliPkg = require('../../package');
|
||||
/* eslint no-console:0, no-var:0 */
|
||||
var Liftoff = require('liftoff');
|
||||
var Promise = require('bluebird');
|
||||
var interpret = require('interpret');
|
||||
var path = require('path');
|
||||
var chalk = require('chalk');
|
||||
var tildify = require('tildify');
|
||||
var commander = require('commander');
|
||||
var argv = require('minimist')(process.argv.slice(2));
|
||||
var fs = Promise.promisifyAll(require('fs'));
|
||||
var cliPkg = require('../package');
|
||||
|
||||
function exit(text) {
|
||||
if (text instanceof Error) {
|
||||
@ -46,9 +45,9 @@ function initKnex(env) {
|
||||
console.log('Working directory changed to', chalk.magenta(tildify(env.cwd)));
|
||||
}
|
||||
|
||||
let environment = commander.env || process.env.NODE_ENV;
|
||||
const defaultEnv = 'development';
|
||||
let config = require(env.configPath);
|
||||
var environment = commander.env || process.env.NODE_ENV;
|
||||
var defaultEnv = 'development';
|
||||
var config = require(env.configPath);
|
||||
|
||||
if (!environment && typeof config[defaultEnv] === 'object') {
|
||||
environment = defaultEnv;
|
||||
@ -66,14 +65,14 @@ function initKnex(env) {
|
||||
|
||||
if (argv.debug !== undefined)
|
||||
config.debug = argv.debug;
|
||||
const knex = require(env.modulePath);
|
||||
var knex = require(env.modulePath);
|
||||
return knex(config);
|
||||
}
|
||||
|
||||
function invoke(env) {
|
||||
|
||||
const filetypes = ['js', 'coffee', 'eg', 'ls'];
|
||||
let pending = null;
|
||||
var filetypes = ['js', 'coffee', 'eg', 'ls'];
|
||||
var pending = null;
|
||||
|
||||
commander
|
||||
.version(
|
||||
@ -91,7 +90,7 @@ function invoke(env) {
|
||||
.description(' Create a fresh knexfile.')
|
||||
.option(`-x [${filetypes.join('|')}]`, 'Specify the knexfile extension (default js)')
|
||||
.action(function() {
|
||||
const type = (argv.x || 'js').toLowerCase();
|
||||
var type = (argv.x || 'js').toLowerCase();
|
||||
if (filetypes.indexOf(type) === -1) {
|
||||
exit(`Invalid filetype specified: ${type}`);
|
||||
}
|
||||
@ -99,12 +98,12 @@ function invoke(env) {
|
||||
exit(`Error: ${env.configPath} already exists`);
|
||||
}
|
||||
checkLocalModule(env);
|
||||
const stubPath = `./knexfile.${type}`;
|
||||
var stubPath = `./knexfile.${type}`;
|
||||
pending = fs.readFileAsync(
|
||||
path.dirname(env.modulePath) +
|
||||
'/lib/migrate/stub/knexfile-' +
|
||||
type + '.stub'
|
||||
).then(code => fs.writeFileAsync(stubPath, code)).then(() => {
|
||||
).then(function(code) { return fs.writeFileAsync(stubPath, code) }).then(function() {
|
||||
success(chalk.green(`Created ${stubPath}`));
|
||||
}).catch(exit);
|
||||
});
|
||||
@ -114,8 +113,8 @@ function invoke(env) {
|
||||
.description(' Create a named migration file.')
|
||||
.option(`-x [${filetypes.join('|')}]`, 'Specify the stub extension (default js)')
|
||||
.action(function(name) {
|
||||
const instance = initKnex(env);
|
||||
const ext = (argv.x || env.configPath.split('.').pop()).toLowerCase();
|
||||
var instance = initKnex(env);
|
||||
var ext = (argv.x || env.configPath.split('.').pop()).toLowerCase();
|
||||
pending = instance.migrate.make(name, {extension: ext}).then(function(name) {
|
||||
success(chalk.green(`Created Migration: ${name}`));
|
||||
}).catch(exit);
|
||||
@ -165,8 +164,8 @@ function invoke(env) {
|
||||
.description(' Create a named seed file.')
|
||||
.option(`-x [${filetypes.join('|')}]`, 'Specify the stub extension (default js)')
|
||||
.action(function(name) {
|
||||
const instance = initKnex(env);
|
||||
const ext = (argv.x || env.configPath.split('.').pop()).toLowerCase();
|
||||
var instance = initKnex(env);
|
||||
var ext = (argv.x || env.configPath.split('.').pop()).toLowerCase();
|
||||
pending = instance.seed.make(name, {extension: ext}).then(function(name) {
|
||||
success(chalk.green(`Created seed file: ${name}`));
|
||||
}).catch(exit);
|
||||
@ -191,7 +190,7 @@ function invoke(env) {
|
||||
});
|
||||
}
|
||||
|
||||
const cli = new Liftoff({
|
||||
var cli = new Liftoff({
|
||||
name: 'knex',
|
||||
extensions: interpret.jsVariants,
|
||||
v8flags: require('v8flags')
|
||||
@ -67,7 +67,7 @@
|
||||
"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"
|
||||
"knex": "./bin/cli.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -106,6 +106,7 @@
|
||||
"files": [
|
||||
"CONTRIBUTING.md",
|
||||
"README.md",
|
||||
"bin/*",
|
||||
"src/*",
|
||||
"lib/*",
|
||||
"knex.js",
|
||||
|
||||
@ -34,12 +34,4 @@ git tag $next_version
|
||||
git push origin master
|
||||
git push origin master --tags
|
||||
|
||||
echo "# Publishing docs"
|
||||
|
||||
git checkout gh-pages
|
||||
git reset --hard origin/gh-pages
|
||||
git merge master
|
||||
git push origin gh-pages
|
||||
git checkout master
|
||||
|
||||
npm publish
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user