tscoverage/dist/npmts.cli.js

75 lines
2.8 KiB
JavaScript
Raw Normal View History

2016-10-06 19:03:30 +00:00
"use strict";
2017-02-27 21:19:14 +00:00
Object.defineProperty(exports, "__esModule", { value: true });
2017-01-17 23:58:09 +00:00
const q = require("smartq");
2016-10-06 19:03:30 +00:00
const plugins = require("./npmts.plugins");
const paths = require("./npmts.paths");
2016-10-21 15:48:52 +00:00
const NpmtsConfig = require("./npmts.config");
const NpmtsMods = require("./npmts.mods");
const NpmtsWatch = require("./npmts.watch");
const NpmtsShip = require("./npmts.ship");
2017-04-17 12:55:35 +00:00
/**
* smartanalytics
* this data is fully anonymized (no Ips or any other personal information is tracked).
* It just keeps track which of our tools are really used...
* ... so we know where to spend our limited resources for improving them.
* Since yarn is out and there is heavy caching going on,
* pure download stats are just not reliable enough for us anymore
* Feel free to dig into the smartanalytics package, if you are interested in how it works.
* It is just an https call to Google Analytics.
* Our privacy policy can be found here: https://lossless.gmbh/privacy.html
*/
2017-04-17 13:03:59 +00:00
let npmtsAnalytics = new plugins.smartanalytics.AnalyticsAccount('npmts', 'UA-64087619-5');
npmtsAnalytics.sendEvent('npm', 'exec', 'git.zone');
2016-10-06 19:03:30 +00:00
exports.run = () => {
let done = q.defer();
let npmtsProjectInfo = new plugins.projectinfo.ProjectinfoNpm(paths.npmtsPackageRoot);
2017-08-16 17:13:01 +00:00
// check for updates
plugins.smartupdate.standardHandler.check('npmts', npmtsProjectInfo.version);
2016-10-06 19:03:30 +00:00
let npmtsCli = new plugins.smartcli.Smartcli();
npmtsCli.standardTask()
.then((argvArg) => {
plugins.beautylog.figletSync('NPMTS');
plugins.beautylog.info('npmts version: ' + npmtsProjectInfo.version);
2016-10-21 15:48:52 +00:00
return NpmtsConfig.run(argvArg);
})
.then((configArg) => {
let done = q.defer();
2017-01-21 22:23:00 +00:00
plugins.beautylog.ora.start('loading additional modules...');
2016-10-21 15:48:52 +00:00
NpmtsMods.mod00.load()
.then((mod00) => {
return mod00.run(configArg);
})
.then(configArg => {
let done = q.defer();
NpmtsMods.mod01.load()
.then(mod01 => {
return mod01.run(configArg);
})
.then(configArg => {
done.resolve(configArg);
});
return done.promise;
})
.then(configArg => {
let done = q.defer();
NpmtsMods.mod02.load()
.then(mod02 => {
return mod02.run(configArg);
})
.then(configArg => {
done.resolve(configArg);
});
return done.promise;
})
.then(NpmtsWatch.run)
.then(NpmtsShip.run);
return done.promise;
})
2016-10-21 23:34:07 +00:00
.catch((err) => { if (err instanceof Error) {
console.log(err);
} });
2016-10-06 19:03:30 +00:00
npmtsCli.addVersion(npmtsProjectInfo.version);
npmtsCli.startParse();
return done.promise;
};