add --nodocs option

This commit is contained in:
Philipp Kunz 2016-08-13 23:54:17 +02:00
parent 2c254a2ecf
commit db1cfe4746
5 changed files with 51 additions and 31 deletions

View File

@ -8,12 +8,17 @@ exports.run = function (argvArg) {
npmts_promisechain_1.npmtsOra.text("looking for npmextra.json");
var defaultConfig = {
mode: "default",
notest: false
notest: false,
nodocs: false
};
if (argvArg.notest) {
defaultConfig.notest = true;
}
;
if (argvArg.nodocs) {
defaultConfig.nodocs = true;
}
;
var config = plugins.npmextra.dataFor({
toolName: "npmts",
defaultSettings: defaultConfig,

View File

@ -27,9 +27,15 @@ var genTypeDoc = function (configArg) {
};
exports.run = function (configArg) {
var done = plugins.Q.defer();
if (configArg.nodocs) {
done.resolve(configArg);
}
else {
genTypeDoc(configArg)
.then(function () {
done.resolve(configArg);
});
}
;
return done.promise;
};

View File

@ -7,12 +7,13 @@
"npmts": "dist/cli.js"
},
"scripts": {
"test": "(npm run compile && npm run setupCheck && npm run check && npm run checkVersion && npm run checkNoTest)",
"test": "(npm run compile && npm run setupCheck && npm run check && npm run checkVersion && npm run checkNoTest && npm run checkNoDocs)",
"compile": "(rm -rf test/ && rm -r dist/ && mkdir dist/ && tsc && cp assets/cli.js dist/ )",
"setupCheck": "(git clone https://gitlab.com/sandboxzone/sandbox-npmts.git test/)",
"check": "(cd test && npm install && node ../dist/index.js)",
"checkVersion": "(cd test/ && node ../dist/index.js -v)",
"checkNoTest": "(cd test && node ../dist/index.js --notest)"
"checkNoTest": "(cd test && node ../dist/index.js --notest)",
"checkNoDocs": "(cd test && node ../dist/index.js --nodocs)"
},
"repository": {
"type": "git",

View File

@ -7,11 +7,15 @@ export var run = function(argvArg){
npmtsOra.text("looking for npmextra.json");
let defaultConfig = {
mode: "default",
notest:false
notest:false,
nodocs:false
};
if(argvArg.notest){
defaultConfig.notest = true;
};
if(argvArg.nodocs){
defaultConfig.nodocs = true;
};
let config = plugins.npmextra.dataFor({
toolName:"npmts",
defaultSettings:defaultConfig,

View File

@ -1,13 +1,13 @@
import "typings-global";
import plugins = require("./npmts.plugins");
import paths = require("./npmts.paths");
import {npmtsOra} from "./npmts.promisechain";
import { npmtsOra } from "./npmts.promisechain";
let genTypeDoc = function(configArg){
let genTypeDoc = function (configArg) {
let done = plugins.Q.defer();
npmtsOra.text("now generating " + "TypeDoc documentation".yellow);
plugins.beautylog.log("TypeDoc Output:");
plugins.gulp.src(plugins.path.join(paths.tsDir,"**/*.ts"))
plugins.gulp.src(plugins.path.join(paths.tsDir, "**/*.ts"))
.pipe(plugins.g.typedoc({
// TypeScript options (see typescript docs)
module: "commonjs",
@ -16,7 +16,7 @@ let genTypeDoc = function(configArg){
// Output options (see typedoc docs)
out: paths.docsDir,
json: plugins.path.join(paths.docsDir,"file.json"),
json: plugins.path.join(paths.docsDir, "file.json"),
// TypeDoc options (see typedoc docs)
name: "my-project",
@ -25,16 +25,20 @@ let genTypeDoc = function(configArg){
ignoreCompilerErrors: true,
version: true,
}))
.pipe(plugins.g.gFunction(done.resolve,"atEnd"));
.pipe(plugins.g.gFunction(done.resolve, "atEnd"));
return done.promise;
};
export let run = function(configArg){
export let run = function (configArg) {
let done = plugins.Q.defer();
if (configArg.nodocs) {
done.resolve(configArg);
} else {
genTypeDoc(configArg)
.then(() => {
done.resolve(configArg);
});
};
return done.promise;
};