ready for npmts-g

This commit is contained in:
Philipp Kunz 2016-06-10 06:14:12 +02:00
parent 3df47307a3
commit 7f4d72f0d6
10 changed files with 45 additions and 72 deletions

28
dist/index.js vendored
View File

@ -1,18 +1,26 @@
"use strict"; "use strict";
require("typings-global"); require("typings-global");
// start early and load modules /* ================================================== *
Starting NPMTS main process.
* ================================================== */
var early = require("early"); var early = require("early");
early.start("NPMTS"); early.start("NPMTS");
var plugins = require("./npmts.plugins"); var plugins = require("./npmts.plugins");
var paths = require("./npmts.paths"); var paths = require("./npmts.paths");
var npmts_promisechain_1 = require("./npmts.promisechain"); var npmts_promisechain_1 = require("./npmts.promisechain");
early.stop(); early.stop();
plugins.beautylog.figletSync("NPMTS"); var npmtsProjectInfo = new plugins.projectinfo.ProjectinfoNpm(paths.npmtsPackageRoot);
var projectInfo = new plugins.projectinfo.ProjectinfoNpm(paths.npmtsPackageRoot); var npmtsCli = new plugins.smartcli.Smartcli();
plugins.beautylog.info("npmts version: " + projectInfo.version); npmtsCli.standardTask()
try { .then(function () {
npmts_promisechain_1.promisechain(); plugins.beautylog.figletSync("NPMTS");
} plugins.beautylog.info("npmts version: " + npmtsProjectInfo.version);
catch (err) { try {
console.log(err); npmts_promisechain_1.promisechain();
} }
catch (err) {
console.log(err);
}
});
npmtsCli.addVersion(npmtsProjectInfo.version);
npmtsCli.startParse();

20
dist/npmts.options.js vendored
View File

@ -5,19 +5,6 @@ var npmts_promisechain_1 = require("./npmts.promisechain");
exports.isCi = function () { exports.isCi = function () {
return plugins.smartci.check.isCi(); 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) { exports.run = function (configArg) {
var done = plugins.Q.defer(); var done = plugins.Q.defer();
var config = configArg; var config = configArg;
@ -39,16 +26,9 @@ exports.run = function (configArg) {
} }
//check if config.tsOptions is available //check if config.tsOptions is available
config.tsOptions ? void (0) : config.tsOptions = {}; 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; config.coverageTreshold ? void (0) : config.coverageTreshold = 70;
// handle docs // handle docs
config.docs ? void (0) : config.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!"); plugins.beautylog.ok("build options are ready!");
done.resolve(config); done.resolve(config);
return done.promise; return done.promise;

2
dist/npmts.paths.js vendored
View File

@ -4,7 +4,7 @@ var plugins = require("./npmts.plugins");
//Npmts Paths //Npmts Paths
exports.npmtsPackageRoot = plugins.path.join(__dirname, "../"); exports.npmtsPackageRoot = plugins.path.join(__dirname, "../");
//Project paths //Project paths
exports.cwd = plugins.smartcli.get.cwd().path; exports.cwd = process.cwd();
//Directories //Directories
exports.tsDir = plugins.path.join(exports.cwd, "ts/"); exports.tsDir = plugins.path.join(exports.cwd, "ts/");
exports.distDir = plugins.path.join(exports.cwd, "dist/"); exports.distDir = plugins.path.join(exports.cwd, "dist/");

View File

@ -2,7 +2,6 @@
require("typings-global"); require("typings-global");
var plugins = require("./npmts.plugins"); var plugins = require("./npmts.plugins");
exports.npmtsOra = new plugins.beautylog.Ora("setting up TaskChain", "cyan"); exports.npmtsOra = new plugins.beautylog.Ora("setting up TaskChain", "cyan");
exports.npmtsOra.start();
var NpmtsAssets = require("./npmts.assets"); var NpmtsAssets = require("./npmts.assets");
var NpmtsClean = require("./npmts.clean"); var NpmtsClean = require("./npmts.clean");
var NpmtsCompile = require("./npmts.compile"); var NpmtsCompile = require("./npmts.compile");
@ -14,6 +13,7 @@ var NpmtsPublish = require("./npmts.publish");
var NpmtsTests = require("./npmts.tests"); var NpmtsTests = require("./npmts.tests");
exports.promisechain = function () { exports.promisechain = function () {
var done = plugins.Q.defer(); var done = plugins.Q.defer();
exports.npmtsOra.start();
NpmtsConfigFile.run() NpmtsConfigFile.run()
.then(NpmtsOptions.run) .then(NpmtsOptions.run)
.then(NpmtsClean.run) .then(NpmtsClean.run)

View File

@ -7,8 +7,9 @@
"npmts": "dist/cli.js" "npmts": "dist/cli.js"
}, },
"scripts": { "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)", "check": "(cd ./test/assets && node ../../dist/index.js)",
"checkVersion":"cd ./test/assets && node ../../dist/index.js -v",
"compile": "(cd compile && node compile.js)" "compile": "(cd compile && node compile.js)"
}, },
"repository": { "repository": {
@ -27,7 +28,7 @@
"homepage": "https://gitlab.com/pushrocks/npmts#readme", "homepage": "https://gitlab.com/pushrocks/npmts#readme",
"dependencies": { "dependencies": {
"beautylog": "5.0.8", "beautylog": "5.0.8",
"early": "^2.0.1", "early": "^2.0.7",
"fs-extra": "^0.30.0", "fs-extra": "^0.30.0",
"gulp": "3.9.1", "gulp": "3.9.1",
"gulp-concat": "^2.6.0", "gulp-concat": "^2.6.0",
@ -46,7 +47,7 @@
"q": "^1.4.1", "q": "^1.4.1",
"shelljs": "^0.7.0", "shelljs": "^0.7.0",
"smartci": "0.0.1", "smartci": "0.0.1",
"smartcli": "0.0.11", "smartcli": "1.0.1",
"smartcov": "0.0.6", "smartcov": "0.0.6",
"smartenv": "1.2.5", "smartenv": "1.2.5",
"smartfile": "3.0.10", "smartfile": "3.0.10",

View File

@ -1,6 +1,8 @@
import "typings-global"; import "typings-global";
// start early and load modules /* ================================================== *
Starting NPMTS main process.
* ================================================== */
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"
@ -8,14 +10,20 @@ import * as paths from "./npmts.paths";
import {promisechain} from "./npmts.promisechain"; import {promisechain} from "./npmts.promisechain";
early.stop(); early.stop();
plugins.beautylog.figletSync("NPMTS"); let npmtsProjectInfo = new plugins.projectinfo.ProjectinfoNpm(paths.npmtsPackageRoot);
let projectInfo = new plugins.projectinfo.ProjectinfoNpm(paths.npmtsPackageRoot);
plugins.beautylog.info("npmts version: " + projectInfo.version);
try { let npmtsCli = new plugins.smartcli.Smartcli();
promisechain(); npmtsCli.standardTask()
} .then(() => {
catch(err){ plugins.beautylog.figletSync("NPMTS");
console.log(err); plugins.beautylog.info("npmts version: " + npmtsProjectInfo.version);
} try {
promisechain();
}
catch(err){
console.log(err);
}
});
npmtsCli.addVersion(npmtsProjectInfo.version);
npmtsCli.startParse();

View File

@ -6,21 +6,6 @@ export let isCi = function(){
return plugins.smartci.check.isCi(); 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){ export var run = function(configArg){
var done = plugins.Q.defer(); var done = plugins.Q.defer();
var config = configArg; var config = configArg;
@ -44,21 +29,12 @@ export var run = function(configArg){
//check if config.tsOptions is available //check if config.tsOptions is available
config.tsOptions ? void(0) : config.tsOptions = {}; 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; config.coverageTreshold ? void(0) : config.coverageTreshold = 70;
// handle docs // handle docs
config.docs ? void(0) : config.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!"); plugins.beautylog.ok("build options are ready!");
done.resolve(config); done.resolve(config);

View File

@ -6,7 +6,7 @@ export let npmtsPackageRoot = plugins.path.join(__dirname,"../");
//Project paths //Project paths
export let cwd = plugins.smartcli.get.cwd().path; export let cwd = process.cwd();
//Directories //Directories
export let tsDir = plugins.path.join(cwd,"ts/"); export let tsDir = plugins.path.join(cwd,"ts/");

View File

@ -20,7 +20,7 @@ export let path = require("path");
export let Q = require("q"); export let Q = require("q");
export let shelljs = require("shelljs"); export let shelljs = require("shelljs");
export let smartci = require("smartci"); export let smartci = require("smartci");
export let smartcli = require("smartcli"); export import smartcli = require("smartcli");
export let smartcov = require("smartcov"); export let smartcov = require("smartcov");
export import smartenv = require("smartenv"); export import smartenv = require("smartenv");
export import smartfile = require("smartfile"); export import smartfile = require("smartfile");

View File

@ -2,7 +2,6 @@ import "typings-global";
import plugins = require("./npmts.plugins"); import plugins = require("./npmts.plugins");
export let npmtsOra = new plugins.beautylog.Ora("setting up TaskChain","cyan"); export let npmtsOra = new plugins.beautylog.Ora("setting up TaskChain","cyan");
npmtsOra.start();
import NpmtsAssets = require("./npmts.assets"); import NpmtsAssets = require("./npmts.assets");
import NpmtsClean = require("./npmts.clean"); import NpmtsClean = require("./npmts.clean");
@ -16,6 +15,7 @@ import NpmtsTests = require("./npmts.tests");
export let promisechain = function(){ export let promisechain = function(){
let done = plugins.Q.defer(); let done = plugins.Q.defer();
npmtsOra.start();
NpmtsConfigFile.run() NpmtsConfigFile.run()
.then(NpmtsOptions.run) .then(NpmtsOptions.run)
.then(NpmtsClean.run) .then(NpmtsClean.run)