Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
e8238dc907 | |||
007e7539c8 | |||
e3c2c56548 | |||
f0954b19e0 | |||
48a9d19b8e | |||
7d39683972 | |||
01e9f386a6 | |||
2f4fb28b5d |
6
dist/npmts.jsdoc.js
vendored
6
dist/npmts.jsdoc.js
vendored
@ -19,7 +19,7 @@ var genJsdoc = function (configArg) {
|
|||||||
}));
|
}));
|
||||||
return done.promise;
|
return done.promise;
|
||||||
};
|
};
|
||||||
var publishDocs = function (configArg) {
|
exports.publishDocs = function (configArg) {
|
||||||
var done = plugins.Q.defer();
|
var done = plugins.Q.defer();
|
||||||
var gitUrl = plugins.projectinfo.npm(paths.cwd, {
|
var gitUrl = plugins.projectinfo.npm(paths.cwd, {
|
||||||
gitAccessToken: process.env.GITHUB_TOKEN
|
gitAccessToken: process.env.GITHUB_TOKEN
|
||||||
@ -34,7 +34,7 @@ var publishDocs = function (configArg) {
|
|||||||
+ "&& git push --force --quiet "
|
+ "&& git push --force --quiet "
|
||||||
+ "\"" + gitUrl + "\" "
|
+ "\"" + gitUrl + "\" "
|
||||||
+ "master:gh-pages " + "> /dev/null 2>&1";
|
+ "master:gh-pages " + "> /dev/null 2>&1";
|
||||||
if (plugins.smartenv.getEnv().isTravis && configArg.docs && configArg.docs.publish) {
|
if (configArg.docs.publish) {
|
||||||
plugins.beautylog.log("now publishing JsDoc documentation to GitHub");
|
plugins.beautylog.log("now publishing JsDoc documentation to GitHub");
|
||||||
if (!plugins.shelljs.which('git')) {
|
if (!plugins.shelljs.which('git')) {
|
||||||
plugins.beautylog.error('Git is not installed!');
|
plugins.beautylog.error('Git is not installed!');
|
||||||
@ -48,6 +48,7 @@ var publishDocs = function (configArg) {
|
|||||||
done.resolve(configArg);
|
done.resolve(configArg);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
console.log("GitHub documentation has not been uploaded.");
|
||||||
done.resolve(configArg);
|
done.resolve(configArg);
|
||||||
}
|
}
|
||||||
return done.promise;
|
return done.promise;
|
||||||
@ -55,7 +56,6 @@ var publishDocs = function (configArg) {
|
|||||||
exports.run = function (configArg) {
|
exports.run = function (configArg) {
|
||||||
var done = plugins.Q.defer();
|
var done = plugins.Q.defer();
|
||||||
genJsdoc(configArg)
|
genJsdoc(configArg)
|
||||||
.then(publishDocs)
|
|
||||||
.then(done.resolve);
|
.then(done.resolve);
|
||||||
return done.promise;
|
return done.promise;
|
||||||
};
|
};
|
||||||
|
28
dist/npmts.options.js
vendored
28
dist/npmts.options.js
vendored
@ -2,12 +2,12 @@
|
|||||||
/// <reference path="./typings/main.d.ts" />
|
/// <reference path="./typings/main.d.ts" />
|
||||||
var plugins = require("./npmts.plugins");
|
var plugins = require("./npmts.plugins");
|
||||||
exports.isRelease = function () {
|
exports.isRelease = function () {
|
||||||
if (plugins.smartci.check.isCi() && plugins.smartci.check.isTaggedCommit()) {
|
return plugins.smartci.check.isCi()
|
||||||
return true;
|
&& plugins.smartci.check.isTaggedCommit();
|
||||||
}
|
};
|
||||||
else {
|
exports.doPublish = function () {
|
||||||
return false;
|
return exports.isRelease()
|
||||||
}
|
&& plugins.smartci.get.subJobNumber() == 1;
|
||||||
};
|
};
|
||||||
exports.run = function (configArg) {
|
exports.run = function (configArg) {
|
||||||
var done = plugins.Q.defer();
|
var done = plugins.Q.defer();
|
||||||
@ -26,13 +26,17 @@ exports.run = function (configArg) {
|
|||||||
config.test = ["./index.js"];
|
config.test = ["./index.js"];
|
||||||
}
|
}
|
||||||
// handle state of current build
|
// handle state of current build
|
||||||
exports.isRelease() ? plugins.beautylog.info("All right this is a release build!")
|
exports.isRelease() ? plugins.beautylog.info("All right: This is a RELEASE build!")
|
||||||
: plugins.beautylog.info("not 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 and docs when tests succeed!")
|
||||||
|
: plugins.beautylog.info("We are not publishing anything!");
|
||||||
// handle coveralls
|
// handle coveralls
|
||||||
if ((typeof config.coveralls === "undefined" || !exports.isRelease())
|
config.coveralls ? void (0) : config.coveralls = false;
|
||||||
&& plugins.smartci.get.subJobNumber == 1) {
|
exports.doPublish() ? void (0) : config.coveralls = false;
|
||||||
config.coveralls = false;
|
// 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;
|
||||||
done.resolve(config);
|
done.resolve(config);
|
||||||
return done.promise;
|
return done.promise;
|
||||||
var _a;
|
var _a;
|
||||||
|
2
dist/npmts.promisechain.js
vendored
2
dist/npmts.promisechain.js
vendored
@ -8,6 +8,7 @@ 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.run = function () {
|
exports.run = function () {
|
||||||
var promisechain;
|
var promisechain;
|
||||||
@ -19,6 +20,7 @@ exports.run = 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" +
|
||||||
|
15
dist/npmts.publish.js
vendored
Normal file
15
dist/npmts.publish.js
vendored
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
"use strict";
|
||||||
|
/// <reference path="./typings/main.d.ts" />
|
||||||
|
var plugins = require("./npmts.plugins");
|
||||||
|
var NpmtsTests = require("./npmts.tests");
|
||||||
|
var NpmtsJsdoc = require("./npmts.jsdoc");
|
||||||
|
exports.run = function (configArg) {
|
||||||
|
var done = plugins.Q.defer();
|
||||||
|
var config = configArg;
|
||||||
|
var promiseArray = [];
|
||||||
|
config.coveralls ? promiseArray.push(NpmtsTests.publishCoverage(configArg)) : void (0);
|
||||||
|
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;
|
||||||
|
};
|
38
dist/npmts.tests.js
vendored
38
dist/npmts.tests.js
vendored
@ -2,6 +2,24 @@
|
|||||||
/// <reference path="./typings/main.d.ts" />
|
/// <reference path="./typings/main.d.ts" />
|
||||||
var plugins = require("./npmts.plugins");
|
var plugins = require("./npmts.plugins");
|
||||||
var paths = require("./npmts.paths");
|
var paths = require("./npmts.paths");
|
||||||
|
exports.publishCoverage = function (configArg) {
|
||||||
|
var done = plugins.Q.defer();
|
||||||
|
plugins.beautylog.log("now uploading coverage data to coveralls");
|
||||||
|
var stream = plugins.gulp.src([plugins.path.join(paths.cwd, "./coverage/lcov.info")])
|
||||||
|
.pipe(plugins.g.coveralls())
|
||||||
|
.pipe(plugins.g.gFunction([
|
||||||
|
function () {
|
||||||
|
var done = plugins.Q.defer();
|
||||||
|
plugins.beautylog.ok("Coverage data has been uploaded to Coveralls!");
|
||||||
|
done.resolve();
|
||||||
|
return done.promise;
|
||||||
|
}
|
||||||
|
], "atEnd"));
|
||||||
|
stream.on("finish", function () {
|
||||||
|
done.resolve(configArg);
|
||||||
|
});
|
||||||
|
return done.promise;
|
||||||
|
};
|
||||||
exports.run = function (configArg) {
|
exports.run = function (configArg) {
|
||||||
var done = plugins.Q.defer();
|
var done = plugins.Q.defer();
|
||||||
var config = configArg;
|
var config = configArg;
|
||||||
@ -18,27 +36,11 @@ exports.run = function (configArg) {
|
|||||||
.pipe(plugins.g.istanbul.enforceThresholds({ thresholds: { global: 30 } }));
|
.pipe(plugins.g.istanbul.enforceThresholds({ thresholds: { global: 30 } }));
|
||||||
return stream;
|
return stream;
|
||||||
};
|
};
|
||||||
var coveralls = function () {
|
|
||||||
plugins.beautylog.log("now uploading coverage data to coveralls");
|
|
||||||
var stream = plugins.gulp.src([plugins.path.join(paths.cwd, "./coverage/lcov.info")])
|
|
||||||
.pipe(plugins.g.coveralls())
|
|
||||||
.pipe(plugins.g.gFunction(function () {
|
|
||||||
plugins.beautylog.ok("Tests have passed and coverage data has been uploaded to Coveralls!");
|
|
||||||
}, "atEnd"));
|
|
||||||
return stream;
|
|
||||||
};
|
|
||||||
plugins.beautylog.log("now starting tests");
|
plugins.beautylog.log("now starting tests");
|
||||||
istanbul().on("finish", function () {
|
istanbul().on("finish", function () {
|
||||||
mocha().on("finish", function () {
|
mocha().on("finish", function () {
|
||||||
if (plugins.smartenv.getEnv().isTravis && config.coveralls) {
|
plugins.beautylog.ok("Tests have passed!");
|
||||||
coveralls().on("finish", function () {
|
done.resolve(config);
|
||||||
done.resolve(config);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
plugins.beautylog.ok("Tests have passed!");
|
|
||||||
done.resolve(config);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
return done.promise;
|
return done.promise;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "npmts",
|
"name": "npmts",
|
||||||
"version": "3.6.1",
|
"version": "3.6.5",
|
||||||
"description": "write npm modules with TypeScript",
|
"description": "write npm modules with TypeScript",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
import plugins = require("./npmts.plugins");
|
import plugins = require("./npmts.plugins");
|
||||||
import paths = require("./npmts.paths");
|
import paths = require("./npmts.paths");
|
||||||
|
|
||||||
var genJsdoc = function(configArg){
|
let genJsdoc = function(configArg){
|
||||||
var done = plugins.Q.defer();
|
let done = plugins.Q.defer();
|
||||||
plugins.beautylog.log("now generating " + "JsDoc documentation".blue);
|
plugins.beautylog.log("now generating " + "JsDoc documentation".blue);
|
||||||
plugins.gulp.src([
|
plugins.gulp.src([
|
||||||
plugins.path.join(paths.cwd,"README.md"),
|
plugins.path.join(paths.cwd,"README.md"),
|
||||||
@ -20,16 +20,16 @@ var genJsdoc = function(configArg){
|
|||||||
return done.promise;
|
return done.promise;
|
||||||
};
|
};
|
||||||
|
|
||||||
var publishDocs = function(configArg){
|
export let publishDocs = function(configArg){
|
||||||
var done = plugins.Q.defer();
|
let done = plugins.Q.defer();
|
||||||
var gitUrl = plugins.projectinfo.npm(
|
let gitUrl = plugins.projectinfo.npm(
|
||||||
paths.cwd,
|
paths.cwd,
|
||||||
{
|
{
|
||||||
gitAccessToken:process.env.GITHUB_TOKEN
|
gitAccessToken:process.env.GITHUB_TOKEN
|
||||||
}
|
}
|
||||||
).git.httpsUrl;
|
).git.httpsUrl;
|
||||||
|
|
||||||
var deployScript = ""
|
let deployScript = ""
|
||||||
+ "cd " + paths.docsDir + " "
|
+ "cd " + paths.docsDir + " "
|
||||||
+ "&& git init " + "> /dev/null 2>&1 "
|
+ "&& git init " + "> /dev/null 2>&1 "
|
||||||
+ "&& git config user.name \"TRAVIS CI\" " + "> /dev/null 2>&1 "
|
+ "&& git config user.name \"TRAVIS CI\" " + "> /dev/null 2>&1 "
|
||||||
@ -40,28 +40,25 @@ var publishDocs = function(configArg){
|
|||||||
+ "\"" + gitUrl + "\" "
|
+ "\"" + gitUrl + "\" "
|
||||||
+ "master:gh-pages " + "> /dev/null 2>&1";
|
+ "master:gh-pages " + "> /dev/null 2>&1";
|
||||||
|
|
||||||
if(plugins.smartenv.getEnv().isTravis && configArg.docs && configArg.docs.publish){
|
|
||||||
plugins.beautylog.log("now publishing JsDoc documentation to GitHub");
|
plugins.beautylog.log("now publishing JsDoc documentation to GitHub");
|
||||||
if (!plugins.shelljs.which('git')) {
|
if (!plugins.shelljs.which('git')) {
|
||||||
plugins.beautylog.error('Git is not installed!');
|
plugins.beautylog.error('Git is not installed!');
|
||||||
plugins.shelljs.exit(1);
|
plugins.shelljs.exit(1);
|
||||||
} else if (plugins.shelljs.exec(deployScript).code !== 0) {
|
} else if (plugins.shelljs.exec(deployScript).code !== 0) {
|
||||||
plugins.beautylog.error('Git failed!');
|
plugins.beautylog.error('Git failed!');
|
||||||
plugins.shelljs.exit(1);
|
plugins.shelljs.exit(1);
|
||||||
}
|
|
||||||
plugins.beautylog.ok("JsDoc documentation has been deployed to GitHub!");
|
|
||||||
done.resolve(configArg);
|
|
||||||
} else {
|
|
||||||
done.resolve(configArg);
|
|
||||||
}
|
}
|
||||||
|
plugins.beautylog.ok("JsDoc documentation has been deployed to GitHub!");
|
||||||
|
done.resolve(configArg);
|
||||||
|
|
||||||
return done.promise;
|
return done.promise;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export var run = function(configArg){
|
export let run = function(configArg){
|
||||||
var done = plugins.Q.defer();
|
let done = plugins.Q.defer();
|
||||||
genJsdoc(configArg)
|
genJsdoc(configArg)
|
||||||
.then(publishDocs)
|
|
||||||
.then(done.resolve);
|
.then(done.resolve);
|
||||||
return done.promise;
|
return done.promise;
|
||||||
};
|
};
|
@ -2,11 +2,13 @@
|
|||||||
import plugins = require("./npmts.plugins");
|
import plugins = require("./npmts.plugins");
|
||||||
|
|
||||||
export let isRelease = function():boolean {
|
export let isRelease = function():boolean {
|
||||||
if (plugins.smartci.check.isCi() && plugins.smartci.check.isTaggedCommit()){
|
return plugins.smartci.check.isCi()
|
||||||
return true;
|
&& plugins.smartci.check.isTaggedCommit();
|
||||||
} else {
|
};
|
||||||
return false;
|
|
||||||
}
|
export let doPublish = function():boolean {
|
||||||
|
return isRelease()
|
||||||
|
&& plugins.smartci.get.subJobNumber() == 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
export var run = function(configArg){
|
export var run = function(configArg){
|
||||||
@ -29,16 +31,19 @@ export var run = function(configArg){
|
|||||||
|
|
||||||
// handle state of current build
|
// handle state of current build
|
||||||
|
|
||||||
isRelease() ? plugins.beautylog.info("All right this is a release build!")
|
isRelease() ? plugins.beautylog.info("All right: This is a RELEASE build!")
|
||||||
: plugins.beautylog.info("not 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 and docs when tests succeed!")
|
||||||
|
: plugins.beautylog.info("We are not publishing anything!");
|
||||||
|
|
||||||
// handle coveralls
|
// handle coveralls
|
||||||
if (
|
config.coveralls ? void(0) : config.coveralls = false;
|
||||||
(typeof config.coveralls === "undefined" || !isRelease())
|
doPublish() ? void(0) : config.coveralls = false;
|
||||||
&& plugins.smartci.get.subJobNumber == 1
|
|
||||||
){
|
// handle docs
|
||||||
config.coveralls = false;
|
config.docs ? void(0) : config.docs = {};
|
||||||
}
|
config.docs.publish ? void(0) : config.docs.publish = false;
|
||||||
|
doPublish() ? void(0) : config.docs.publish = false;
|
||||||
|
|
||||||
done.resolve(config);
|
done.resolve(config);
|
||||||
return done.promise;
|
return done.promise;
|
||||||
|
@ -8,6 +8,7 @@ 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 var run = function(){
|
export var run = function(){
|
||||||
@ -20,6 +21,7 @@ export var run = 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" +
|
||||||
|
19
ts/npmts.publish.ts
Normal file
19
ts/npmts.publish.ts
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
/// <reference path="./typings/main.d.ts" />
|
||||||
|
import plugins = require("./npmts.plugins");
|
||||||
|
import paths = require("./npmts.paths");
|
||||||
|
import NpmtsTests = require("./npmts.tests");
|
||||||
|
import NpmtsJsdoc = require("./npmts.jsdoc");
|
||||||
|
|
||||||
|
|
||||||
|
export let run = function(configArg){
|
||||||
|
let done = plugins.Q.defer();
|
||||||
|
let config = configArg;
|
||||||
|
|
||||||
|
let promiseArray = [];
|
||||||
|
config.coveralls ? promiseArray.push(NpmtsTests.publishCoverage(configArg)) : void(0);
|
||||||
|
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;
|
||||||
|
};
|
@ -1,6 +1,19 @@
|
|||||||
/// <reference path="./typings/main.d.ts" />
|
/// <reference path="./typings/main.d.ts" />
|
||||||
import plugins = require("./npmts.plugins");
|
import plugins = require("./npmts.plugins");
|
||||||
import paths = require("./npmts.paths");
|
import paths = require("./npmts.paths");
|
||||||
|
|
||||||
|
export let publishCoverage = function(configArg){
|
||||||
|
let done = plugins.Q.defer();
|
||||||
|
plugins.beautylog.log("now uploading coverage data to coveralls");
|
||||||
|
var stream = plugins.gulp.src([plugins.path.join(paths.cwd,"./coverage/lcov.info")])
|
||||||
|
.pipe(plugins.g.coveralls())
|
||||||
|
.pipe(plugins.g.gFunction(function(){
|
||||||
|
plugins.beautylog.ok("Coverage data has been uploaded to Coveralls!");
|
||||||
|
done.resolve(configArg);
|
||||||
|
},"atEnd"));
|
||||||
|
return done.promise;
|
||||||
|
};
|
||||||
|
|
||||||
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;
|
||||||
@ -23,27 +36,11 @@ export var run = function(configArg) {
|
|||||||
return stream;
|
return stream;
|
||||||
};
|
};
|
||||||
|
|
||||||
var coveralls = function(){
|
|
||||||
plugins.beautylog.log("now uploading coverage data to coveralls");
|
|
||||||
var stream = plugins.gulp.src([plugins.path.join(paths.cwd,"./coverage/lcov.info")])
|
|
||||||
.pipe(plugins.g.coveralls())
|
|
||||||
.pipe(plugins.g.gFunction(function(){
|
|
||||||
plugins.beautylog.ok("Tests have passed and coverage data has been uploaded to Coveralls!");
|
|
||||||
},"atEnd"));
|
|
||||||
return stream;
|
|
||||||
};
|
|
||||||
|
|
||||||
plugins.beautylog.log("now starting tests");
|
plugins.beautylog.log("now starting tests");
|
||||||
istanbul().on("finish",function(){
|
istanbul().on("finish",function(){
|
||||||
mocha().on("finish",function(){
|
mocha().on("finish",function(){
|
||||||
if(plugins.smartenv.getEnv().isTravis && config.coveralls){
|
plugins.beautylog.ok("Tests have passed!");
|
||||||
coveralls().on("finish",function(){
|
done.resolve(config);
|
||||||
done.resolve(config);
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
plugins.beautylog.ok("Tests have passed!");
|
|
||||||
done.resolve(config);
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
return done.promise;
|
return done.promise;
|
||||||
|
Reference in New Issue
Block a user