moved cli into its own file

This commit is contained in:
Philipp Kunz 2016-10-06 21:03:30 +02:00
parent d7b08034da
commit 69742fd6a7
7 changed files with 48 additions and 28 deletions

View File

@ -1,2 +1,2 @@
#!/usr/bin/env node #!/usr/bin/env node
var index = require("../dist/index.js"); var index = require("../dist/index.js");

2
dist/cli.js vendored
View File

@ -1,2 +0,0 @@
#!/usr/bin/env node
var index = require("../{{pathToIndex}}");

15
dist/index.js vendored
View File

@ -6,18 +6,9 @@
const early = require("early"); const early = require("early");
early.start('NPMTS'); early.start('NPMTS');
const plugins = require("./npmts.plugins"); const plugins = require("./npmts.plugins");
const paths = require("./npmts.paths"); const cli = require("./npmts.cli");
const promisechain = require("./npmts.promisechain");
early.stop() early.stop()
.then(() => { .then(() => {
let npmtsProjectInfo = new plugins.projectinfo.ProjectinfoNpm(paths.npmtsPackageRoot); let loaded = plugins; // to make sure plugins get actually loaded
let npmtsCli = new plugins.smartcli.Smartcli(); cli.run();
npmtsCli.standardTask()
.then((argvArg) => {
plugins.beautylog.figletSync('NPMTS');
plugins.beautylog.info('npmts version: ' + npmtsProjectInfo.version);
promisechain.run(argvArg).catch((err) => { console.log(err); });
});
npmtsCli.addVersion(npmtsProjectInfo.version);
npmtsCli.startParse();
}); });

3
dist/npmts.cli.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
/// <reference types="q" />
import * as q from 'q';
export declare let run: () => q.Promise<{}>;

19
dist/npmts.cli.js vendored Normal file
View File

@ -0,0 +1,19 @@
"use strict";
const plugins = require("./npmts.plugins");
const paths = require("./npmts.paths");
const promisechain = require("./npmts.promisechain");
const q = require("q");
exports.run = () => {
let done = q.defer();
let npmtsProjectInfo = new plugins.projectinfo.ProjectinfoNpm(paths.npmtsPackageRoot);
let npmtsCli = new plugins.smartcli.Smartcli();
npmtsCli.standardTask()
.then((argvArg) => {
plugins.beautylog.figletSync('NPMTS');
plugins.beautylog.info('npmts version: ' + npmtsProjectInfo.version);
promisechain.run(argvArg).catch((err) => { console.log(err); });
});
npmtsCli.addVersion(npmtsProjectInfo.version);
npmtsCli.startParse();
return done.promise;
};

View File

@ -6,19 +6,9 @@
import * as early from 'early' import * as early from 'early'
early.start('NPMTS') early.start('NPMTS')
import * as plugins from './npmts.plugins' import * as plugins from './npmts.plugins'
import * as paths from './npmts.paths' import * as cli from './npmts.cli'
import * as promisechain from './npmts.promisechain'
early.stop() early.stop()
.then(() => { .then(() => {
let npmtsProjectInfo = new plugins.projectinfo.ProjectinfoNpm(paths.npmtsPackageRoot) let loaded = plugins // to make sure plugins get actually loaded
let npmtsCli = new plugins.smartcli.Smartcli() cli.run()
npmtsCli.standardTask()
.then((argvArg) => {
plugins.beautylog.figletSync('NPMTS')
plugins.beautylog.info('npmts version: ' + npmtsProjectInfo.version)
promisechain.run(argvArg).catch((err) => { console.log(err) })
})
npmtsCli.addVersion(npmtsProjectInfo.version)
npmtsCli.startParse()
}) })

19
ts/npmts.cli.ts Normal file
View File

@ -0,0 +1,19 @@
import * as plugins from './npmts.plugins'
import * as paths from './npmts.paths'
import * as promisechain from './npmts.promisechain'
import * as q from 'q'
export let run = () => {
let done = q.defer()
let npmtsProjectInfo = new plugins.projectinfo.ProjectinfoNpm(paths.npmtsPackageRoot)
let npmtsCli = new plugins.smartcli.Smartcli()
npmtsCli.standardTask()
.then((argvArg) => {
plugins.beautylog.figletSync('NPMTS')
plugins.beautylog.info('npmts version: ' + npmtsProjectInfo.version)
promisechain.run(argvArg).catch((err) => { console.log(err) })
})
npmtsCli.addVersion(npmtsProjectInfo.version)
npmtsCli.startParse()
return done.promise
}