Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
fe9ea47208 | |||
c8f29dc146 | |||
e7e228c900 | |||
b76cb1376d | |||
eed1a65415 |
7
dist/index.js
vendored
7
dist/index.js
vendored
@ -4,4 +4,9 @@ console.log("**** starting NPMTS ****");
|
||||
var plugins = require("./npmts.plugins");
|
||||
var promisechain = require("./npmts.promisechain");
|
||||
plugins.beautylog.figletSync("NPMTS");
|
||||
promisechain.run();
|
||||
try {
|
||||
promisechain.run();
|
||||
}
|
||||
catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
|
4
dist/npmts.assets.js
vendored
4
dist/npmts.assets.js
vendored
@ -5,8 +5,10 @@ var paths = require("./npmts.paths");
|
||||
exports.run = function (configArg) {
|
||||
var done = plugins.Q.defer();
|
||||
var config = configArg;
|
||||
plugins.beautylog.log("now looking at required assets");
|
||||
if (config.cli == true) {
|
||||
plugins.smartfile.copy(plugins.path.join(paths.npmtsAssetsDir, "cli.js"), paths.distDir);
|
||||
plugins.smartfile.fsaction.copy(plugins.path.join(paths.npmtsAssetsDir, "cli.js"), paths.distDir);
|
||||
plugins.beautylog.ok("CLI asset has been installed!");
|
||||
done.resolve(config);
|
||||
}
|
||||
else {
|
||||
|
13
dist/npmts.clean.js
vendored
Normal file
13
dist/npmts.clean.js
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
var plugins = require("./npmts.plugins");
|
||||
var paths = require("./npmts.paths");
|
||||
exports.run = function (configArg) {
|
||||
plugins.beautylog.log("now cleaning up from previous builds");
|
||||
var done = plugins.Q.defer();
|
||||
plugins.smartfile.fsaction.remove(paths.distDir)
|
||||
.then(function () {
|
||||
done.resolve(configArg);
|
||||
});
|
||||
return done.promise;
|
||||
};
|
2
dist/npmts.compile.js
vendored
2
dist/npmts.compile.js
vendored
@ -51,7 +51,7 @@ exports.run = function (configArg) {
|
||||
moduleStream.add(stream);
|
||||
}
|
||||
moduleStream.on("queueDrain", function () {
|
||||
plugins.beautylog.ok("TypeScript is compiled!");
|
||||
plugins.beautylog.ok("TypeScript has been compiled!");
|
||||
moduleStream.on("finish", function () {
|
||||
done.resolve(config);
|
||||
});
|
||||
|
2
dist/npmts.configfile.js
vendored
2
dist/npmts.configfile.js
vendored
@ -8,7 +8,7 @@ exports.run = function () {
|
||||
var configPath = plugins.path.join(paths.cwd, "npmts.json");
|
||||
if (plugins.smartfile.checks.fileExistsSync(configPath)) {
|
||||
plugins.beautylog.info("npmts.json".blue + " config file found!");
|
||||
config = plugins.smartfile.readFileToObject(configPath);
|
||||
config = plugins.smartfile.local.toObjectSync(configPath);
|
||||
switch (config.mode) {
|
||||
case "default":
|
||||
case "custom":
|
||||
|
4
dist/npmts.install.js
vendored
4
dist/npmts.install.js
vendored
@ -9,11 +9,11 @@ exports.run = function (configArg) {
|
||||
* ----------- install typings ---------------
|
||||
* ----------------------------------------------- */
|
||||
plugins.beautylog.log("now installing " + "typings".yellow);
|
||||
var absoluteTypingsArray = plugins.smartpath.absolute(config.typings, paths.cwd);
|
||||
var absoluteTypingsArray = plugins.smartpath.transform.toAbsolute(config.typings, paths.cwd);
|
||||
plugins.gulp.src(absoluteTypingsArray)
|
||||
.pipe(plugins.g.typings())
|
||||
.pipe(plugins.g.gFunction(function () {
|
||||
plugins.beautylog.ok("typings are installed!");
|
||||
plugins.beautylog.ok("typings have been installed!");
|
||||
done.resolve(config);
|
||||
}, "atEnd"));
|
||||
return done.promise;
|
||||
|
6
dist/npmts.jsdoc.js
vendored
6
dist/npmts.jsdoc.js
vendored
@ -14,7 +14,7 @@ var genJsdoc = function (configArg) {
|
||||
destination: paths.docsDir
|
||||
}
|
||||
}, function () {
|
||||
plugins.beautylog.ok("JsDoc has been generated!");
|
||||
plugins.beautylog.ok("JsDoc documentation has been generated!");
|
||||
done.resolve(configArg);
|
||||
}));
|
||||
return done.promise;
|
||||
@ -35,7 +35,7 @@ var publishDocs = function (configArg) {
|
||||
+ "\"" + gitUrl + "\" "
|
||||
+ "master:gh-pages " + "> /dev/null 2>&1";
|
||||
if (plugins.smartenv.getEnv().isTravis && configArg.docs && configArg.docs.publish) {
|
||||
plugins.beautylog.log("now publishing docs to GitHub");
|
||||
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);
|
||||
@ -44,7 +44,7 @@ var publishDocs = function (configArg) {
|
||||
plugins.beautylog.error('Git failed!');
|
||||
plugins.shelljs.exit(1);
|
||||
}
|
||||
plugins.beautylog.ok("JsDoc has been deployed to GitHub!");
|
||||
plugins.beautylog.ok("JsDoc documentation has been deployed to GitHub!");
|
||||
done.resolve(configArg);
|
||||
}
|
||||
else {
|
||||
|
24
dist/npmts.options.js
vendored
24
dist/npmts.options.js
vendored
@ -1,12 +1,19 @@
|
||||
"use strict";
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
var plugins = require("./npmts.plugins");
|
||||
exports.isRelease = function () {
|
||||
if (plugins.smartci.check.isCi() && plugins.smartci.isTaggedCommit()) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
exports.run = function (configArg) {
|
||||
var done = plugins.Q.defer();
|
||||
var config = configArg;
|
||||
if (typeof config.coveralls === "undefined") {
|
||||
config.coveralls = false;
|
||||
}
|
||||
plugins.beautylog.log("now determining build options");
|
||||
//handle default mode
|
||||
if (config.mode == "default") {
|
||||
config.typings = [
|
||||
"./ts/typings.json"
|
||||
@ -17,11 +24,16 @@ exports.run = function (configArg) {
|
||||
_a
|
||||
);
|
||||
config.test = ["./index.js"];
|
||||
done.resolve(config);
|
||||
}
|
||||
else {
|
||||
done.resolve(config);
|
||||
// handle state of current build
|
||||
exports.isRelease() ? plugins.beautylog.info("All right this is a release build!")
|
||||
: plugins.beautylog.info("not a release build!");
|
||||
// handle coveralls
|
||||
if ((typeof config.coveralls === "undefined" || !exports.isRelease())
|
||||
&& plugins.smartci.get.subJobNumber == 1) {
|
||||
config.coveralls = false;
|
||||
}
|
||||
done.resolve(config);
|
||||
return done.promise;
|
||||
var _a;
|
||||
};
|
||||
|
32
dist/npmts.plugins.js
vendored
32
dist/npmts.plugins.js
vendored
@ -1,10 +1,9 @@
|
||||
"use strict";
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
var plugins = {
|
||||
beautylog: require("beautylog"),
|
||||
fs: require("fs-extra"),
|
||||
gulp: require("gulp"),
|
||||
g: {
|
||||
exports.beautylog = require("beautylog");
|
||||
exports.fs = require("fs-extra");
|
||||
exports.gulp = require("gulp");
|
||||
exports.g = {
|
||||
coveralls: require("gulp-coveralls"),
|
||||
gFunction: require("gulp-function"),
|
||||
istanbul: require("gulp-istanbul"),
|
||||
@ -13,16 +12,15 @@ var plugins = {
|
||||
sourcemaps: require("gulp-sourcemaps"),
|
||||
typescript: require("gulp-typescript"),
|
||||
typings: require("gulp-typings")
|
||||
},
|
||||
merge2: require("merge2"),
|
||||
projectinfo: require("projectinfo"),
|
||||
sourceMapSupport: require("source-map-support").install(),
|
||||
path: require("path"),
|
||||
Q: require("q"),
|
||||
shelljs: require("shelljs"),
|
||||
smartcli: require("smartcli"),
|
||||
smartenv: require("smartenv"),
|
||||
smartfile: require("smartfile"),
|
||||
smartpath: require("smartpath")
|
||||
};
|
||||
module.exports = plugins;
|
||||
exports.merge2 = require("merge2");
|
||||
exports.projectinfo = require("projectinfo");
|
||||
exports.sourceMapSupport = require("source-map-support").install();
|
||||
exports.path = require("path");
|
||||
exports.Q = require("q");
|
||||
exports.shelljs = require("shelljs");
|
||||
exports.smartci = require("smartci");
|
||||
exports.smartcli = require("smartcli");
|
||||
exports.smartenv = require("smartenv");
|
||||
exports.smartfile = require("smartfile");
|
||||
exports.smartpath = require("smartpath");
|
||||
|
2
dist/npmts.promisechain.js
vendored
2
dist/npmts.promisechain.js
vendored
@ -2,6 +2,7 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
var plugins = require("./npmts.plugins");
|
||||
var NpmtsAssets = require("./npmts.assets");
|
||||
var NpmtsClean = require("./npmts.clean");
|
||||
var NpmtsCompile = require("./npmts.compile");
|
||||
var NpmtsConfigFile = require("./npmts.configfile");
|
||||
var NpmtsInstall = require("./npmts.install");
|
||||
@ -12,6 +13,7 @@ exports.run = function () {
|
||||
var promisechain;
|
||||
NpmtsConfigFile.run()
|
||||
.then(NpmtsOptions.run)
|
||||
.then(NpmtsClean.run)
|
||||
.then(NpmtsInstall.run)
|
||||
.then(NpmtsCompile.run)
|
||||
.then(NpmtsAssets.run)
|
||||
|
11
package.json
11
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "npmts",
|
||||
"version": "3.5.0",
|
||||
"version": "3.6.0",
|
||||
"description": "write npm modules with TypeScript",
|
||||
"main": "dist/index.js",
|
||||
"bin": {
|
||||
@ -26,7 +26,7 @@
|
||||
"homepage": "https://github.com/pushrocks/npmts#readme",
|
||||
"dependencies": {
|
||||
"beautylog": "3.1.2",
|
||||
"fs-extra": "^0.26.5",
|
||||
"fs-extra": "^0.26.7",
|
||||
"gulp": "3.9.1",
|
||||
"gulp-concat": "^2.6.0",
|
||||
"gulp-coveralls": "^0.1.4",
|
||||
@ -37,15 +37,16 @@
|
||||
"gulp-mocha": "^2.2.0",
|
||||
"gulp-sourcemaps": "^1.6.0",
|
||||
"gulp-typescript": "2.12.1",
|
||||
"gulp-typings": "1.2.0",
|
||||
"gulp-typings": "1.3.0",
|
||||
"merge2": "1.0.1",
|
||||
"projectinfo": "1.0.1",
|
||||
"q": "^1.4.1",
|
||||
"shelljs": "^0.6.0",
|
||||
"smartci": "0.0.1",
|
||||
"smartcli": "0.0.11",
|
||||
"smartenv": "1.2.0",
|
||||
"smartfile": "1.0.1",
|
||||
"smartpath": "2.1.0",
|
||||
"smartfile": "2.2.0",
|
||||
"smartpath": "3.0.1",
|
||||
"source-map-support": "^0.4.0"
|
||||
},
|
||||
"devDependencies": {}
|
||||
|
2
test/assets/dist/cli.js
vendored
2
test/assets/dist/cli.js
vendored
@ -1,2 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
var index = require("./index.js");
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"mode":"custom",
|
||||
"mode":"default",
|
||||
"ts":{
|
||||
"./customdir/*.ts":"./"
|
||||
},
|
||||
|
@ -1,8 +1,8 @@
|
||||
{
|
||||
"ambientDependencies": {
|
||||
"node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts#78d36dd49b6b55b9fdfe61776a12bf05c8b07777",
|
||||
"node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts",
|
||||
"mocha": "github:Bartvds/tsd-deftools/typings/DefinitelyTyped/mocha/mocha.d.ts",
|
||||
"colors": "github:DefinitelyTyped/DefinitelyTyped/colors/colors.d.ts#09e37435ffb2c56a6f908081194a74756f24f99d",
|
||||
"vinyl": "github:DefinitelyTyped/DefinitelyTyped/vinyl/vinyl.d.ts#78d36dd49b6b55b9fdfe61776a12bf05c8b07777"
|
||||
"colors": "github:DefinitelyTyped/DefinitelyTyped/colors/colors.d.ts",
|
||||
"vinyl": "github:DefinitelyTyped/DefinitelyTyped/vinyl/vinyl.d.ts"
|
||||
}
|
||||
}
|
||||
|
@ -3,4 +3,11 @@ console.log("**** starting NPMTS ****");
|
||||
import plugins = require("./npmts.plugins");
|
||||
import promisechain = require("./npmts.promisechain");
|
||||
plugins.beautylog.figletSync("NPMTS");
|
||||
promisechain.run();
|
||||
|
||||
try {
|
||||
promisechain.run();
|
||||
}
|
||||
catch(err){
|
||||
console.log(err);
|
||||
}
|
||||
|
||||
|
@ -5,8 +5,10 @@ import paths = require("./npmts.paths");
|
||||
export var run = function(configArg){
|
||||
let done = plugins.Q.defer();
|
||||
let config = configArg;
|
||||
plugins.beautylog.log("now looking at required assets");
|
||||
if(config.cli == true){
|
||||
plugins.smartfile.copy(plugins.path.join(paths.npmtsAssetsDir,"cli.js"),paths.distDir);
|
||||
plugins.smartfile.fsaction.copy(plugins.path.join(paths.npmtsAssetsDir,"cli.js"),paths.distDir);
|
||||
plugins.beautylog.ok("CLI asset has been installed!");
|
||||
done.resolve(config);
|
||||
} else {
|
||||
done.resolve(config);
|
||||
|
13
ts/npmts.clean.ts
Normal file
13
ts/npmts.clean.ts
Normal file
@ -0,0 +1,13 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
import plugins = require("./npmts.plugins");
|
||||
import paths = require("./npmts.paths");
|
||||
|
||||
export let run = function(configArg){
|
||||
plugins.beautylog.log("now cleaning up from previous builds");
|
||||
let done = plugins.Q.defer();
|
||||
plugins.smartfile.fsaction.remove(paths.distDir)
|
||||
.then(function(){
|
||||
done.resolve(configArg);
|
||||
});
|
||||
return done.promise;
|
||||
};
|
@ -55,7 +55,7 @@ export var run = function(configArg){
|
||||
moduleStream.add(stream);
|
||||
}
|
||||
moduleStream.on("queueDrain",function(){
|
||||
plugins.beautylog.ok("TypeScript is compiled!");
|
||||
plugins.beautylog.ok("TypeScript has been compiled!");
|
||||
moduleStream.on("finish",function(){
|
||||
done.resolve(config);
|
||||
});
|
||||
|
@ -7,7 +7,7 @@ export var run = function(){
|
||||
var configPath = plugins.path.join(paths.cwd,"npmts.json");
|
||||
if(plugins.smartfile.checks.fileExistsSync(configPath)){
|
||||
plugins.beautylog.info("npmts.json".blue + " config file found!");
|
||||
config = plugins.smartfile.readFileToObject(configPath);
|
||||
config = plugins.smartfile.local.toObjectSync(configPath);
|
||||
switch (config.mode){
|
||||
case "default":
|
||||
case "custom":
|
||||
|
@ -8,11 +8,11 @@ export var run = function(configArg){
|
||||
* ----------- install typings ---------------
|
||||
* ----------------------------------------------- */
|
||||
plugins.beautylog.log("now installing " + "typings".yellow);
|
||||
let absoluteTypingsArray = plugins.smartpath.absolute(config.typings,paths.cwd);
|
||||
var absoluteTypingsArray = plugins.smartpath.transform.toAbsolute(config.typings,paths.cwd);
|
||||
plugins.gulp.src(absoluteTypingsArray)
|
||||
.pipe(plugins.g.typings())
|
||||
.pipe(plugins.g.gFunction(function(){
|
||||
plugins.beautylog.ok("typings are installed!");
|
||||
plugins.beautylog.ok("typings have been installed!");
|
||||
done.resolve(config);
|
||||
},"atEnd"));
|
||||
return done.promise;
|
||||
|
@ -14,7 +14,7 @@ var genJsdoc = function(configArg){
|
||||
destination: paths.docsDir
|
||||
}
|
||||
}, function(){
|
||||
plugins.beautylog.ok("JsDoc has been generated!");
|
||||
plugins.beautylog.ok("JsDoc documentation has been generated!");
|
||||
done.resolve(configArg)
|
||||
}));
|
||||
return done.promise;
|
||||
@ -41,7 +41,7 @@ var publishDocs = function(configArg){
|
||||
+ "master:gh-pages " + "> /dev/null 2>&1";
|
||||
|
||||
if(plugins.smartenv.getEnv().isTravis && configArg.docs && configArg.docs.publish){
|
||||
plugins.beautylog.log("now publishing docs to GitHub");
|
||||
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);
|
||||
@ -49,7 +49,7 @@ var publishDocs = function(configArg){
|
||||
plugins.beautylog.error('Git failed!');
|
||||
plugins.shelljs.exit(1);
|
||||
}
|
||||
plugins.beautylog.ok("JsDoc has been deployed to GitHub!");
|
||||
plugins.beautylog.ok("JsDoc documentation has been deployed to GitHub!");
|
||||
done.resolve(configArg);
|
||||
} else {
|
||||
done.resolve(configArg);
|
||||
|
@ -1,11 +1,21 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
import plugins = require("./npmts.plugins");
|
||||
|
||||
export let isRelease = function():boolean {
|
||||
if (plugins.smartci.check.isCi() && plugins.smartci.isTaggedCommit()){
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
export var run = function(configArg){
|
||||
var done = plugins.Q.defer();
|
||||
var config = configArg;
|
||||
if (typeof config.coveralls === "undefined"){
|
||||
config.coveralls = false;
|
||||
}
|
||||
|
||||
plugins.beautylog.log("now determining build options");
|
||||
|
||||
//handle default mode
|
||||
if (config.mode == "default"){
|
||||
config.typings = [
|
||||
"./ts/typings.json"
|
||||
@ -15,9 +25,21 @@ export var run = function(configArg){
|
||||
["./test/test.ts"]: "./test/"
|
||||
};
|
||||
config.test = ["./index.js"];
|
||||
done.resolve(config);
|
||||
} else {
|
||||
done.resolve(config);
|
||||
}
|
||||
|
||||
// handle state of current build
|
||||
|
||||
isRelease() ? plugins.beautylog.info("All right this is a release build!")
|
||||
: plugins.beautylog.info("not a release build!");
|
||||
|
||||
// handle coveralls
|
||||
if (
|
||||
(typeof config.coveralls === "undefined" || !isRelease())
|
||||
&& plugins.smartci.get.subJobNumber == 1
|
||||
){
|
||||
config.coveralls = false;
|
||||
}
|
||||
|
||||
done.resolve(config);
|
||||
return done.promise;
|
||||
};
|
@ -1,9 +1,8 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
var plugins = {
|
||||
beautylog: require("beautylog"),
|
||||
fs: require("fs-extra"),
|
||||
gulp: require("gulp"),
|
||||
g: {
|
||||
export let beautylog = require("beautylog");
|
||||
export let fs = require("fs-extra");
|
||||
export let gulp = require("gulp");
|
||||
export let g = {
|
||||
coveralls: require("gulp-coveralls"),
|
||||
gFunction: require("gulp-function"),
|
||||
istanbul: require("gulp-istanbul"),
|
||||
@ -13,16 +12,15 @@ var plugins = {
|
||||
typescript: require("gulp-typescript"),
|
||||
typings: require("gulp-typings")
|
||||
|
||||
},
|
||||
merge2: require("merge2"),
|
||||
projectinfo: require("projectinfo"),
|
||||
sourceMapSupport:require("source-map-support").install(),
|
||||
path: require("path"),
|
||||
Q:require("q"),
|
||||
shelljs: require("shelljs"),
|
||||
smartcli: require("smartcli"),
|
||||
smartenv: require("smartenv"),
|
||||
smartfile: require("smartfile"),
|
||||
smartpath: require("smartpath")
|
||||
};
|
||||
export = plugins;
|
||||
export let merge2 = require("merge2");
|
||||
export let projectinfo = require("projectinfo");
|
||||
export let sourceMapSupport = require("source-map-support").install();
|
||||
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 let smartenv = require("smartenv");
|
||||
export let smartfile = require("smartfile");
|
||||
export let smartpath = require("smartpath");
|
@ -2,6 +2,7 @@
|
||||
import plugins = require("./npmts.plugins");
|
||||
|
||||
import NpmtsAssets = require("./npmts.assets");
|
||||
import NpmtsClean = require("./npmts.clean");
|
||||
import NpmtsCompile = require("./npmts.compile");
|
||||
import NpmtsConfigFile = require("./npmts.configfile");
|
||||
import NpmtsInstall = require("./npmts.install");
|
||||
@ -13,6 +14,7 @@ export var run = function(){
|
||||
var promisechain;
|
||||
NpmtsConfigFile.run()
|
||||
.then(NpmtsOptions.run)
|
||||
.then(NpmtsClean.run)
|
||||
.then(NpmtsInstall.run)
|
||||
.then(NpmtsCompile.run)
|
||||
.then(NpmtsAssets.run)
|
||||
|
Reference in New Issue
Block a user