Compare commits
21 Commits
Author | SHA1 | Date | |
---|---|---|---|
040100b73f | |||
3ce49c7e97 | |||
55d7018891 | |||
d98d035902 | |||
217af24d25 | |||
11c43f59d9 | |||
14c36dd894 | |||
9f74fab2b2 | |||
8efa67a4ff | |||
f7304f59a5 | |||
070385867e | |||
e429eb8ae0 | |||
6045174edb | |||
08dcdb2c9f | |||
44aa92c83c | |||
e43541cf90 | |||
414e845b80 | |||
c18eb85ec8 | |||
3ae3598c96 | |||
26eca7aa65 | |||
48d9de65a0 |
8
.gitignore
vendored
8
.gitignore
vendored
@ -1,10 +1,10 @@
|
|||||||
.idea/
|
.idea/
|
||||||
.c9/
|
.c9/
|
||||||
node_modules/
|
node_modules/
|
||||||
test/**/node_modules/
|
test/assets/**/node_modules/
|
||||||
test/assets/docs/
|
test/assets/**/docs/
|
||||||
test/**/typings/
|
test/assets/**/typings/
|
||||||
test/**/coverage/
|
test/assets/**/coverage/
|
||||||
ts/*.js
|
ts/*.js
|
||||||
ts/*.js.map
|
ts/*.js.map
|
||||||
ts/typings/
|
ts/typings/
|
||||||
|
@ -2,5 +2,6 @@
|
|||||||
support
|
support
|
||||||
compile
|
compile
|
||||||
test/
|
test/
|
||||||
|
docs/
|
||||||
examples
|
examples
|
||||||
.gitignore
|
.gitignore
|
@ -1,7 +1,7 @@
|
|||||||
language: node_js
|
language: node_js
|
||||||
node_js:
|
node_js:
|
||||||
- "4.3.1"
|
- 4.3.1
|
||||||
- "stable"
|
- stable
|
||||||
deploy:
|
deploy:
|
||||||
provider: npm
|
provider: npm
|
||||||
email: npm@lossless.digital
|
email: npm@lossless.digital
|
||||||
@ -10,3 +10,6 @@ deploy:
|
|||||||
on:
|
on:
|
||||||
tags: true
|
tags: true
|
||||||
repo: pushrocks/npmts
|
repo: pushrocks/npmts
|
||||||
|
env:
|
||||||
|
global:
|
||||||
|
secure: kPKBMnEKoC+K5dXpl11NhuK3LSp0c0fRO60Akj3QeQBjUWnVAcF0Ht30c31y0lnJaMEzXhmUIKdR7RQnlmw5be4TYGINzY7FD3Dcv7o+HO1ZQrkpMWSu46jF6ZJer9moGjZ8e0rX8wZyB9SqsXYlwWRzqvxfOVxQfTvU3BEnJKHbhq+R5JMJ8dwLBPNTJKMWKq85KNsjo3ap0BjxdBUoRLzvrn31VOPH30BkvmLGc5YiIz5QmITll/T2wmQKYTNT2qDlEJ729B8pYa3eNlCNi89AxsLDGCmEoJAVrPsyw5g+gAyBqZ1GRULy83UJbELUq7cse3MRLMSwCAm4f0INRAuqcyiKYJ4+LHd0NwKrFQ/dQ0pvyBTbbEjNemXaakkWH7S6F03UvF+u+tiQ7C97XH0CRsseGlm36zCkAClEhtWVWA4U0Q5c6zqRAAOYOI0xquXalRKPTJe7fCYewp2eqmlp8drt8MxancyKI/ynXNoR5vGFzDTSRoPjTlaYQPmbiH4+Nd5+6Qoj94PEIqghebIPDQo3C7vWts4WGccux5b2q524UgB63hjJQA6+GQOo1q4RibouS6WScn8/tW/ZOEP+sNhDfkeiZUIjye+Q3PyzonGHefgSQ8wBbsc8LOX0cKUcEFWr14nhdQ9ZeW+hrSSF04TbM4zGJPGcKhmT2UU=
|
||||||
|
2
assets/cli.js
Normal file
2
assets/cli.js
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
var index = require("./index.js");
|
@ -4,7 +4,7 @@ var plugins = {
|
|||||||
gulp: require("gulp"),
|
gulp: require("gulp"),
|
||||||
g:{
|
g:{
|
||||||
typescript: require("gulp-typescript"),
|
typescript: require("gulp-typescript"),
|
||||||
header: require("gulp-header")
|
typings:require("gulp-typings")
|
||||||
},
|
},
|
||||||
mergeStream: require("merge2"),
|
mergeStream: require("merge2"),
|
||||||
path: require("path")
|
path: require("path")
|
||||||
@ -18,7 +18,13 @@ paths = {
|
|||||||
|
|
||||||
plugins.beautylog.log('now compiling NPMTS');
|
plugins.beautylog.log('now compiling NPMTS');
|
||||||
|
|
||||||
plugins.gulp.task('indexTS', function() {
|
plugins.gulp.task("typings",function(){
|
||||||
|
var stream = plugins.gulp.src(plugins.path.join(paths.packageBase,"ts/typings.json"))
|
||||||
|
.pipe(plugins.g.typings());
|
||||||
|
return stream;
|
||||||
|
});
|
||||||
|
|
||||||
|
plugins.gulp.task("TS",["typings"], function() {
|
||||||
var stream = plugins.gulp.src([
|
var stream = plugins.gulp.src([
|
||||||
plugins.path.join(paths.packageBase,'ts/**/*.ts'),
|
plugins.path.join(paths.packageBase,'ts/**/*.ts'),
|
||||||
"!" + plugins.path.join(paths.packageBase,'ts/typings/**/*.d.ts')
|
"!" + plugins.path.join(paths.packageBase,'ts/typings/**/*.d.ts')
|
||||||
@ -27,12 +33,16 @@ plugins.gulp.task('indexTS', function() {
|
|||||||
target:"ES5",
|
target:"ES5",
|
||||||
module:"commonjs"
|
module:"commonjs"
|
||||||
}))
|
}))
|
||||||
.pipe(plugins.g.header('#!/usr/bin/env node\n\n'))
|
|
||||||
.pipe(plugins.gulp.dest(plugins.path.join(paths.packageBase, 'dist/')));
|
.pipe(plugins.gulp.dest(plugins.path.join(paths.packageBase, 'dist/')));
|
||||||
return stream;
|
return stream;
|
||||||
});
|
});
|
||||||
|
|
||||||
plugins.gulp.task('default',['indexTS'], function() {
|
plugins.gulp.task("CLI",function(){
|
||||||
|
var stream = plugins.gulp.src(plugins.path.join(paths.packageBase,"assets/cli.js"))
|
||||||
|
.pipe(plugins.gulp.dest(plugins.path.join(paths.packageBase, 'dist/')))
|
||||||
|
});
|
||||||
|
|
||||||
|
plugins.gulp.task('default',['TS',"CLI"], function() {
|
||||||
plugins.beautylog.success('Typescript compiled');
|
plugins.beautylog.success('Typescript compiled');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
3
dist/cli.js
vendored
3
dist/cli.js
vendored
@ -1,3 +1,2 @@
|
|||||||
#!/usr/bin/env node
|
#!/usr/bin/env node
|
||||||
|
var index = require("./index.js");
|
||||||
/// <reference path="./typings/main.d.ts" />
|
|
3
dist/index.js
vendored
3
dist/index.js
vendored
@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/env node
|
"use strict";
|
||||||
|
|
||||||
/// <reference path="./typings/main.d.ts" />
|
/// <reference path="./typings/main.d.ts" />
|
||||||
console.log("**** starting NPMTS ****");
|
console.log("**** starting NPMTS ****");
|
||||||
var plugins = require("./npmts.plugins");
|
var plugins = require("./npmts.plugins");
|
||||||
|
16
dist/npmts.assets.js
vendored
Normal file
16
dist/npmts.assets.js
vendored
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
"use strict";
|
||||||
|
/// <reference path="./typings/main.d.ts" />
|
||||||
|
var plugins = require("./npmts.plugins");
|
||||||
|
var paths = require("./npmts.paths");
|
||||||
|
exports.run = function (configArg) {
|
||||||
|
var done = plugins.Q.defer();
|
||||||
|
var config = configArg;
|
||||||
|
if (config.cli == true) {
|
||||||
|
plugins.smartfile.copy(plugins.path.join(paths.npmtsAssetsDir, "cli.js"), paths.distDir);
|
||||||
|
done.resolve(config);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
done.resolve(config);
|
||||||
|
}
|
||||||
|
return done.promise;
|
||||||
|
};
|
2
dist/npmts.cli.js
vendored
2
dist/npmts.cli.js
vendored
@ -1,3 +1 @@
|
|||||||
#!/usr/bin/env node
|
|
||||||
|
|
||||||
/// <reference path="./typings/main.d.ts" />
|
/// <reference path="./typings/main.d.ts" />
|
||||||
|
123
dist/npmts.compile.js
vendored
123
dist/npmts.compile.js
vendored
@ -1,91 +1,62 @@
|
|||||||
#!/usr/bin/env node
|
"use strict";
|
||||||
|
|
||||||
/// <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.run = function (configArg) {
|
exports.run = function (configArg) {
|
||||||
var done = plugins.Q.defer();
|
var done = plugins.Q.defer();
|
||||||
var config = configArg;
|
var config = configArg;
|
||||||
plugins.beautylog.log("now running custom tasks");
|
plugins.beautylog.log("now compiling " + "TypeScript".yellow);
|
||||||
var moduleStream = plugins.merge2({ end: false });
|
var moduleStream = plugins.merge2({ end: false });
|
||||||
/* -------------------------------------------------
|
/* -------------------------------------------------
|
||||||
* ----------- first install typings ---------------
|
* ----------- compile TypeScript --------------------------
|
||||||
* ----------------------------------------------- */
|
* ----------------------------------------------- */
|
||||||
var typingsDone = plugins.Q.defer();
|
for (var key in config.ts) {
|
||||||
var typingsCounter = 0;
|
var outputPathIsDir;
|
||||||
var typingsCounterAdvance = function () {
|
try {
|
||||||
typingsCounter++;
|
if (plugins.fs.statSync(plugins.path.join(paths.cwd, config.ts[key])).isDirectory()) {
|
||||||
if (typeof config.typings[typingsCounter] != "undefined") {
|
outputPathIsDir = true;
|
||||||
installTypings();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
plugins.beautylog.success("custom typings installed successfully");
|
|
||||||
typingsDone.resolve();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var installTypings = function () {
|
|
||||||
plugins.beautylog.log("now installing " + "typings.json".yellow + " from " + config.typings[typingsCounter].blue);
|
|
||||||
plugins.typings.install({ production: false, cwd: plugins.path.join(paths.cwd, config.typings[typingsCounter]) })
|
|
||||||
.then(function () {
|
|
||||||
typingsCounterAdvance();
|
|
||||||
}, function () {
|
|
||||||
plugins.beautylog.error("something went wrong: Check if path is correct: " + config.typings[typingsCounter].blue);
|
|
||||||
typingsCounterAdvance();
|
|
||||||
});
|
|
||||||
};
|
|
||||||
installTypings();
|
|
||||||
/* -------------------------------------------------
|
|
||||||
* ----------- second compile TS -------------------
|
|
||||||
* ----------------------------------------------- */
|
|
||||||
typingsDone.promise.then(function () {
|
|
||||||
for (var key in config.ts) {
|
|
||||||
plugins.beautylog.log("now compiling" + key.blue);
|
|
||||||
var outputPathIsDir;
|
|
||||||
try {
|
|
||||||
if (plugins.fs.statSync(plugins.path.join(paths.cwd, config.ts[key])).isDirectory()) {
|
|
||||||
outputPathIsDir = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch (err) {
|
|
||||||
outputPathIsDir = false;
|
|
||||||
}
|
|
||||||
//do some evaluation of the environment
|
|
||||||
var outputNameSpecified = (!outputPathIsDir
|
|
||||||
&& (plugins.path.extname(config.ts[key]) == ".js"));
|
|
||||||
var outputName = (function () {
|
|
||||||
if (outputNameSpecified) {
|
|
||||||
return plugins.path.basename(config.ts[key]);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
var outputDir = (function () {
|
|
||||||
if (outputNameSpecified) {
|
|
||||||
return plugins.path.dirname(plugins.path.join(paths.cwd, config.ts[key]));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return plugins.path.join(paths.cwd, config.ts[key]);
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
var stream = plugins.gulp.src([plugins.path.join(paths.cwd, key), "!**/typings/**"])
|
|
||||||
.pipe(plugins.g.sourcemaps.init()) // This means sourcemaps will be generated
|
|
||||||
.pipe(plugins.g.typescript({
|
|
||||||
out: outputName,
|
|
||||||
target: "ES5",
|
|
||||||
module: "commonjs"
|
|
||||||
}))
|
|
||||||
.pipe(plugins.g.sourcemaps.write()) // Now the sourcemaps are added to the .js file
|
|
||||||
.pipe(plugins.gulp.dest(outputDir));
|
|
||||||
moduleStream.add(stream);
|
|
||||||
}
|
}
|
||||||
moduleStream.on("queueDrain", function () {
|
catch (err) {
|
||||||
plugins.beautylog.success("custom TypeScript installed successfully");
|
outputPathIsDir = false;
|
||||||
moduleStream.on("finish", function () {
|
}
|
||||||
done.resolve(config);
|
//do some evaluation of the environment
|
||||||
});
|
var outputNameSpecified = (!outputPathIsDir
|
||||||
moduleStream.end();
|
&& (plugins.path.extname(config.ts[key]) == ".js"));
|
||||||
|
var outputName = (function () {
|
||||||
|
if (outputNameSpecified) {
|
||||||
|
return plugins.path.basename(config.ts[key]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
var outputDir = (function () {
|
||||||
|
if (outputNameSpecified) {
|
||||||
|
return plugins.path.dirname(plugins.path.join(paths.cwd, config.ts[key]));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return plugins.path.join(paths.cwd, config.ts[key]);
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
var stream = plugins.gulp.src([plugins.path.join(paths.cwd, key), "!**/typings/**"])
|
||||||
|
.pipe(plugins.g.sourcemaps.init()) // This means sourcemaps will be generated
|
||||||
|
.pipe(plugins.g.typescript({
|
||||||
|
out: outputName,
|
||||||
|
target: "ES5",
|
||||||
|
module: "commonjs"
|
||||||
|
}))
|
||||||
|
.pipe(plugins.g.sourcemaps.write()) // Now the sourcemaps are added to the .js file
|
||||||
|
.pipe(plugins.gulp.dest(outputDir));
|
||||||
|
moduleStream.add(stream);
|
||||||
|
}
|
||||||
|
moduleStream.on("queueDrain", function () {
|
||||||
|
plugins.beautylog.ok("TypeScript is compiled!");
|
||||||
|
moduleStream.on("finish", function () {
|
||||||
|
done.resolve(config);
|
||||||
});
|
});
|
||||||
|
moduleStream.end();
|
||||||
});
|
});
|
||||||
|
/*==================== END TYPESCRIPT =====================*/
|
||||||
return done.promise;
|
return done.promise;
|
||||||
};
|
};
|
||||||
|
4
dist/npmts.configfile.js
vendored
4
dist/npmts.configfile.js
vendored
@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/env node
|
"use strict";
|
||||||
|
|
||||||
/// <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");
|
||||||
@ -18,6 +17,7 @@ exports.run = function () {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
plugins.beautylog.error("mode " + config.mode.yellow + " not recognised!".red);
|
plugins.beautylog.error("mode " + config.mode.yellow + " not recognised!".red);
|
||||||
|
process.exit(1);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
20
dist/npmts.install.js
vendored
Normal file
20
dist/npmts.install.js
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
"use strict";
|
||||||
|
/// <reference path="./typings/main.d.ts" />
|
||||||
|
var plugins = require("./npmts.plugins");
|
||||||
|
var paths = require("./npmts.paths");
|
||||||
|
exports.run = function (configArg) {
|
||||||
|
var config = configArg;
|
||||||
|
var done = plugins.Q.defer();
|
||||||
|
/* -------------------------------------------------
|
||||||
|
* ----------- install typings ---------------
|
||||||
|
* ----------------------------------------------- */
|
||||||
|
plugins.beautylog.log("now installing " + "typings".yellow);
|
||||||
|
var absoluteTypingsArray = plugins.smartpath.absolute(config.typings, paths.cwd);
|
||||||
|
plugins.gulp.src(absoluteTypingsArray)
|
||||||
|
.pipe(plugins.g.typings())
|
||||||
|
.pipe(plugins.g.gFunction(function () {
|
||||||
|
plugins.beautylog.ok("typings are installed!");
|
||||||
|
done.resolve(config);
|
||||||
|
}, "atEnd"));
|
||||||
|
return done.promise;
|
||||||
|
};
|
59
dist/npmts.jsdoc.js
vendored
59
dist/npmts.jsdoc.js
vendored
@ -1,9 +1,8 @@
|
|||||||
#!/usr/bin/env node
|
"use strict";
|
||||||
|
|
||||||
/// <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");
|
||||||
var genJsdoc = function () {
|
var genJsdoc = function (configArg) {
|
||||||
var done = plugins.Q.defer();
|
var 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([
|
||||||
@ -14,50 +13,48 @@ var genJsdoc = function () {
|
|||||||
opts: {
|
opts: {
|
||||||
destination: paths.docsDir
|
destination: paths.docsDir
|
||||||
}
|
}
|
||||||
}, done.resolve));
|
}, function () {
|
||||||
|
plugins.beautylog.ok("JsDoc has been generated!");
|
||||||
|
done.resolve(configArg);
|
||||||
|
}));
|
||||||
return done.promise;
|
return done.promise;
|
||||||
};
|
};
|
||||||
var publishDocs = function () {
|
var publishDocs = function (configArg) {
|
||||||
var done = plugins.Q.defer();
|
var done = plugins.Q.defer();
|
||||||
try {
|
var gitUrl = plugins.projectinfo.npm(paths.cwd, {
|
||||||
var gitUrl = plugins.projectinfo.npm(paths.cwd, {
|
gitAccessToken: process.env.GITHUB_TOKEN
|
||||||
gitAccessToken: process.env.GITHUB_TOKEN
|
}).git.httpsUrl;
|
||||||
}).git.httpsUrl;
|
var deployScript = ""
|
||||||
var deployScript = ""
|
+ "cd " + paths.docsDir + " "
|
||||||
+ "cd " + paths.docsDir + " "
|
+ "&& git init " + "> /dev/null 2>&1 "
|
||||||
+ "&& git init "
|
+ "&& git config user.name \"TRAVIS CI\" " + "> /dev/null 2>&1 "
|
||||||
+ "&& git config user.name \"TRAVIS CI\" "
|
+ "&& git config user.email \"travis@shipzone.io\" " + "> /dev/null 2>&1 "
|
||||||
+ "&& git config user.email \"travis@shipzone.io\" "
|
+ "&& git add . " + "> /dev/null 2>&1 "
|
||||||
+ "&& git add . "
|
+ "&& git commit -m \"Deploy to GitHub Pages\" " + "> /dev/null 2>&1 "
|
||||||
+ "&& git commit -m \"Deploy to GitHub Pages\" "
|
+ "&& git push --force --quiet "
|
||||||
+ "&& git push --force --quiet "
|
+ "\"" + gitUrl + "\" "
|
||||||
+ "\"" + gitUrl + "\" "
|
+ "master:gh-pages " + "> /dev/null 2>&1";
|
||||||
+ "master:gh-pages "
|
if (plugins.smartenv.getEnv().isTravis && configArg.docs && configArg.docs.publish) {
|
||||||
+ "> /dev/null 2>&1";
|
|
||||||
}
|
|
||||||
catch (err) {
|
|
||||||
console.log(err);
|
|
||||||
}
|
|
||||||
if (plugins.smartenv.getEnv().isTravis) {
|
|
||||||
plugins.beautylog.log("now publishing docs to GitHub");
|
plugins.beautylog.log("now publishing docs 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('Error: Git failed');
|
plugins.beautylog.error('Git failed!');
|
||||||
plugins.shelljs.exit(1);
|
plugins.shelljs.exit(1);
|
||||||
}
|
}
|
||||||
done.resolve();
|
plugins.beautylog.ok("JsDoc has been deployed to GitHub!");
|
||||||
|
done.resolve(configArg);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
done.resolve();
|
done.resolve(configArg);
|
||||||
}
|
}
|
||||||
return done.promise;
|
return done.promise;
|
||||||
};
|
};
|
||||||
exports.run = function () {
|
exports.run = function (configArg) {
|
||||||
var done = plugins.Q.defer();
|
var done = plugins.Q.defer();
|
||||||
genJsdoc()
|
genJsdoc(configArg)
|
||||||
.then(publishDocs)
|
.then(publishDocs)
|
||||||
.then(done.resolve);
|
.then(done.resolve);
|
||||||
return done.promise;
|
return done.promise;
|
||||||
|
5
dist/npmts.options.js
vendored
5
dist/npmts.options.js
vendored
@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/env node
|
"use strict";
|
||||||
|
|
||||||
/// <reference path="./typings/main.d.ts" />
|
/// <reference path="./typings/main.d.ts" />
|
||||||
var plugins = require("./npmts.plugins");
|
var plugins = require("./npmts.plugins");
|
||||||
exports.run = function (configArg) {
|
exports.run = function (configArg) {
|
||||||
@ -10,7 +9,7 @@ exports.run = function (configArg) {
|
|||||||
}
|
}
|
||||||
if (config.mode == "default") {
|
if (config.mode == "default") {
|
||||||
config.typings = [
|
config.typings = [
|
||||||
"./ts/"
|
"./ts/typings.json"
|
||||||
];
|
];
|
||||||
config.ts = (_a = {},
|
config.ts = (_a = {},
|
||||||
_a["./ts/**/*.ts"] = "./dist/",
|
_a["./ts/**/*.ts"] = "./dist/",
|
||||||
|
4
dist/npmts.paths.js
vendored
4
dist/npmts.paths.js
vendored
@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/env node
|
"use strict";
|
||||||
|
|
||||||
/// <reference path="./typings/main.d.ts" />
|
/// <reference path="./typings/main.d.ts" />
|
||||||
var plugins = require("./npmts.plugins");
|
var plugins = require("./npmts.plugins");
|
||||||
var paths = {};
|
var paths = {};
|
||||||
@ -9,6 +8,7 @@ paths.tsDir = plugins.path.join(paths.cwd, "ts/");
|
|||||||
paths.distDir = plugins.path.join(paths.cwd, "dist/");
|
paths.distDir = plugins.path.join(paths.cwd, "dist/");
|
||||||
paths.docsDir = plugins.path.join(paths.cwd, "docs/");
|
paths.docsDir = plugins.path.join(paths.cwd, "docs/");
|
||||||
paths.testDir = plugins.path.join(paths.cwd, "test/");
|
paths.testDir = plugins.path.join(paths.cwd, "test/");
|
||||||
|
paths.npmtsAssetsDir = plugins.path.join(__dirname, "../assets/");
|
||||||
//Files
|
//Files
|
||||||
paths.indexTS = plugins.path.join(paths.cwd, "ts/index.ts");
|
paths.indexTS = plugins.path.join(paths.cwd, "ts/index.ts");
|
||||||
paths.testTS = plugins.path.join(paths.cwd, "ts/test.ts");
|
paths.testTS = plugins.path.join(paths.cwd, "ts/test.ts");
|
||||||
|
8
dist/npmts.plugins.js
vendored
8
dist/npmts.plugins.js
vendored
@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/env node
|
"use strict";
|
||||||
|
|
||||||
/// <reference path="./typings/main.d.ts" />
|
/// <reference path="./typings/main.d.ts" />
|
||||||
var plugins = {
|
var plugins = {
|
||||||
beautylog: require("beautylog"),
|
beautylog: require("beautylog"),
|
||||||
@ -12,7 +11,8 @@ var plugins = {
|
|||||||
jsdoc3: require("gulp-jsdoc3"),
|
jsdoc3: require("gulp-jsdoc3"),
|
||||||
mocha: require("gulp-mocha"),
|
mocha: require("gulp-mocha"),
|
||||||
sourcemaps: require("gulp-sourcemaps"),
|
sourcemaps: require("gulp-sourcemaps"),
|
||||||
typescript: require("gulp-typescript")
|
typescript: require("gulp-typescript"),
|
||||||
|
typings: require("gulp-typings")
|
||||||
},
|
},
|
||||||
merge2: require("merge2"),
|
merge2: require("merge2"),
|
||||||
projectinfo: require("projectinfo"),
|
projectinfo: require("projectinfo"),
|
||||||
@ -23,6 +23,6 @@ var plugins = {
|
|||||||
smartcli: require("smartcli"),
|
smartcli: require("smartcli"),
|
||||||
smartenv: require("smartenv"),
|
smartenv: require("smartenv"),
|
||||||
smartfile: require("smartfile"),
|
smartfile: require("smartfile"),
|
||||||
typings: require("typings")
|
smartpath: require("smartpath")
|
||||||
};
|
};
|
||||||
module.exports = plugins;
|
module.exports = plugins;
|
||||||
|
34
dist/npmts.promisechain.js
vendored
34
dist/npmts.promisechain.js
vendored
@ -1,17 +1,41 @@
|
|||||||
#!/usr/bin/env node
|
"use strict";
|
||||||
|
|
||||||
/// <reference path="./typings/main.d.ts" />
|
/// <reference path="./typings/main.d.ts" />
|
||||||
var NpmtsConfigFile = require("./npmts.configfile");
|
var plugins = require("./npmts.plugins");
|
||||||
var NpmtsOptions = require("./npmts.options");
|
var NpmtsAssets = require("./npmts.assets");
|
||||||
var NpmtsCompile = require("./npmts.compile");
|
var NpmtsCompile = require("./npmts.compile");
|
||||||
|
var NpmtsConfigFile = require("./npmts.configfile");
|
||||||
|
var NpmtsInstall = require("./npmts.install");
|
||||||
var NpmtsJsdoc = require("./npmts.jsdoc");
|
var NpmtsJsdoc = require("./npmts.jsdoc");
|
||||||
|
var NpmtsOptions = require("./npmts.options");
|
||||||
var NpmtsTests = require("./npmts.tests");
|
var NpmtsTests = require("./npmts.tests");
|
||||||
exports.run = function () {
|
exports.run = function () {
|
||||||
var promisechain;
|
var promisechain;
|
||||||
NpmtsConfigFile.run()
|
NpmtsConfigFile.run()
|
||||||
.then(NpmtsOptions.run)
|
.then(NpmtsOptions.run)
|
||||||
|
.then(NpmtsInstall.run)
|
||||||
.then(NpmtsCompile.run)
|
.then(NpmtsCompile.run)
|
||||||
|
.then(NpmtsAssets.run)
|
||||||
.then(NpmtsJsdoc.run)
|
.then(NpmtsJsdoc.run)
|
||||||
.then(NpmtsTests.run);
|
.then(NpmtsTests.run)
|
||||||
|
.then(function (configArg) {
|
||||||
|
var shipString = "" +
|
||||||
|
"\n" +
|
||||||
|
"\n" +
|
||||||
|
" # # ( )\n" +
|
||||||
|
" ___#_#___|__\n" +
|
||||||
|
" _ |____________| _\n" +
|
||||||
|
" _=====| | | | | |==== _\n" +
|
||||||
|
" =====| |.---------------------------. | |====\n" +
|
||||||
|
" <--------------------' . . . . . . . . '--------------/\n" +
|
||||||
|
" \\ /\n" +
|
||||||
|
" \\___________________________________________________________/\n" +
|
||||||
|
" wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\n" +
|
||||||
|
" wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\n" +
|
||||||
|
" wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\n";
|
||||||
|
if (process.env.CI) {
|
||||||
|
console.log(shipString);
|
||||||
|
plugins.beautylog.success("READY TO SHIP!");
|
||||||
|
}
|
||||||
|
});
|
||||||
return promisechain;
|
return promisechain;
|
||||||
};
|
};
|
||||||
|
10
dist/npmts.tests.js
vendored
10
dist/npmts.tests.js
vendored
@ -1,5 +1,4 @@
|
|||||||
#!/usr/bin/env node
|
"use strict";
|
||||||
|
|
||||||
/// <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");
|
||||||
@ -22,9 +21,13 @@ exports.run = function (configArg) {
|
|||||||
var coveralls = function () {
|
var coveralls = function () {
|
||||||
plugins.beautylog.log("now uploading coverage data to coveralls");
|
plugins.beautylog.log("now uploading coverage data to coveralls");
|
||||||
var stream = plugins.gulp.src([plugins.path.join(paths.cwd, "./coverage/lcov.info")])
|
var stream = plugins.gulp.src([plugins.path.join(paths.cwd, "./coverage/lcov.info")])
|
||||||
.pipe(plugins.g.coveralls());
|
.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;
|
return stream;
|
||||||
};
|
};
|
||||||
|
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) {
|
if (plugins.smartenv.getEnv().isTravis && config.coveralls) {
|
||||||
@ -33,6 +36,7 @@ exports.run = function (configArg) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
plugins.beautylog.ok("Tests have passed!");
|
||||||
done.resolve(config);
|
done.resolve(config);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
21
package.json
21
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "npmts",
|
"name": "npmts",
|
||||||
"version": "3.2.0",
|
"version": "3.5.0",
|
||||||
"description": "write npm modules with TypeScript",
|
"description": "write npm modules with TypeScript",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
@ -31,25 +31,22 @@
|
|||||||
"gulp-concat": "^2.6.0",
|
"gulp-concat": "^2.6.0",
|
||||||
"gulp-coveralls": "^0.1.4",
|
"gulp-coveralls": "^0.1.4",
|
||||||
"gulp-function": "^1.1.1",
|
"gulp-function": "^1.1.1",
|
||||||
"gulp-header": "^1.7.1",
|
|
||||||
"gulp-if": "^2.0.0",
|
"gulp-if": "^2.0.0",
|
||||||
"gulp-istanbul": "^0.10.3",
|
"gulp-istanbul": "^0.10.3",
|
||||||
"gulp-jsdoc3": "^0.2.0",
|
"gulp-jsdoc3": "^0.2.1",
|
||||||
"gulp-mocha": "^2.2.0",
|
"gulp-mocha": "^2.2.0",
|
||||||
"gulp-sourcemaps": "^1.6.0",
|
"gulp-sourcemaps": "^1.6.0",
|
||||||
"gulp-typescript": "2.11.0",
|
"gulp-typescript": "2.12.1",
|
||||||
"gulp-typings": "1.1.0",
|
"gulp-typings": "1.2.0",
|
||||||
"merge2": "1.0.1",
|
"merge2": "1.0.1",
|
||||||
"projectinfo": "1.0.1",
|
"projectinfo": "1.0.1",
|
||||||
"q": "^1.4.1",
|
"q": "^1.4.1",
|
||||||
"shelljs": "^0.6.0",
|
"shelljs": "^0.6.0",
|
||||||
"smartcli": "0.0.11",
|
"smartcli": "0.0.11",
|
||||||
"smartenv": "1.1.0",
|
"smartenv": "1.2.0",
|
||||||
"smartfile": "0.0.11",
|
"smartfile": "1.0.1",
|
||||||
"source-map-support": "^0.4.0",
|
"smartpath": "2.1.0",
|
||||||
"typings": "^0.6.8"
|
"source-map-support": "^0.4.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {}
|
||||||
"gulp-header": "^1.7.1"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
3
test/assets/custom.js
Normal file
3
test/assets/custom.js
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
var hello = "hello";
|
||||||
|
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImN1c3RvbS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxJQUFJLEtBQUssR0FBRyxPQUFPLENBQUMiLCJmaWxlIjoiY3VzdG9tLmpzIiwic291cmNlc0NvbnRlbnQiOlsidmFyIGhlbGxvID0gXCJoZWxsb1wiOyJdLCJzb3VyY2VSb290IjoiL3NvdXJjZS8ifQ==
|
2
test/assets/dist/cli.js
vendored
Normal file
2
test/assets/dist/cli.js
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
var index = require("./index.js");
|
@ -1,13 +1,17 @@
|
|||||||
{
|
{
|
||||||
"mode":"default",
|
"mode":"custom",
|
||||||
"ts":{
|
"ts":{
|
||||||
"./customdir/*.ts":"./"
|
"./customdir/*.ts":"./"
|
||||||
},
|
},
|
||||||
"typings":[
|
"typings":[
|
||||||
"./ts",
|
"./ts/typings.json",
|
||||||
"./subts1/",
|
"./subts1/typings.json",
|
||||||
"./subts2/",
|
"./subts2/typings.json",
|
||||||
"./customdir"
|
"./customdir/typings.json"
|
||||||
],
|
],
|
||||||
"coveralls":true
|
"coveralls":true,
|
||||||
|
"docs": {
|
||||||
|
"publish":true
|
||||||
|
},
|
||||||
|
"cli":true
|
||||||
}
|
}
|
@ -5,7 +5,7 @@
|
|||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/sometest/somerepo.git"
|
"url": "git+https://github.com/pushrocks/npmts.git"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(npmts)"
|
"test": "(npmts)"
|
||||||
|
3
test/assets/tsfile1.js
Normal file
3
test/assets/tsfile1.js
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
var something = "something";
|
||||||
|
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRzZmlsZTEudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsSUFBSSxTQUFTLEdBQUcsV0FBVyxDQUFDIiwiZmlsZSI6InRzZmlsZTEuanMiLCJzb3VyY2VzQ29udGVudCI6WyJ2YXIgc29tZXRoaW5nID0gXCJzb21ldGhpbmdcIjsiXSwic291cmNlUm9vdCI6Ii9zb3VyY2UvIn0=
|
15
ts/npmts.assets.ts
Normal file
15
ts/npmts.assets.ts
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
/// <reference path="./typings/main.d.ts" />
|
||||||
|
import plugins = require("./npmts.plugins");
|
||||||
|
import paths = require("./npmts.paths");
|
||||||
|
|
||||||
|
export var run = function(configArg){
|
||||||
|
let done = plugins.Q.defer();
|
||||||
|
let config = configArg;
|
||||||
|
if(config.cli == true){
|
||||||
|
plugins.smartfile.copy(plugins.path.join(paths.npmtsAssetsDir,"cli.js"),paths.distDir);
|
||||||
|
done.resolve(config);
|
||||||
|
} else {
|
||||||
|
done.resolve(config);
|
||||||
|
}
|
||||||
|
return done.promise;
|
||||||
|
};
|
@ -4,89 +4,66 @@ import paths = require("./npmts.paths");
|
|||||||
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;
|
||||||
plugins.beautylog.log("now running custom tasks");
|
plugins.beautylog.log("now compiling " + "TypeScript".yellow);
|
||||||
var moduleStream = plugins.merge2({end: false});
|
var moduleStream = plugins.merge2({end: false});
|
||||||
/* -------------------------------------------------
|
|
||||||
* ----------- first install typings ---------------
|
|
||||||
* ----------------------------------------------- */
|
|
||||||
var typingsDone = plugins.Q.defer();
|
|
||||||
var typingsCounter:number = 0;
|
|
||||||
var typingsCounterAdvance = function(){
|
|
||||||
typingsCounter++;
|
|
||||||
if(typeof config.typings[typingsCounter] != "undefined"){
|
|
||||||
installTypings();
|
|
||||||
} else {
|
|
||||||
plugins.beautylog.success("custom typings installed successfully");
|
|
||||||
typingsDone.resolve();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
var installTypings = function() {
|
|
||||||
plugins.beautylog.log("now installing " + "typings.json".yellow + " from " + config.typings[typingsCounter].blue);
|
|
||||||
plugins.typings.install({production: false, cwd: plugins.path.join(paths.cwd,config.typings[typingsCounter])})
|
|
||||||
.then(function(){
|
|
||||||
typingsCounterAdvance();
|
|
||||||
},function(){
|
|
||||||
plugins.beautylog.error("something went wrong: Check if path is correct: " + config.typings[typingsCounter].blue);
|
|
||||||
typingsCounterAdvance();
|
|
||||||
});
|
|
||||||
};
|
|
||||||
installTypings();
|
|
||||||
/* -------------------------------------------------
|
|
||||||
* ----------- second compile TS -------------------
|
|
||||||
* ----------------------------------------------- */
|
|
||||||
typingsDone.promise.then(function(){
|
|
||||||
for (var key in config.ts) {
|
|
||||||
plugins.beautylog.log("now compiling" + key.blue);
|
|
||||||
var outputPathIsDir:boolean;
|
|
||||||
try {
|
|
||||||
if(plugins.fs.statSync(plugins.path.join(paths.cwd,config.ts[key])).isDirectory()){
|
|
||||||
outputPathIsDir = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch(err) {
|
|
||||||
outputPathIsDir = false;
|
|
||||||
}
|
|
||||||
//do some evaluation of the environment
|
|
||||||
var outputNameSpecified:boolean = (
|
|
||||||
!outputPathIsDir
|
|
||||||
&& (plugins.path.extname(config.ts[key]) == ".js")
|
|
||||||
);
|
|
||||||
var outputName = (function(){
|
|
||||||
if(outputNameSpecified){
|
|
||||||
return plugins.path.basename(config.ts[key])
|
|
||||||
} else {
|
|
||||||
return undefined
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
var outputDir = (function(){
|
|
||||||
if(outputNameSpecified){
|
|
||||||
return plugins.path.dirname(
|
|
||||||
plugins.path.join(paths.cwd,config.ts[key])
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
return plugins.path.join(paths.cwd,config.ts[key])
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
|
|
||||||
var stream = plugins.gulp.src([plugins.path.join(paths.cwd,key),"!**/typings/**"])
|
/* -------------------------------------------------
|
||||||
.pipe(plugins.g.sourcemaps.init()) // This means sourcemaps will be generated
|
* ----------- compile TypeScript --------------------------
|
||||||
.pipe(plugins.g.typescript({
|
* ----------------------------------------------- */
|
||||||
out: outputName,
|
for (var key in config.ts) {
|
||||||
target: "ES5",
|
var outputPathIsDir:boolean;
|
||||||
module: "commonjs"
|
try {
|
||||||
}))
|
if(plugins.fs.statSync(plugins.path.join(paths.cwd,config.ts[key])).isDirectory()){
|
||||||
.pipe(plugins.g.sourcemaps.write()) // Now the sourcemaps are added to the .js file
|
outputPathIsDir = true;
|
||||||
//.pipe(plugins.g.header('#!/usr/bin/env node\n\n'))
|
}
|
||||||
.pipe(plugins.gulp.dest(outputDir));
|
|
||||||
moduleStream.add(stream);
|
|
||||||
}
|
}
|
||||||
moduleStream.on("queueDrain",function(){
|
catch(err) {
|
||||||
plugins.beautylog.success("custom TypeScript installed successfully");
|
outputPathIsDir = false;
|
||||||
moduleStream.on("finish",function(){
|
}
|
||||||
done.resolve(config);
|
//do some evaluation of the environment
|
||||||
});
|
var outputNameSpecified:boolean = (
|
||||||
moduleStream.end();
|
!outputPathIsDir
|
||||||
|
&& (plugins.path.extname(config.ts[key]) == ".js")
|
||||||
|
);
|
||||||
|
var outputName = (function(){
|
||||||
|
if(outputNameSpecified){
|
||||||
|
return plugins.path.basename(config.ts[key])
|
||||||
|
} else {
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
var outputDir = (function(){
|
||||||
|
if(outputNameSpecified){
|
||||||
|
return plugins.path.dirname(
|
||||||
|
plugins.path.join(paths.cwd,config.ts[key])
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
return plugins.path.join(paths.cwd,config.ts[key])
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
|
var stream = plugins.gulp.src([plugins.path.join(paths.cwd,key),"!**/typings/**"])
|
||||||
|
.pipe(plugins.g.sourcemaps.init()) // This means sourcemaps will be generated
|
||||||
|
.pipe(plugins.g.typescript({
|
||||||
|
out: outputName,
|
||||||
|
target: "ES5",
|
||||||
|
module: "commonjs"
|
||||||
|
}))
|
||||||
|
.pipe(plugins.g.sourcemaps.write()) // Now the sourcemaps are added to the .js file
|
||||||
|
//.pipe(plugins.g.header('#!/usr/bin/env node\n\n'))
|
||||||
|
.pipe(plugins.gulp.dest(outputDir));
|
||||||
|
moduleStream.add(stream);
|
||||||
|
}
|
||||||
|
moduleStream.on("queueDrain",function(){
|
||||||
|
plugins.beautylog.ok("TypeScript is compiled!");
|
||||||
|
moduleStream.on("finish",function(){
|
||||||
|
done.resolve(config);
|
||||||
});
|
});
|
||||||
|
moduleStream.end();
|
||||||
});
|
});
|
||||||
|
/*==================== END TYPESCRIPT =====================*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return done.promise;
|
return done.promise;
|
||||||
};
|
};
|
||||||
|
@ -16,6 +16,7 @@ export var run = function(){
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
plugins.beautylog.error("mode " + config.mode.yellow + " not recognised!".red);
|
plugins.beautylog.error("mode " + config.mode.yellow + " not recognised!".red);
|
||||||
|
process.exit(1);
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
plugins.beautylog.log("no config file found: so mode is " + "default".yellow);
|
plugins.beautylog.log("no config file found: so mode is " + "default".yellow);
|
||||||
|
19
ts/npmts.install.ts
Normal file
19
ts/npmts.install.ts
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
/// <reference path="./typings/main.d.ts" />
|
||||||
|
import plugins = require("./npmts.plugins");
|
||||||
|
import paths = require("./npmts.paths");
|
||||||
|
export var run = function(configArg){
|
||||||
|
var config = configArg;
|
||||||
|
var done = plugins.Q.defer();
|
||||||
|
/* -------------------------------------------------
|
||||||
|
* ----------- install typings ---------------
|
||||||
|
* ----------------------------------------------- */
|
||||||
|
plugins.beautylog.log("now installing " + "typings".yellow);
|
||||||
|
let absoluteTypingsArray = plugins.smartpath.absolute(config.typings,paths.cwd);
|
||||||
|
plugins.gulp.src(absoluteTypingsArray)
|
||||||
|
.pipe(plugins.g.typings())
|
||||||
|
.pipe(plugins.g.gFunction(function(){
|
||||||
|
plugins.beautylog.ok("typings are installed!");
|
||||||
|
done.resolve(config);
|
||||||
|
},"atEnd"));
|
||||||
|
return done.promise;
|
||||||
|
};
|
@ -2,7 +2,7 @@
|
|||||||
import plugins = require("./npmts.plugins");
|
import plugins = require("./npmts.plugins");
|
||||||
import paths = require("./npmts.paths");
|
import paths = require("./npmts.paths");
|
||||||
|
|
||||||
var genJsdoc = function(){
|
var genJsdoc = function(configArg){
|
||||||
var done = plugins.Q.defer();
|
var 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([
|
||||||
@ -13,56 +13,54 @@ var genJsdoc = function(){
|
|||||||
opts: {
|
opts: {
|
||||||
destination: paths.docsDir
|
destination: paths.docsDir
|
||||||
}
|
}
|
||||||
}, done.resolve));
|
}, function(){
|
||||||
|
plugins.beautylog.ok("JsDoc has been generated!");
|
||||||
|
done.resolve(configArg)
|
||||||
|
}));
|
||||||
return done.promise;
|
return done.promise;
|
||||||
};
|
};
|
||||||
|
|
||||||
var publishDocs = function(){
|
var publishDocs = function(configArg){
|
||||||
var done = plugins.Q.defer();
|
var done = plugins.Q.defer();
|
||||||
try {
|
var gitUrl = plugins.projectinfo.npm(
|
||||||
var gitUrl = plugins.projectinfo.npm(
|
paths.cwd,
|
||||||
paths.cwd,
|
{
|
||||||
{
|
gitAccessToken:process.env.GITHUB_TOKEN
|
||||||
gitAccessToken:process.env.GITHUB_TOKEN
|
}
|
||||||
}
|
).git.httpsUrl;
|
||||||
).git.httpsUrl;
|
|
||||||
|
|
||||||
var deployScript = ""
|
var deployScript = ""
|
||||||
+ "cd " + paths.docsDir + " "
|
+ "cd " + paths.docsDir + " "
|
||||||
+ "&& git init "
|
+ "&& git init " + "> /dev/null 2>&1 "
|
||||||
+ "&& git config user.name \"TRAVIS CI\" "
|
+ "&& git config user.name \"TRAVIS CI\" " + "> /dev/null 2>&1 "
|
||||||
+ "&& git config user.email \"travis@shipzone.io\" "
|
+ "&& git config user.email \"travis@shipzone.io\" " + "> /dev/null 2>&1 "
|
||||||
+ "&& git add . "
|
+ "&& git add . " + "> /dev/null 2>&1 "
|
||||||
+ "&& git commit -m \"Deploy to GitHub Pages\" "
|
+ "&& git commit -m \"Deploy to GitHub Pages\" " + "> /dev/null 2>&1 "
|
||||||
+ "&& git push --force --quiet "
|
+ "&& git push --force --quiet "
|
||||||
+ "\"" + gitUrl + "\" "
|
+ "\"" + gitUrl + "\" "
|
||||||
+ "master:gh-pages "
|
+ "master:gh-pages " + "> /dev/null 2>&1";
|
||||||
+ "> /dev/null 2>&1";
|
|
||||||
}
|
|
||||||
catch (err){
|
|
||||||
console.log(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(plugins.smartenv.getEnv().isTravis){
|
if(plugins.smartenv.getEnv().isTravis && configArg.docs && configArg.docs.publish){
|
||||||
plugins.beautylog.log("now publishing docs to GitHub")
|
plugins.beautylog.log("now publishing docs 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('Error: Git failed');
|
plugins.beautylog.error('Git failed!');
|
||||||
plugins.shelljs.exit(1);
|
plugins.shelljs.exit(1);
|
||||||
}
|
}
|
||||||
done.resolve();
|
plugins.beautylog.ok("JsDoc has been deployed to GitHub!");
|
||||||
|
done.resolve(configArg);
|
||||||
} else {
|
} else {
|
||||||
done.resolve();
|
done.resolve(configArg);
|
||||||
}
|
}
|
||||||
return done.promise;
|
return done.promise;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export var run = function(){
|
export var run = function(configArg){
|
||||||
var done = plugins.Q.defer();
|
var done = plugins.Q.defer();
|
||||||
genJsdoc()
|
genJsdoc(configArg)
|
||||||
.then(publishDocs)
|
.then(publishDocs)
|
||||||
.then(done.resolve);
|
.then(done.resolve);
|
||||||
return done.promise;
|
return done.promise;
|
||||||
|
@ -8,7 +8,7 @@ export var run = function(configArg){
|
|||||||
}
|
}
|
||||||
if (config.mode == "default"){
|
if (config.mode == "default"){
|
||||||
config.typings = [
|
config.typings = [
|
||||||
"./ts/"
|
"./ts/typings.json"
|
||||||
];
|
];
|
||||||
config.ts = {
|
config.ts = {
|
||||||
["./ts/**/*.ts"]: "./dist/",
|
["./ts/**/*.ts"]: "./dist/",
|
||||||
|
@ -9,6 +9,8 @@ paths.distDir = plugins.path.join(paths.cwd,"dist/");
|
|||||||
paths.docsDir = plugins.path.join(paths.cwd,"docs/");
|
paths.docsDir = plugins.path.join(paths.cwd,"docs/");
|
||||||
paths.testDir = plugins.path.join(paths.cwd,"test/");
|
paths.testDir = plugins.path.join(paths.cwd,"test/");
|
||||||
|
|
||||||
|
paths.npmtsAssetsDir = plugins.path.join(__dirname,"../assets/");
|
||||||
|
|
||||||
//Files
|
//Files
|
||||||
paths.indexTS = plugins.path.join(paths.cwd,"ts/index.ts");
|
paths.indexTS = plugins.path.join(paths.cwd,"ts/index.ts");
|
||||||
paths.testTS = plugins.path.join(paths.cwd,"ts/test.ts");
|
paths.testTS = plugins.path.join(paths.cwd,"ts/test.ts");
|
||||||
|
@ -10,7 +10,8 @@ var plugins = {
|
|||||||
jsdoc3: require("gulp-jsdoc3"),
|
jsdoc3: require("gulp-jsdoc3"),
|
||||||
mocha: require("gulp-mocha"),
|
mocha: require("gulp-mocha"),
|
||||||
sourcemaps: require("gulp-sourcemaps"),
|
sourcemaps: require("gulp-sourcemaps"),
|
||||||
typescript: require("gulp-typescript")
|
typescript: require("gulp-typescript"),
|
||||||
|
typings: require("gulp-typings")
|
||||||
|
|
||||||
},
|
},
|
||||||
merge2: require("merge2"),
|
merge2: require("merge2"),
|
||||||
@ -22,6 +23,6 @@ var plugins = {
|
|||||||
smartcli: require("smartcli"),
|
smartcli: require("smartcli"),
|
||||||
smartenv: require("smartenv"),
|
smartenv: require("smartenv"),
|
||||||
smartfile: require("smartfile"),
|
smartfile: require("smartfile"),
|
||||||
typings: require("typings")
|
smartpath: require("smartpath")
|
||||||
};
|
};
|
||||||
export = plugins;
|
export = plugins;
|
@ -1,15 +1,43 @@
|
|||||||
/// <reference path="./typings/main.d.ts" />
|
/// <reference path="./typings/main.d.ts" />
|
||||||
import NpmtsConfigFile = require("./npmts.configfile");
|
import plugins = require("./npmts.plugins");
|
||||||
import NpmtsOptions = require("./npmts.options");
|
|
||||||
|
import NpmtsAssets = require("./npmts.assets");
|
||||||
import NpmtsCompile = require("./npmts.compile");
|
import NpmtsCompile = require("./npmts.compile");
|
||||||
|
import NpmtsConfigFile = require("./npmts.configfile");
|
||||||
|
import NpmtsInstall = require("./npmts.install");
|
||||||
import NpmtsJsdoc = require("./npmts.jsdoc");
|
import NpmtsJsdoc = require("./npmts.jsdoc");
|
||||||
|
import NpmtsOptions = require("./npmts.options");
|
||||||
import NpmtsTests = require("./npmts.tests");
|
import NpmtsTests = require("./npmts.tests");
|
||||||
|
|
||||||
export var run = function(){
|
export var run = function(){
|
||||||
var promisechain;
|
var promisechain;
|
||||||
NpmtsConfigFile.run()
|
NpmtsConfigFile.run()
|
||||||
.then(NpmtsOptions.run)
|
.then(NpmtsOptions.run)
|
||||||
|
.then(NpmtsInstall.run)
|
||||||
.then(NpmtsCompile.run)
|
.then(NpmtsCompile.run)
|
||||||
|
.then(NpmtsAssets.run)
|
||||||
.then(NpmtsJsdoc.run)
|
.then(NpmtsJsdoc.run)
|
||||||
.then(NpmtsTests.run);
|
.then(NpmtsTests.run)
|
||||||
|
.then(function(configArg){
|
||||||
|
let shipString = "" +
|
||||||
|
"\n" +
|
||||||
|
"\n" +
|
||||||
|
" # # ( )\n" +
|
||||||
|
" ___#_#___|__\n" +
|
||||||
|
" _ |____________| _\n" +
|
||||||
|
" _=====| | | | | |==== _\n" +
|
||||||
|
" =====| |.---------------------------. | |====\n" +
|
||||||
|
" <--------------------' . . . . . . . . '--------------/\n" +
|
||||||
|
" \\ /\n" +
|
||||||
|
" \\___________________________________________________________/\n" +
|
||||||
|
" wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\n" +
|
||||||
|
" wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\n" +
|
||||||
|
" wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\n"
|
||||||
|
if (process.env.CI){
|
||||||
|
console.log(shipString);
|
||||||
|
plugins.beautylog.success("READY TO SHIP!");
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
return promisechain;
|
return promisechain;
|
||||||
};
|
};
|
@ -26,10 +26,14 @@ export var run = function(configArg) {
|
|||||||
var coveralls = function(){
|
var coveralls = function(){
|
||||||
plugins.beautylog.log("now uploading coverage data to coveralls");
|
plugins.beautylog.log("now uploading coverage data to coveralls");
|
||||||
var stream = plugins.gulp.src([plugins.path.join(paths.cwd,"./coverage/lcov.info")])
|
var stream = plugins.gulp.src([plugins.path.join(paths.cwd,"./coverage/lcov.info")])
|
||||||
.pipe(plugins.g.coveralls());
|
.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;
|
return stream;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
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){
|
if(plugins.smartenv.getEnv().isTravis && config.coveralls){
|
||||||
@ -37,6 +41,7 @@ export var run = function(configArg) {
|
|||||||
done.resolve(config);
|
done.resolve(config);
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
plugins.beautylog.ok("Tests have passed!");
|
||||||
done.resolve(config);
|
done.resolve(config);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Reference in New Issue
Block a user