From db1cfe4746c5d1dda64dcc8bf2ac3b84504b1f04 Mon Sep 17 00:00:00 2001 From: philkunz Date: Sat, 13 Aug 2016 23:54:17 +0200 Subject: [PATCH] add --nodocs option --- dist/npmts.configfile.js | 7 +++++- dist/npmts.typedoc.js | 12 +++++++--- package.json | 5 ++-- ts/npmts.configfile.ts | 6 ++++- ts/npmts.typedoc.ts | 52 +++++++++++++++++++++------------------- 5 files changed, 51 insertions(+), 31 deletions(-) diff --git a/dist/npmts.configfile.js b/dist/npmts.configfile.js index ea44d7d..6cd72a3 100644 --- a/dist/npmts.configfile.js +++ b/dist/npmts.configfile.js @@ -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, diff --git a/dist/npmts.typedoc.js b/dist/npmts.typedoc.js index fcae803..4b35e03 100644 --- a/dist/npmts.typedoc.js +++ b/dist/npmts.typedoc.js @@ -27,9 +27,15 @@ var genTypeDoc = function (configArg) { }; exports.run = function (configArg) { var done = plugins.Q.defer(); - genTypeDoc(configArg) - .then(function () { + if (configArg.nodocs) { done.resolve(configArg); - }); + } + else { + genTypeDoc(configArg) + .then(function () { + done.resolve(configArg); + }); + } + ; return done.promise; }; diff --git a/package.json b/package.json index b9a0a5a..a644ccb 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/ts/npmts.configfile.ts b/ts/npmts.configfile.ts index 699035b..86d51ba 100644 --- a/ts/npmts.configfile.ts +++ b/ts/npmts.configfile.ts @@ -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, diff --git a/ts/npmts.typedoc.ts b/ts/npmts.typedoc.ts index 1edcf0d..cceca40 100644 --- a/ts/npmts.typedoc.ts +++ b/ts/npmts.typedoc.ts @@ -1,40 +1,44 @@ 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", - target: "es6", - includeDeclarations: true, - - // Output options (see typedoc docs) - out: paths.docsDir, - json: plugins.path.join(paths.docsDir,"file.json"), - - // TypeDoc options (see typedoc docs) - name: "my-project", - + // TypeScript options (see typescript docs) + module: "commonjs", + target: "es6", + includeDeclarations: true, + + // Output options (see typedoc docs) + out: paths.docsDir, + json: plugins.path.join(paths.docsDir, "file.json"), + + // TypeDoc options (see typedoc docs) + name: "my-project", + //theme: "default", - ignoreCompilerErrors: true, - version: true, - })) - .pipe(plugins.g.gFunction(done.resolve,"atEnd")); + ignoreCompilerErrors: true, + version: true, + })) + .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(); - genTypeDoc(configArg) - .then(() => { - done.resolve(configArg); - }); + if (configArg.nodocs) { + done.resolve(configArg); + } else { + genTypeDoc(configArg) + .then(() => { + done.resolve(configArg); + }); + }; return done.promise; }; \ No newline at end of file