diff --git a/dist/index.js b/dist/index.js index c517b51..c82050e 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1,18 +1,26 @@ "use strict"; require("typings-global"); -// start early and load modules +/* ================================================== * + Starting NPMTS main process. + * ================================================== */ var early = require("early"); early.start("NPMTS"); var plugins = require("./npmts.plugins"); var paths = require("./npmts.paths"); var npmts_promisechain_1 = require("./npmts.promisechain"); early.stop(); -plugins.beautylog.figletSync("NPMTS"); -var projectInfo = new plugins.projectinfo.ProjectinfoNpm(paths.npmtsPackageRoot); -plugins.beautylog.info("npmts version: " + projectInfo.version); -try { - npmts_promisechain_1.promisechain(); -} -catch (err) { - console.log(err); -} +var npmtsProjectInfo = new plugins.projectinfo.ProjectinfoNpm(paths.npmtsPackageRoot); +var npmtsCli = new plugins.smartcli.Smartcli(); +npmtsCli.standardTask() + .then(function () { + plugins.beautylog.figletSync("NPMTS"); + plugins.beautylog.info("npmts version: " + npmtsProjectInfo.version); + try { + npmts_promisechain_1.promisechain(); + } + catch (err) { + console.log(err); + } +}); +npmtsCli.addVersion(npmtsProjectInfo.version); +npmtsCli.startParse(); diff --git a/dist/npmts.options.js b/dist/npmts.options.js index c956420..57e0825 100644 --- a/dist/npmts.options.js +++ b/dist/npmts.options.js @@ -5,19 +5,6 @@ var npmts_promisechain_1 = require("./npmts.promisechain"); exports.isCi = function () { return plugins.smartci.check.isCi(); }; -exports.isRelease = function () { - return plugins.smartci.check.isCi() - && plugins.smartci.check.isTaggedCommit(); -}; -exports.doPublish = function () { - try { - return exports.isRelease() - && plugins.smartci.get.subJobNumber() == 1; - } - catch (err) { - return false; - } -}; exports.run = function (configArg) { var done = plugins.Q.defer(); var config = configArg; @@ -39,16 +26,9 @@ exports.run = function (configArg) { } //check if config.tsOptions is available config.tsOptions ? void (0) : config.tsOptions = {}; - // handle state of current build - exports.isRelease() ? plugins.beautylog.info("All right: This is a RELEASE build!") - : plugins.beautylog.info("NOT A RELEASE build!"); - exports.isRelease() && exports.doPublish() ? plugins.beautylog.info("All right: This is the first subBuild, so this one publishes COVERAGE + DOCS when tests succeed!") - : plugins.beautylog.info("We are not publishing anything!"); config.coverageTreshold ? void (0) : config.coverageTreshold = 70; // handle docs config.docs ? void (0) : config.docs = {}; - config.docs.publish ? void (0) : config.docs.publish = false; - exports.doPublish() ? void (0) : config.docs.publish = false; plugins.beautylog.ok("build options are ready!"); done.resolve(config); return done.promise; diff --git a/dist/npmts.paths.js b/dist/npmts.paths.js index 234c656..0b81540 100644 --- a/dist/npmts.paths.js +++ b/dist/npmts.paths.js @@ -4,7 +4,7 @@ var plugins = require("./npmts.plugins"); //Npmts Paths exports.npmtsPackageRoot = plugins.path.join(__dirname, "../"); //Project paths -exports.cwd = plugins.smartcli.get.cwd().path; +exports.cwd = process.cwd(); //Directories exports.tsDir = plugins.path.join(exports.cwd, "ts/"); exports.distDir = plugins.path.join(exports.cwd, "dist/"); diff --git a/dist/npmts.promisechain.js b/dist/npmts.promisechain.js index 27f6872..086e409 100644 --- a/dist/npmts.promisechain.js +++ b/dist/npmts.promisechain.js @@ -2,7 +2,6 @@ require("typings-global"); var plugins = require("./npmts.plugins"); exports.npmtsOra = new plugins.beautylog.Ora("setting up TaskChain", "cyan"); -exports.npmtsOra.start(); var NpmtsAssets = require("./npmts.assets"); var NpmtsClean = require("./npmts.clean"); var NpmtsCompile = require("./npmts.compile"); @@ -14,6 +13,7 @@ var NpmtsPublish = require("./npmts.publish"); var NpmtsTests = require("./npmts.tests"); exports.promisechain = function () { var done = plugins.Q.defer(); + exports.npmtsOra.start(); NpmtsConfigFile.run() .then(NpmtsOptions.run) .then(NpmtsClean.run) diff --git a/package.json b/package.json index 58e1efe..fc03429 100644 --- a/package.json +++ b/package.json @@ -7,8 +7,9 @@ "npmts": "dist/cli.js" }, "scripts": { - "test": "(npm run compile && npm run check)", + "test": "(npm run compile && npm run check && npm run checkVersion)", "check": "(cd ./test/assets && node ../../dist/index.js)", + "checkVersion":"cd ./test/assets && node ../../dist/index.js -v", "compile": "(cd compile && node compile.js)" }, "repository": { @@ -27,7 +28,7 @@ "homepage": "https://gitlab.com/pushrocks/npmts#readme", "dependencies": { "beautylog": "5.0.8", - "early": "^2.0.1", + "early": "^2.0.7", "fs-extra": "^0.30.0", "gulp": "3.9.1", "gulp-concat": "^2.6.0", @@ -46,7 +47,7 @@ "q": "^1.4.1", "shelljs": "^0.7.0", "smartci": "0.0.1", - "smartcli": "0.0.11", + "smartcli": "1.0.1", "smartcov": "0.0.6", "smartenv": "1.2.5", "smartfile": "3.0.10", diff --git a/ts/index.ts b/ts/index.ts index 98d3552..2c64fe4 100644 --- a/ts/index.ts +++ b/ts/index.ts @@ -1,6 +1,8 @@ import "typings-global"; -// start early and load modules +/* ================================================== * + Starting NPMTS main process. + * ================================================== */ import * as early from "early"; early.start("NPMTS"); import * as plugins from "./npmts.plugins" @@ -8,14 +10,20 @@ import * as paths from "./npmts.paths"; import {promisechain} from "./npmts.promisechain"; early.stop(); -plugins.beautylog.figletSync("NPMTS"); -let projectInfo = new plugins.projectinfo.ProjectinfoNpm(paths.npmtsPackageRoot); -plugins.beautylog.info("npmts version: " + projectInfo.version); +let npmtsProjectInfo = new plugins.projectinfo.ProjectinfoNpm(paths.npmtsPackageRoot); -try { - promisechain(); -} -catch(err){ - console.log(err); -} +let npmtsCli = new plugins.smartcli.Smartcli(); +npmtsCli.standardTask() + .then(() => { + plugins.beautylog.figletSync("NPMTS"); + plugins.beautylog.info("npmts version: " + npmtsProjectInfo.version); + try { + promisechain(); + } + catch(err){ + console.log(err); + } + }); +npmtsCli.addVersion(npmtsProjectInfo.version); +npmtsCli.startParse(); \ No newline at end of file diff --git a/ts/npmts.options.ts b/ts/npmts.options.ts index 27ad6d5..dfa87d2 100644 --- a/ts/npmts.options.ts +++ b/ts/npmts.options.ts @@ -6,21 +6,6 @@ export let isCi = function(){ return plugins.smartci.check.isCi(); }; -export let isRelease = function():boolean { - return plugins.smartci.check.isCi() - && plugins.smartci.check.isTaggedCommit(); -}; - -export let doPublish = function():boolean { - try { - return isRelease() - && plugins.smartci.get.subJobNumber() == 1; - } - catch (err){ - return false; - } -}; - export var run = function(configArg){ var done = plugins.Q.defer(); var config = configArg; @@ -44,21 +29,12 @@ export var run = function(configArg){ //check if config.tsOptions is available config.tsOptions ? void(0) : config.tsOptions = {}; - // handle state of current build - - isRelease() ? plugins.beautylog.info("All right: This is a RELEASE build!") - : plugins.beautylog.info("NOT A RELEASE build!"); - isRelease() && doPublish() ? plugins.beautylog.info("All right: This is the first subBuild, so this one publishes COVERAGE + DOCS when tests succeed!") - : plugins.beautylog.info("We are not publishing anything!"); - config.coverageTreshold ? void(0) : config.coverageTreshold = 70; // handle docs config.docs ? void(0) : config.docs = {}; - config.docs.publish ? void(0) : config.docs.publish = false; - doPublish() ? void(0) : config.docs.publish = false; plugins.beautylog.ok("build options are ready!"); done.resolve(config); diff --git a/ts/npmts.paths.ts b/ts/npmts.paths.ts index 2130de7..b41a429 100644 --- a/ts/npmts.paths.ts +++ b/ts/npmts.paths.ts @@ -6,7 +6,7 @@ export let npmtsPackageRoot = plugins.path.join(__dirname,"../"); //Project paths -export let cwd = plugins.smartcli.get.cwd().path; +export let cwd = process.cwd(); //Directories export let tsDir = plugins.path.join(cwd,"ts/"); diff --git a/ts/npmts.plugins.ts b/ts/npmts.plugins.ts index c0f96f7..b7e5be7 100644 --- a/ts/npmts.plugins.ts +++ b/ts/npmts.plugins.ts @@ -20,7 +20,7 @@ export let path = require("path"); export let Q = require("q"); export let shelljs = require("shelljs"); export let smartci = require("smartci"); -export let smartcli = require("smartcli"); +export import smartcli = require("smartcli"); export let smartcov = require("smartcov"); export import smartenv = require("smartenv"); export import smartfile = require("smartfile"); diff --git a/ts/npmts.promisechain.ts b/ts/npmts.promisechain.ts index 4afbf1d..8384c0b 100644 --- a/ts/npmts.promisechain.ts +++ b/ts/npmts.promisechain.ts @@ -2,7 +2,6 @@ import "typings-global"; import plugins = require("./npmts.plugins"); export let npmtsOra = new plugins.beautylog.Ora("setting up TaskChain","cyan"); -npmtsOra.start(); import NpmtsAssets = require("./npmts.assets"); import NpmtsClean = require("./npmts.clean"); @@ -16,6 +15,7 @@ import NpmtsTests = require("./npmts.tests"); export let promisechain = function(){ let done = plugins.Q.defer(); + npmtsOra.start(); NpmtsConfigFile.run() .then(NpmtsOptions.run) .then(NpmtsClean.run)