update options
This commit is contained in:
parent
51753df662
commit
2edcb3947e
21
README.md
21
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. |
|
||||
|
2
dist/cli.js
vendored
2
dist/cli.js
vendored
@ -1,2 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
var index = require("./index.js");
|
4
dist/npmts.configfile.d.ts
vendored
4
dist/npmts.configfile.d.ts
vendored
@ -1,4 +0,0 @@
|
||||
/// <reference types="q" />
|
||||
import "typings-global";
|
||||
import plugins = require("./npmts.plugins");
|
||||
export declare var run: (argvArg: any) => plugins.Q.Promise<{}>;
|
40
dist/npmts.configfile.js
vendored
40
dist/npmts.configfile.js
vendored
@ -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;
|
||||
};
|
13
dist/npmts.options.d.ts
vendored
13
dist/npmts.options.d.ts
vendored
@ -1,4 +1,15 @@
|
||||
/// <reference types="q" />
|
||||
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<{}>;
|
||||
|
54
dist/npmts.options.js
vendored
54
dist/npmts.options.js
vendored
@ -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;
|
||||
|
4
dist/npmts.promisechain.js
vendored
4
dist/npmts.promisechain.js
vendored
@ -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)
|
||||
|
2
dist/npmts.tests.js
vendored
2
dist/npmts.tests.js
vendored
@ -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" +
|
||||
|
8
dist/npmts.typedoc.js
vendored
8
dist/npmts.typedoc.js
vendored
@ -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;
|
||||
};
|
||||
|
24
package.json
24
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": "*"
|
||||
},
|
||||
|
@ -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;
|
||||
};
|
@ -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 = {};
|
||||
};
|
||||
|
||||
|
||||
// mix with commandline
|
||||
if(config.argv.notest){
|
||||
config.test = false;
|
||||
};
|
||||
if(config.argv.nodocs){
|
||||
config.docs = false;
|
||||
};
|
||||
|
||||
config.coverageTreshold ? void(0) : config.coverageTreshold = 70;
|
||||
|
||||
// handle docs
|
||||
config.docs ? void(0) : config.docs = {};
|
||||
|
||||
plugins.beautylog.ok("build options are ready!");
|
||||
done.resolve(config);
|
||||
|
@ -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)
|
||||
|
@ -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" +
|
||||
|
@ -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;
|
||||
};
|
Loading…
Reference in New Issue
Block a user