diff --git a/README.md b/README.md
index f279382..6b85ba6 100644
--- a/README.md
+++ b/README.md
@@ -46,10 +46,25 @@ Then add it to your package.json's script section to trigger a build:
### npmextra.json
the npmts section in npmextra.json can be used to configure npmts.
+**Default**
+>Note: When you are using `"mode":"default"` it'll cause npmts to override any other settings you may have made except for tsOptions (ES target etc.)
+with default behaviour.
+
```json
{
"npmts":{
- "mode":"default",
+ "mode":"default"
+ }
+}
+```
+
+**Custom settings**
+```json
+{
+ "mode":"custom",
+ "docs":false,
+ "test":true,
+ "npmts":{
"ts":{
"./customdir/*.ts":"./"
},
@@ -64,7 +79,9 @@ the npmts section in npmextra.json can be used to configure npmts.
| key | default value | description |
| --- | --- | --- |
-| `"mode"` | `"default"` | "default" will do some default stuff, "custom" only does what you specify |
+| `"mode"` | `"default"` | "default" will do default stuff and override , "custom" only does what you specify |
+| `"docs"` | `true` | create docs for your module |
+| `"test"` | `true` | test your module |
| `"ts"` | `{"./ts/*.ts":"./","./test/test.ts":"./test/"}` | allows you to define multiple ts portions |
| `"tsOptions"` | `{"target":"ES5", "declaration":"true"}` | specify options for tsc |
| `"cli"` | "false" | some modules are designed to be used from cli. If set to true NPMTS will create a cli.js that wires you dist files up for cli use. |
diff --git a/dist/cli.js b/dist/cli.js
deleted file mode 100644
index 9ab44a7..0000000
--- a/dist/cli.js
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/usr/bin/env node
-var index = require("./index.js");
\ No newline at end of file
diff --git a/dist/npmts.configfile.d.ts b/dist/npmts.configfile.d.ts
deleted file mode 100644
index 1b6f363..0000000
--- a/dist/npmts.configfile.d.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-///
-import "typings-global";
-import plugins = require("./npmts.plugins");
-export declare var run: (argvArg: any) => plugins.Q.Promise<{}>;
diff --git a/dist/npmts.configfile.js b/dist/npmts.configfile.js
deleted file mode 100644
index 6cd72a3..0000000
--- a/dist/npmts.configfile.js
+++ /dev/null
@@ -1,40 +0,0 @@
-"use strict";
-require("typings-global");
-var plugins = require("./npmts.plugins");
-var paths = require("./npmts.paths");
-var npmts_promisechain_1 = require("./npmts.promisechain");
-exports.run = function (argvArg) {
- var done = plugins.Q.defer();
- npmts_promisechain_1.npmtsOra.text("looking for npmextra.json");
- var defaultConfig = {
- mode: "default",
- 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,
- cwd: paths.cwd
- });
- switch (config.mode) {
- case "default":
- case "custom":
- plugins.beautylog.ok("mode is " + config.mode.yellow);
- done.resolve(config);
- break;
- default:
- plugins.beautylog.error("mode " + config.mode.yellow + " not recognised!".red);
- process.exit(1);
- }
- ;
- done.resolve(config);
- return done.promise;
-};
diff --git a/dist/npmts.options.d.ts b/dist/npmts.options.d.ts
index f32981b..0ea592b 100644
--- a/dist/npmts.options.d.ts
+++ b/dist/npmts.options.d.ts
@@ -1,4 +1,15 @@
///
import "typings-global";
import plugins = require("./npmts.plugins");
-export declare var run: (configArg: any) => plugins.Q.Promise<{}>;
+export declare type npmtsMode = "default" | "custom";
+export interface npmtsConfig {
+ argv: any;
+ coverageTreshold: number;
+ docs: boolean;
+ mode: npmtsMode;
+ test: boolean;
+ testTs: any;
+ ts: any;
+ tsOptions: any;
+}
+export declare var run: (argvArg: any) => plugins.Q.Promise<{}>;
diff --git a/dist/npmts.options.js b/dist/npmts.options.js
index cd76c82..678a02d 100644
--- a/dist/npmts.options.js
+++ b/dist/npmts.options.js
@@ -1,16 +1,42 @@
"use strict";
require("typings-global");
var plugins = require("./npmts.plugins");
+var paths = require("./npmts.paths");
var npmts_promisechain_1 = require("./npmts.promisechain");
-exports.run = function (configArg) {
+;
+exports.run = function (argvArg) {
var done = plugins.Q.defer();
- var config = configArg;
- npmts_promisechain_1.npmtsOra.text("now determining build options...");
+ var defaultConfig = {
+ argv: undefined,
+ coverageTreshold: 70,
+ docs: true,
+ mode: "default",
+ test: true,
+ testTs: {},
+ ts: {},
+ tsOptions: {}
+ };
+ // mix with configfile
+ npmts_promisechain_1.npmtsOra.text("looking for npmextra.json");
+ var config = plugins.npmextra.dataFor({
+ toolName: "npmts",
+ defaultSettings: defaultConfig,
+ cwd: paths.cwd
+ });
+ // check mode
+ switch (config.mode) {
+ case "default":
+ case "custom":
+ plugins.beautylog.ok("mode is " + config.mode);
+ done.resolve(config);
+ break;
+ default:
+ plugins.beautylog.error("mode " + config.mode + " not recognised!".red);
+ process.exit(1);
+ }
+ ;
//handle default mode
if (config.mode == "default") {
- config.typings = [
- "./ts/typings.json"
- ];
config.ts = (_a = {},
_a["./ts/**/*.ts"] = "./dist/",
_a
@@ -19,13 +45,17 @@ exports.run = function (configArg) {
_b["./test/test.ts"] = "./test/",
_b
);
- config.test = ["./index.js"];
}
- //check if config.tsOptions is available
- config.tsOptions ? void (0) : config.tsOptions = {};
- config.coverageTreshold ? void (0) : config.coverageTreshold = 70;
- // handle docs
- config.docs ? void (0) : config.docs = {};
+ ;
+ // mix with commandline
+ if (config.argv.notest) {
+ config.test = false;
+ }
+ ;
+ if (config.argv.nodocs) {
+ config.docs = false;
+ }
+ ;
plugins.beautylog.ok("build options are ready!");
done.resolve(config);
return done.promise;
diff --git a/dist/npmts.promisechain.js b/dist/npmts.promisechain.js
index f282452..25177a4 100644
--- a/dist/npmts.promisechain.js
+++ b/dist/npmts.promisechain.js
@@ -6,15 +6,13 @@ var NpmtsAssets = require("./npmts.assets");
var NpmtsCheck = require("./npmts.check");
var NpmtsClean = require("./npmts.clean");
var NpmtsCompile = require("./npmts.compile");
-var NpmtsConfigFile = require("./npmts.configfile");
var NpmtsTypeDoc = require("./npmts.typedoc");
var NpmtsOptions = require("./npmts.options");
var NpmtsTests = require("./npmts.tests");
exports.promisechain = function (argvArg) {
var done = plugins.Q.defer();
exports.npmtsOra.start();
- NpmtsConfigFile.run(argvArg)
- .then(NpmtsOptions.run)
+ NpmtsOptions.run(argvArg)
.then(NpmtsClean.run)
.then(NpmtsCheck.run)
.then(NpmtsCompile.run)
diff --git a/dist/npmts.tests.js b/dist/npmts.tests.js
index d252fe5..93edb47 100644
--- a/dist/npmts.tests.js
+++ b/dist/npmts.tests.js
@@ -60,7 +60,7 @@ var coverage = function (configArg) {
exports.run = function (configArg) {
var done = plugins.Q.defer();
var config = configArg;
- if (config.notest != true) {
+ if (config.test === true) {
npmts_promisechain_1.npmtsOra.text("now starting tests");
plugins.beautylog.log("-------------------------------------------------------\n" +
"*************************** TESTS: ***************************\n" +
diff --git a/dist/npmts.typedoc.js b/dist/npmts.typedoc.js
index 4b35e03..b25fb3e 100644
--- a/dist/npmts.typedoc.js
+++ b/dist/npmts.typedoc.js
@@ -27,15 +27,15 @@ var genTypeDoc = function (configArg) {
};
exports.run = function (configArg) {
var done = plugins.Q.defer();
- if (configArg.nodocs) {
- done.resolve(configArg);
- }
- else {
+ if (configArg.docs) {
genTypeDoc(configArg)
.then(function () {
done.resolve(configArg);
});
}
+ else {
+ done.resolve(configArg);
+ }
;
return done.promise;
};
diff --git a/package.json b/package.json
index 60a8fea..22363a1 100644
--- a/package.json
+++ b/package.json
@@ -30,23 +30,23 @@
},
"homepage": "https://gitlab.com/pushrocks/npmts#readme",
"dependencies": {
- "@types/gulp": "^3.8.28",
+ "@types/gulp": "^3.8.29",
"@types/minimatch": "^2.0.28",
- "@types/q": "^0.0.27",
- "@types/shelljs": "^0.3.27",
- "babel-preset-es2015": "^6.9.0",
- "beautylog": "5.0.18",
+ "@types/q": "^0.x.x",
+ "@types/shelljs": "^0.3.28",
+ "babel-preset-es2015": "^6.13.2",
+ "beautylog": "5.0.20",
"depcheck": "^0.6.4",
"early": "^2.0.13",
"gulp": "3.9.1",
"gulp-babel": "^6.1.2",
"gulp-function": "^1.3.6",
"gulp-inject-modules": "^1.0.0",
- "gulp-istanbul": "^1.0.0",
- "gulp-mocha": "^2.2.0",
+ "gulp-istanbul": "^1.1.0",
+ "gulp-mocha": "^3.0.1",
"gulp-sourcemaps": "^1.6.0",
"gulp-typedoc": "^2.0.0",
- "lodash": "^4.14.0",
+ "lodash": "^4.15.0",
"npmextra": "^1.0.8",
"projectinfo": "1.0.3",
"q": "^1.4.1",
@@ -54,12 +54,12 @@
"smartcli": "1.0.4",
"smartcov": "0.0.9",
"smartenv": "1.2.5",
- "smartfile": "4.0.12",
+ "smartfile": "4.0.13",
"smartpath": "3.2.2",
- "smartstring": "^2.0.15",
+ "smartstring": "^2.0.17",
"source-map-support": "^0.4.2",
- "tsn": "^1.0.10",
- "typedoc": "^0.4.4",
+ "tsn": "^1.0.12",
+ "typedoc": "^0.4.5",
"typescript": "^2.0.0-dev.20160630",
"typings-global": "*"
},
diff --git a/ts/npmts.configfile.ts b/ts/npmts.configfile.ts
deleted file mode 100644
index 86d51ba..0000000
--- a/ts/npmts.configfile.ts
+++ /dev/null
@@ -1,36 +0,0 @@
-import "typings-global";
-import plugins = require("./npmts.plugins");
-import paths = require("./npmts.paths");
-import {npmtsOra} from "./npmts.promisechain";
-export var run = function(argvArg){
- let done = plugins.Q.defer();
- npmtsOra.text("looking for npmextra.json");
- let defaultConfig = {
- mode: "default",
- 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,
- cwd:paths.cwd
- });
- switch (config.mode){
- case "default":
- case "custom":
- plugins.beautylog.ok("mode is " + config.mode.yellow);
- done.resolve(config);
- break;
- default:
- plugins.beautylog.error("mode " + config.mode.yellow + " not recognised!".red);
- process.exit(1);
- };
- done.resolve(config);
- return done.promise;
-};
\ No newline at end of file
diff --git a/ts/npmts.options.ts b/ts/npmts.options.ts
index d7e65a2..6d22e43 100644
--- a/ts/npmts.options.ts
+++ b/ts/npmts.options.ts
@@ -1,36 +1,76 @@
import "typings-global";
import plugins = require("./npmts.plugins");
+import paths = require("./npmts.paths");
import {npmtsOra} from "./npmts.promisechain";
-export var run = function(configArg){
- var done = plugins.Q.defer();
- var config = configArg;
+export type npmtsMode = "default" | "custom"
- npmtsOra.text("now determining build options...");
+export interface npmtsConfig {
+ argv:any,
+ coverageTreshold:number,
+ docs:boolean,
+ mode: npmtsMode,
+ test:boolean,
+ testTs:any,
+ ts:any,
+ tsOptions:any
+
+};
+
+
+export var run = function(argvArg){
+ let done = plugins.Q.defer();
+ let defaultConfig:npmtsConfig = {
+ argv:undefined,
+ coverageTreshold: 70,
+ docs: true,
+ mode:"default",
+ test:true,
+ testTs:{},
+ ts:{},
+ tsOptions: {}
+ };
+
+
+ // mix with configfile
+ npmtsOra.text("looking for npmextra.json");
+ let config:npmtsConfig = plugins.npmextra.dataFor({
+ toolName:"npmts",
+ defaultSettings:defaultConfig,
+ cwd:paths.cwd
+ });
+
+ // check mode
+ switch (config.mode){
+ case "default":
+ case "custom":
+ plugins.beautylog.ok("mode is " + config.mode);
+ done.resolve(config);
+ break;
+ default:
+ plugins.beautylog.error("mode " + config.mode + " not recognised!".red);
+ process.exit(1);
+ };
//handle default mode
if (config.mode == "default"){
- config.typings = [
- "./ts/typings.json"
- ];
config.ts = {
["./ts/**/*.ts"]: "./dist/"
};
config.testTs = {
["./test/test.ts"]: "./test/"
};
- config.test = ["./index.js"];
- }
-
- //check if config.tsOptions is available
- config.tsOptions ? void(0) : config.tsOptions = {};
+ };
-
- config.coverageTreshold ? void(0) : config.coverageTreshold = 70;
+ // mix with commandline
+ if(config.argv.notest){
+ config.test = false;
+ };
+ if(config.argv.nodocs){
+ config.docs = false;
+ };
- // handle docs
- config.docs ? void(0) : config.docs = {};
plugins.beautylog.ok("build options are ready!");
done.resolve(config);
diff --git a/ts/npmts.promisechain.ts b/ts/npmts.promisechain.ts
index f73c4ee..8e8095e 100644
--- a/ts/npmts.promisechain.ts
+++ b/ts/npmts.promisechain.ts
@@ -8,7 +8,6 @@ import NpmtsAssets = require("./npmts.assets");
import NpmtsCheck = require("./npmts.check");
import NpmtsClean = require("./npmts.clean");
import NpmtsCompile = require("./npmts.compile");
-import NpmtsConfigFile = require("./npmts.configfile");
import NpmtsTypeDoc = require("./npmts.typedoc");
import NpmtsOptions = require("./npmts.options");
import NpmtsTests = require("./npmts.tests");
@@ -16,8 +15,7 @@ import NpmtsTests = require("./npmts.tests");
export let promisechain = function(argvArg){
let done = plugins.Q.defer();
npmtsOra.start();
- NpmtsConfigFile.run(argvArg)
- .then(NpmtsOptions.run)
+ NpmtsOptions.run(argvArg)
.then(NpmtsClean.run)
.then(NpmtsCheck.run)
.then(NpmtsCompile.run)
diff --git a/ts/npmts.tests.ts b/ts/npmts.tests.ts
index 4557d28..73643c2 100644
--- a/ts/npmts.tests.ts
+++ b/ts/npmts.tests.ts
@@ -66,7 +66,7 @@ let coverage = function(configArg){
export let run = function(configArg) {
let done = plugins.Q.defer();
let config = configArg;
- if(config.notest != true){
+ if(config.test === true){
npmtsOra.text("now starting tests");
plugins.beautylog.log(
"-------------------------------------------------------\n" +
diff --git a/ts/npmts.typedoc.ts b/ts/npmts.typedoc.ts
index cceca40..129ee1a 100644
--- a/ts/npmts.typedoc.ts
+++ b/ts/npmts.typedoc.ts
@@ -32,13 +32,13 @@ let genTypeDoc = function (configArg) {
export let run = function (configArg) {
let done = plugins.Q.defer();
- if (configArg.nodocs) {
- done.resolve(configArg);
- } else {
+ if (configArg.docs) {
genTypeDoc(configArg)
.then(() => {
done.resolve(configArg);
});
+ } else {
+ done.resolve(configArg);
};
return done.promise;
};
\ No newline at end of file