Compare commits
13 Commits
Author | SHA1 | Date | |
---|---|---|---|
c4faa56d0d | |||
20ad0d0b38 | |||
5221d3ee84 | |||
1f50f54fe9 | |||
12199a668e | |||
82df431adf | |||
71f0a9d37f | |||
5f16cdd830 | |||
966cb88c82 | |||
7f4d72f0d6 | |||
3df47307a3 | |||
e3b84af278 | |||
a6c4a99d82 |
@ -1,8 +1,9 @@
|
|||||||
image: hosttoday/ht-docker-node:npmci
|
image: hosttoday/ht-docker-node:npmts
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- test
|
- test
|
||||||
- release
|
- release
|
||||||
|
- trigger
|
||||||
- page
|
- page
|
||||||
|
|
||||||
testLEGACY:
|
testLEGACY:
|
||||||
@ -35,6 +36,15 @@ release:
|
|||||||
- tags
|
- tags
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
stage: trigger
|
||||||
|
script:
|
||||||
|
- npmci trigger
|
||||||
|
only:
|
||||||
|
- tags
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
|
||||||
pages:
|
pages:
|
||||||
stage: page
|
stage: page
|
||||||
|
15
README.md
15
README.md
@ -17,13 +17,14 @@ There is a docker image available that includes npmts to make CI a breeze:
|
|||||||
[hosttoday/ht-docker-npmg on Dockerhub](https://hub.docker.com/r/hosttoday/ht-docker-npmg/)
|
[hosttoday/ht-docker-npmg on Dockerhub](https://hub.docker.com/r/hosttoday/ht-docker-npmg/)
|
||||||
|
|
||||||
### Install
|
### Install
|
||||||
First install npmts as dev dependency:
|
First install npmts globally, then install the npmts checker:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
npm install npmts --save-dev
|
npm install npmts -g # installs npmts globally
|
||||||
|
npm install npmts-g --save-dev # installs npmts-g checking tool as devDependency
|
||||||
```
|
```
|
||||||
|
|
||||||
Then use it in package.json's script section to trigger a build:
|
Then add it to your package.json's script section to trigger a build:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@ -42,8 +43,6 @@ Then use it in package.json's script section to trigger a build:
|
|||||||
1. Instrumentalize created JavaScript files with istanbul
|
1. Instrumentalize created JavaScript files with istanbul
|
||||||
1. Run Tests
|
1. Run Tests
|
||||||
1. Create Coverage report
|
1. Create Coverage report
|
||||||
1. Upload Coverage reports to codecov.io (Tests must pass, codecov.io must be activated, by default only triggers on travis)
|
|
||||||
1. Upload JsDoc Documentation to gh-pages branch on GitHub. (Tests must pass, requires GitHub Token)
|
|
||||||
|
|
||||||
#### npmts.json
|
#### npmts.json
|
||||||
the npmts.json is the main config file. You can use it to customize the behaviour of NPMTS.
|
the npmts.json is the main config file. You can use it to customize the behaviour of NPMTS.
|
||||||
@ -131,6 +130,12 @@ thanks to autogenerated source maps.
|
|||||||
|
|
||||||
> We will add more options over time.
|
> We will add more options over time.
|
||||||
|
|
||||||
|
## Tips and tricks:
|
||||||
|
|
||||||
|
* Use [npmts-g](https://www.npmjs.com/package/npmts-g) to use globally installed npmts and install npmts locally if no global npmts is available.
|
||||||
|
* Use [npmpage](https://www.npmjs.com/package/npmtspage) to create a webpage from coverage reports and JsDocs for the module
|
||||||
|
* Use [hosttoday/ht-docker-node:npmts](https://hub.docker.com/r/hosttoday/ht-docker-node/) for speedy CI builds
|
||||||
|
|
||||||
## About the authors:
|
## About the authors:
|
||||||
[](https://lossless.com/)
|
[](https://lossless.com/)
|
||||||
|
|
||||||
|
30
dist/index.js
vendored
30
dist/index.js
vendored
@ -1,14 +1,28 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
require("typings-global");
|
require("typings-global");
|
||||||
|
/* ================================================== *
|
||||||
|
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 npmts_promisechain_1 = require("./npmts.promisechain");
|
var npmts_promisechain_1 = require("./npmts.promisechain");
|
||||||
early.stop();
|
early.stop()
|
||||||
plugins.beautylog.figletSync("NPMTS");
|
.then(function () {
|
||||||
try {
|
var npmtsProjectInfo = new plugins.projectinfo.ProjectinfoNpm(paths.npmtsPackageRoot);
|
||||||
npmts_promisechain_1.promisechain();
|
var npmtsCli = new plugins.smartcli.Smartcli();
|
||||||
}
|
npmtsCli.standardTask()
|
||||||
catch (err) {
|
.then(function (argvArg) {
|
||||||
console.log(err);
|
plugins.beautylog.figletSync("NPMTS");
|
||||||
}
|
plugins.beautylog.info("npmts version: " + npmtsProjectInfo.version);
|
||||||
|
try {
|
||||||
|
npmts_promisechain_1.promisechain(argvArg);
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
console.log(err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
npmtsCli.addVersion(npmtsProjectInfo.version);
|
||||||
|
npmtsCli.startParse();
|
||||||
|
});
|
||||||
|
7
dist/npmts.configfile.js
vendored
7
dist/npmts.configfile.js
vendored
@ -2,13 +2,16 @@
|
|||||||
require("typings-global");
|
require("typings-global");
|
||||||
var plugins = require("./npmts.plugins");
|
var plugins = require("./npmts.plugins");
|
||||||
var paths = require("./npmts.paths");
|
var paths = require("./npmts.paths");
|
||||||
exports.run = function () {
|
exports.run = function (argvArg) {
|
||||||
var done = plugins.Q.defer();
|
var done = plugins.Q.defer();
|
||||||
var config = {};
|
var config = {};
|
||||||
var configPath = plugins.path.join(paths.cwd, "npmts.json");
|
var configPath = plugins.path.join(paths.cwd, "npmts.json");
|
||||||
|
if (argvArg.notest) {
|
||||||
|
config.notest = true;
|
||||||
|
}
|
||||||
if (plugins.smartfile.checks.fileExistsSync(configPath)) {
|
if (plugins.smartfile.checks.fileExistsSync(configPath)) {
|
||||||
plugins.beautylog.info("npmts.json".blue + " config file found!");
|
plugins.beautylog.info("npmts.json".blue + " config file found!");
|
||||||
config = plugins.smartfile.local.toObjectSync(configPath);
|
config = plugins.lodashObject.assign(config, plugins.smartfile.local.toObjectSync(configPath));
|
||||||
switch (config.mode) {
|
switch (config.mode) {
|
||||||
case "default":
|
case "default":
|
||||||
case "custom":
|
case "custom":
|
||||||
|
28
dist/npmts.jsdoc.js
vendored
28
dist/npmts.jsdoc.js
vendored
@ -20,34 +20,6 @@ var genJsdoc = function (configArg) {
|
|||||||
}));
|
}));
|
||||||
return done.promise;
|
return done.promise;
|
||||||
};
|
};
|
||||||
exports.publishDocs = function (configArg) {
|
|
||||||
var done = plugins.Q.defer();
|
|
||||||
var gitUrl = plugins.projectinfo.npm(paths.cwd, {
|
|
||||||
gitAccessToken: process.env.GITHUB_TOKEN
|
|
||||||
}).git.httpsUrl;
|
|
||||||
var deployScript = ""
|
|
||||||
+ "cd " + paths.docsDir + " "
|
|
||||||
+ "&& git init " + "> /dev/null 2>&1 "
|
|
||||||
+ "&& git config user.name \"TRAVIS CI\" " + "> /dev/null 2>&1 "
|
|
||||||
+ "&& git config user.email \"travis@shipzone.io\" " + "> /dev/null 2>&1 "
|
|
||||||
+ "&& git add . " + "> /dev/null 2>&1 "
|
|
||||||
+ "&& git commit -m \"Deploy to GitHub Pages\" " + "> /dev/null 2>&1 "
|
|
||||||
+ "&& git push --force --quiet "
|
|
||||||
+ "\"" + gitUrl + "\" "
|
|
||||||
+ "master:gh-pages " + "> /dev/null 2>&1";
|
|
||||||
plugins.beautylog.log("now publishing JsDoc documentation to GitHub");
|
|
||||||
if (!plugins.shelljs.which('git')) {
|
|
||||||
plugins.beautylog.error('Git is not installed!');
|
|
||||||
plugins.shelljs.exit(1);
|
|
||||||
}
|
|
||||||
else if (plugins.shelljs.exec(deployScript).code !== 0) {
|
|
||||||
plugins.beautylog.error('Git failed!');
|
|
||||||
plugins.shelljs.exit(1);
|
|
||||||
}
|
|
||||||
plugins.beautylog.ok("JsDoc documentation has been deployed to GitHub!");
|
|
||||||
done.resolve(configArg);
|
|
||||||
return done.promise;
|
|
||||||
};
|
|
||||||
exports.run = function (configArg) {
|
exports.run = function (configArg) {
|
||||||
var done = plugins.Q.defer();
|
var done = plugins.Q.defer();
|
||||||
genJsdoc(configArg)
|
genJsdoc(configArg)
|
||||||
|
20
dist/npmts.options.js
vendored
20
dist/npmts.options.js
vendored
@ -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;
|
||||||
|
5
dist/npmts.paths.js
vendored
5
dist/npmts.paths.js
vendored
@ -1,7 +1,10 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
require("typings-global");
|
require("typings-global");
|
||||||
var plugins = require("./npmts.plugins");
|
var plugins = require("./npmts.plugins");
|
||||||
exports.cwd = plugins.smartcli.get.cwd().path;
|
//Npmts Paths
|
||||||
|
exports.npmtsPackageRoot = plugins.path.join(__dirname, "../");
|
||||||
|
//Project paths
|
||||||
|
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/");
|
||||||
|
8
dist/npmts.promisechain.js
vendored
8
dist/npmts.promisechain.js
vendored
@ -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");
|
||||||
@ -10,11 +9,11 @@ var NpmtsConfigFile = require("./npmts.configfile");
|
|||||||
var NpmtsInstall = require("./npmts.install");
|
var NpmtsInstall = require("./npmts.install");
|
||||||
var NpmtsJsdoc = require("./npmts.jsdoc");
|
var NpmtsJsdoc = require("./npmts.jsdoc");
|
||||||
var NpmtsOptions = require("./npmts.options");
|
var NpmtsOptions = require("./npmts.options");
|
||||||
var NpmtsPublish = require("./npmts.publish");
|
|
||||||
var NpmtsTests = require("./npmts.tests");
|
var NpmtsTests = require("./npmts.tests");
|
||||||
exports.promisechain = function () {
|
exports.promisechain = function (argvArg) {
|
||||||
var done = plugins.Q.defer();
|
var done = plugins.Q.defer();
|
||||||
NpmtsConfigFile.run()
|
exports.npmtsOra.start();
|
||||||
|
NpmtsConfigFile.run(argvArg)
|
||||||
.then(NpmtsOptions.run)
|
.then(NpmtsOptions.run)
|
||||||
.then(NpmtsClean.run)
|
.then(NpmtsClean.run)
|
||||||
.then(NpmtsInstall.run)
|
.then(NpmtsInstall.run)
|
||||||
@ -22,7 +21,6 @@ exports.promisechain = function () {
|
|||||||
.then(NpmtsAssets.run)
|
.then(NpmtsAssets.run)
|
||||||
.then(NpmtsJsdoc.run)
|
.then(NpmtsJsdoc.run)
|
||||||
.then(NpmtsTests.run)
|
.then(NpmtsTests.run)
|
||||||
.then(NpmtsPublish.run)
|
|
||||||
.then(function (configArg) {
|
.then(function (configArg) {
|
||||||
var shipString = "" +
|
var shipString = "" +
|
||||||
"\n" +
|
"\n" +
|
||||||
|
6
dist/npmts.publish.js
vendored
6
dist/npmts.publish.js
vendored
@ -1,13 +1,9 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
require("typings-global");
|
require("typings-global");
|
||||||
var plugins = require("./npmts.plugins");
|
var plugins = require("./npmts.plugins");
|
||||||
var NpmtsJsdoc = require("./npmts.jsdoc");
|
|
||||||
exports.run = function (configArg) {
|
exports.run = function (configArg) {
|
||||||
var done = plugins.Q.defer();
|
var done = plugins.Q.defer();
|
||||||
var config = configArg;
|
var config = configArg;
|
||||||
var promiseArray = [];
|
done.resolve();
|
||||||
config.docs.publish ? promiseArray.push(NpmtsJsdoc.publishDocs(configArg)) : void (0);
|
|
||||||
promiseArray.length === 0 ? plugins.beautylog.info("Did not publish anything!") : void (0);
|
|
||||||
plugins.Q.all(promiseArray).then(done.resolve);
|
|
||||||
return done.promise;
|
return done.promise;
|
||||||
};
|
};
|
||||||
|
24
dist/npmts.tests.js
vendored
24
dist/npmts.tests.js
vendored
@ -56,13 +56,21 @@ var coverage = function (configArg) {
|
|||||||
exports.run = function (configArg) {
|
exports.run = function (configArg) {
|
||||||
var done = plugins.Q.defer();
|
var done = plugins.Q.defer();
|
||||||
var config = configArg;
|
var config = configArg;
|
||||||
npmts_promisechain_1.npmtsOra.text("now starting tests");
|
if (config.notest != true) {
|
||||||
plugins.beautylog.log("-------------------------------------------------------\n" +
|
npmts_promisechain_1.npmtsOra.text("now starting tests");
|
||||||
"*************************** TESTS: ***************************\n" +
|
plugins.beautylog.log("-------------------------------------------------------\n" +
|
||||||
"--------------------------------------------------------------");
|
"*************************** TESTS: ***************************\n" +
|
||||||
istanbul(config)
|
"--------------------------------------------------------------");
|
||||||
.then(mocha)
|
istanbul(config)
|
||||||
.then(coverage)
|
.then(mocha)
|
||||||
.then(done.resolve);
|
.then(coverage)
|
||||||
|
.then(function () {
|
||||||
|
done.resolve(config);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
npmts_promisechain_1.npmtsOra.end();
|
||||||
|
done.resolve(config);
|
||||||
|
}
|
||||||
return done.promise;
|
return done.promise;
|
||||||
};
|
};
|
||||||
|
26
package.json
26
package.json
@ -1,14 +1,16 @@
|
|||||||
{
|
{
|
||||||
"name": "npmts",
|
"name": "npmts",
|
||||||
"version": "5.2.5",
|
"version": "5.3.4",
|
||||||
"description": "write npm modules with TypeScript",
|
"description": "write npm modules with TypeScript",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
"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 && npm run checkNoTest)",
|
||||||
"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",
|
||||||
|
"checkNoTest": "cd ./test/assets && node ../../dist/index.js --notest",
|
||||||
"compile": "(cd compile && node compile.js)"
|
"compile": "(cd compile && node compile.js)"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
@ -26,32 +28,32 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://gitlab.com/pushrocks/npmts#readme",
|
"homepage": "https://gitlab.com/pushrocks/npmts#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"beautylog": "5.0.6",
|
"beautylog": "5.0.11",
|
||||||
"early": "^2.0.1",
|
"early": "^2.0.13",
|
||||||
"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",
|
||||||
"gulp-function": "^1.3.1",
|
"gulp-function": "^1.3.6",
|
||||||
"gulp-if": "^2.0.1",
|
"gulp-if": "^2.0.1",
|
||||||
"gulp-istanbul": "^0.10.4",
|
"gulp-istanbul": "^1.0.0",
|
||||||
"gulp-jsdoc3": "^0.2.1",
|
"gulp-jsdoc3": "^0.3.0",
|
||||||
"gulp-mocha": "^2.2.0",
|
"gulp-mocha": "^2.2.0",
|
||||||
"gulp-replace": "^0.5.4",
|
"gulp-replace": "^0.5.4",
|
||||||
"gulp-sourcemaps": "^2.0.0-alpha",
|
"gulp-sourcemaps": "^2.0.0-alpha",
|
||||||
"gulp-typescript": "2.13.4",
|
"gulp-typescript": "2.13.6",
|
||||||
"gulp-typings": "2.0.0",
|
"gulp-typings": "2.0.0",
|
||||||
"lodash": "^4.13.1",
|
"lodash": "^4.13.1",
|
||||||
"merge2": "1.0.2",
|
"merge2": "1.0.2",
|
||||||
"projectinfo": "1.0.1",
|
"projectinfo": "1.0.3",
|
||||||
"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.2",
|
||||||
"smartcov": "0.0.6",
|
"smartcov": "0.0.6",
|
||||||
"smartenv": "1.2.5",
|
"smartenv": "1.2.5",
|
||||||
"smartfile": "3.0.10",
|
"smartfile": "3.0.10",
|
||||||
"smartpath": "3.2.1",
|
"smartpath": "3.2.2",
|
||||||
"smartstring": "^2.0.1",
|
"smartstring": "^2.0.6",
|
||||||
"source-map-support": "^0.4.0",
|
"source-map-support": "^0.4.0",
|
||||||
"typings-global": "*"
|
"typings-global": "*"
|
||||||
},
|
},
|
||||||
|
32
ts/index.ts
32
ts/index.ts
@ -1,16 +1,30 @@
|
|||||||
import "typings-global";
|
import "typings-global";
|
||||||
|
|
||||||
|
/* ================================================== *
|
||||||
|
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"
|
||||||
|
import * as paths from "./npmts.paths";
|
||||||
import {promisechain} from "./npmts.promisechain";
|
import {promisechain} from "./npmts.promisechain";
|
||||||
early.stop();
|
early.stop()
|
||||||
|
.then(() => {
|
||||||
|
let npmtsProjectInfo = new plugins.projectinfo.ProjectinfoNpm(paths.npmtsPackageRoot);
|
||||||
|
|
||||||
plugins.beautylog.figletSync("NPMTS");
|
let npmtsCli = new plugins.smartcli.Smartcli();
|
||||||
|
npmtsCli.standardTask()
|
||||||
try {
|
.then((argvArg) => {
|
||||||
promisechain();
|
plugins.beautylog.figletSync("NPMTS");
|
||||||
}
|
plugins.beautylog.info("npmts version: " + npmtsProjectInfo.version);
|
||||||
catch(err){
|
try {
|
||||||
console.log(err);
|
promisechain(argvArg);
|
||||||
}
|
}
|
||||||
|
catch(err){
|
||||||
|
console.log(err);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
npmtsCli.addVersion(npmtsProjectInfo.version);
|
||||||
|
npmtsCli.startParse();
|
||||||
|
});
|
@ -1,13 +1,19 @@
|
|||||||
import "typings-global";
|
import "typings-global";
|
||||||
import plugins = require("./npmts.plugins");
|
import plugins = require("./npmts.plugins");
|
||||||
import paths = require("./npmts.paths");
|
import paths = require("./npmts.paths");
|
||||||
export var run = function(){
|
export var run = function(argvArg){
|
||||||
var done = plugins.Q.defer();
|
var done = plugins.Q.defer();
|
||||||
var config:any = {};
|
var config:any = {};
|
||||||
var configPath = plugins.path.join(paths.cwd,"npmts.json");
|
var configPath = plugins.path.join(paths.cwd,"npmts.json");
|
||||||
|
if(argvArg.notest){
|
||||||
|
config.notest = true;
|
||||||
|
}
|
||||||
if(plugins.smartfile.checks.fileExistsSync(configPath)){
|
if(plugins.smartfile.checks.fileExistsSync(configPath)){
|
||||||
plugins.beautylog.info("npmts.json".blue + " config file found!");
|
plugins.beautylog.info("npmts.json".blue + " config file found!");
|
||||||
config = plugins.smartfile.local.toObjectSync(configPath);
|
config = plugins.lodashObject.assign(
|
||||||
|
config,
|
||||||
|
plugins.smartfile.local.toObjectSync(configPath)
|
||||||
|
);
|
||||||
switch (config.mode){
|
switch (config.mode){
|
||||||
case "default":
|
case "default":
|
||||||
case "custom":
|
case "custom":
|
||||||
|
@ -21,41 +21,6 @@ let genJsdoc = function(configArg){
|
|||||||
return done.promise;
|
return done.promise;
|
||||||
};
|
};
|
||||||
|
|
||||||
export let publishDocs = function(configArg){
|
|
||||||
let done = plugins.Q.defer();
|
|
||||||
let gitUrl = plugins.projectinfo.npm(
|
|
||||||
paths.cwd,
|
|
||||||
{
|
|
||||||
gitAccessToken:process.env.GITHUB_TOKEN
|
|
||||||
}
|
|
||||||
).git.httpsUrl;
|
|
||||||
|
|
||||||
let deployScript = ""
|
|
||||||
+ "cd " + paths.docsDir + " "
|
|
||||||
+ "&& git init " + "> /dev/null 2>&1 "
|
|
||||||
+ "&& git config user.name \"TRAVIS CI\" " + "> /dev/null 2>&1 "
|
|
||||||
+ "&& git config user.email \"travis@shipzone.io\" " + "> /dev/null 2>&1 "
|
|
||||||
+ "&& git add . " + "> /dev/null 2>&1 "
|
|
||||||
+ "&& git commit -m \"Deploy to GitHub Pages\" " + "> /dev/null 2>&1 "
|
|
||||||
+ "&& git push --force --quiet "
|
|
||||||
+ "\"" + gitUrl + "\" "
|
|
||||||
+ "master:gh-pages " + "> /dev/null 2>&1";
|
|
||||||
|
|
||||||
|
|
||||||
plugins.beautylog.log("now publishing JsDoc documentation to GitHub");
|
|
||||||
if (!plugins.shelljs.which('git')) {
|
|
||||||
plugins.beautylog.error('Git is not installed!');
|
|
||||||
plugins.shelljs.exit(1);
|
|
||||||
} else if (plugins.shelljs.exec(deployScript).code !== 0) {
|
|
||||||
plugins.beautylog.error('Git failed!');
|
|
||||||
plugins.shelljs.exit(1);
|
|
||||||
}
|
|
||||||
plugins.beautylog.ok("JsDoc documentation has been deployed to GitHub!");
|
|
||||||
done.resolve(configArg);
|
|
||||||
|
|
||||||
return done.promise;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
export let run = function(configArg){
|
export let run = function(configArg){
|
||||||
let done = plugins.Q.defer();
|
let done = plugins.Q.defer();
|
||||||
|
@ -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);
|
||||||
|
@ -1,7 +1,12 @@
|
|||||||
import "typings-global";
|
import "typings-global";
|
||||||
import plugins = require("./npmts.plugins");
|
import plugins = require("./npmts.plugins");
|
||||||
|
|
||||||
export let cwd = plugins.smartcli.get.cwd().path;
|
//Npmts Paths
|
||||||
|
export let npmtsPackageRoot = plugins.path.join(__dirname,"../");
|
||||||
|
|
||||||
|
|
||||||
|
//Project paths
|
||||||
|
export let cwd = process.cwd();
|
||||||
|
|
||||||
//Directories
|
//Directories
|
||||||
export let tsDir = plugins.path.join(cwd,"ts/");
|
export let tsDir = plugins.path.join(cwd,"ts/");
|
||||||
|
@ -15,15 +15,15 @@ export let g = {
|
|||||||
};
|
};
|
||||||
export let lodashObject = require('lodash/fp/object');
|
export let lodashObject = require('lodash/fp/object');
|
||||||
export let merge2 = require("merge2");
|
export let merge2 = require("merge2");
|
||||||
export let projectinfo = require("projectinfo");
|
export import projectinfo = require("projectinfo");
|
||||||
export let path = require("path");
|
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 let smartenv = require("smartenv");
|
export import smartenv = require("smartenv");
|
||||||
export let smartfile = require("smartfile");
|
export import smartfile = require("smartfile");
|
||||||
export import smartpath = require("smartpath");
|
export import smartpath = require("smartpath");
|
||||||
export import smartstring = require("smartstring");
|
export import smartstring = require("smartstring");
|
||||||
export let sourceMapSupport = require("source-map-support").install(); // this is required to display errors correctly during testing
|
export let sourceMapSupport = require("source-map-support").install(); // this is required to display errors correctly during testing
|
@ -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");
|
||||||
@ -11,12 +10,12 @@ import NpmtsConfigFile = require("./npmts.configfile");
|
|||||||
import NpmtsInstall = require("./npmts.install");
|
import NpmtsInstall = require("./npmts.install");
|
||||||
import NpmtsJsdoc = require("./npmts.jsdoc");
|
import NpmtsJsdoc = require("./npmts.jsdoc");
|
||||||
import NpmtsOptions = require("./npmts.options");
|
import NpmtsOptions = require("./npmts.options");
|
||||||
import NpmtsPublish = require("./npmts.publish");
|
|
||||||
import NpmtsTests = require("./npmts.tests");
|
import NpmtsTests = require("./npmts.tests");
|
||||||
|
|
||||||
export let promisechain = function(){
|
export let promisechain = function(argvArg){
|
||||||
let done = plugins.Q.defer();
|
let done = plugins.Q.defer();
|
||||||
NpmtsConfigFile.run()
|
npmtsOra.start();
|
||||||
|
NpmtsConfigFile.run(argvArg)
|
||||||
.then(NpmtsOptions.run)
|
.then(NpmtsOptions.run)
|
||||||
.then(NpmtsClean.run)
|
.then(NpmtsClean.run)
|
||||||
.then(NpmtsInstall.run)
|
.then(NpmtsInstall.run)
|
||||||
@ -24,7 +23,6 @@ export let promisechain = function(){
|
|||||||
.then(NpmtsAssets.run)
|
.then(NpmtsAssets.run)
|
||||||
.then(NpmtsJsdoc.run)
|
.then(NpmtsJsdoc.run)
|
||||||
.then(NpmtsTests.run)
|
.then(NpmtsTests.run)
|
||||||
.then(NpmtsPublish.run)
|
|
||||||
.then(function(configArg){
|
.then(function(configArg){
|
||||||
let shipString = "" +
|
let shipString = "" +
|
||||||
"\n" +
|
"\n" +
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
import "typings-global";
|
|
||||||
import plugins = require("./npmts.plugins");
|
|
||||||
import paths = require("./npmts.paths");
|
|
||||||
import NpmtsJsdoc = require("./npmts.jsdoc");
|
|
||||||
|
|
||||||
export let run = function(configArg){
|
|
||||||
let done = plugins.Q.defer();
|
|
||||||
let config = configArg;
|
|
||||||
let promiseArray = [];
|
|
||||||
config.docs.publish ? promiseArray.push(NpmtsJsdoc.publishDocs(configArg)) : void(0);
|
|
||||||
promiseArray.length === 0 ? plugins.beautylog.info("Did not publish anything!") : void(0);
|
|
||||||
|
|
||||||
plugins.Q.all(promiseArray).then(done.resolve);
|
|
||||||
return done.promise;
|
|
||||||
};
|
|
@ -62,17 +62,23 @@ let coverage = function(configArg){
|
|||||||
export let run = function(configArg) {
|
export let run = function(configArg) {
|
||||||
let done = plugins.Q.defer();
|
let done = plugins.Q.defer();
|
||||||
let config = configArg;
|
let config = configArg;
|
||||||
|
if(config.notest != true){
|
||||||
|
npmtsOra.text("now starting tests");
|
||||||
|
plugins.beautylog.log(
|
||||||
|
"-------------------------------------------------------\n" +
|
||||||
|
"*************************** TESTS: ***************************\n" +
|
||||||
|
"--------------------------------------------------------------"
|
||||||
|
);
|
||||||
|
|
||||||
npmtsOra.text("now starting tests");
|
istanbul(config)
|
||||||
plugins.beautylog.log(
|
.then(mocha)
|
||||||
"-------------------------------------------------------\n" +
|
.then(coverage)
|
||||||
"*************************** TESTS: ***************************\n" +
|
.then(() => {
|
||||||
"--------------------------------------------------------------"
|
done.resolve(config);
|
||||||
);
|
});
|
||||||
|
} else {
|
||||||
istanbul(config)
|
npmtsOra.end();
|
||||||
.then(mocha)
|
done.resolve(config);
|
||||||
.then(coverage)
|
}
|
||||||
.then(done.resolve);
|
|
||||||
return done.promise;
|
return done.promise;
|
||||||
};
|
};
|
Reference in New Issue
Block a user