Compare commits
12 Commits
Author | SHA1 | Date | |
---|---|---|---|
1f90f4abff | |||
3c7f5f1e2d | |||
8104609306 | |||
a3077f7800 | |||
c947121243 | |||
4b3f0649fa | |||
523c62530f | |||
aa57617fc7 | |||
ef89a33dfc | |||
474a730a09 | |||
e3b029c240 | |||
290824190d |
19
README.md
19
README.md
@ -36,20 +36,18 @@ Then add it to your package.json's script section to trigger a build:
|
||||
|
||||
### Default task execution order
|
||||
|
||||
1. Check config in ./npmts.json
|
||||
1. Check config in ./npmextra.json (Check out [npmextra](https://www.npmjs.com/package/npmextra))
|
||||
1. Clean up from any previous builds (old js files)
|
||||
1. Install typings
|
||||
1. Transpile TypeScript with **inline sourcemaps** and **declaration files**
|
||||
1. Create EsDoc Documentation
|
||||
1. Instrumentalize created JavaScript files with istanbul
|
||||
1. Run Tests
|
||||
1. Create Coverage report
|
||||
1. Transpile TypeScript with **inline sourcemaps** and **declaration files** to ES6
|
||||
1. Create TypeDoc Documentation from TypeScript files
|
||||
1. Instrumentalize transpiled ES6 JavaScript with istanbul and run tests with Mocha
|
||||
|
||||
#### npmts.json
|
||||
the npmts.json is the main config file. You can use it to customize the behaviour of NPMTS.
|
||||
#### npmtsextra.json
|
||||
the npmts section in npmtsextra.json can be used to configure npmts.
|
||||
|
||||
```json
|
||||
{
|
||||
"npmts":{
|
||||
"mode":"default",
|
||||
"ts":{
|
||||
"./customdir/*.ts":"./"
|
||||
@ -60,6 +58,7 @@ the npmts.json is the main config file. You can use it to customize the behaviou
|
||||
},
|
||||
"cli":true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
| key | default value | description |
|
||||
@ -111,7 +110,7 @@ thanks to autogenerated source maps.
|
||||
## Tips and tricks:
|
||||
|
||||
* Use [npmts-g](https://www.npmjs.com/package/npmts-g) to use globally installed npmts and install npmts locally if no global npmts is available.
|
||||
* Use [npmpage](https://www.npmjs.com/package/npmtspage) to create a webpage from coverage reports and EsDocs for the module
|
||||
* Use [npmpage](https://www.npmjs.com/package/npmtspage) to create a webpage from coverage reports and TypeDoc for the module
|
||||
* Use [hosttoday/ht-docker-node:npmts](https://hub.docker.com/r/hosttoday/ht-docker-node/) for speedy CI builds
|
||||
|
||||
## About the authors:
|
||||
|
25
dist/npmts.configfile.js
vendored
25
dist/npmts.configfile.js
vendored
@ -2,16 +2,23 @@
|
||||
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();
|
||||
var config = {};
|
||||
var configPath = plugins.path.join(paths.cwd, "npmts.json");
|
||||
npmts_promisechain_1.npmtsOra.text("looking for npmextra.json");
|
||||
var defaultConfig = {
|
||||
mode: "default",
|
||||
notest: false
|
||||
};
|
||||
if (argvArg.notest) {
|
||||
config.notest = true;
|
||||
defaultConfig.notest = true;
|
||||
}
|
||||
if (plugins.smartfile.fs.fileExistsSync(configPath)) {
|
||||
plugins.beautylog.info("npmts.json".blue + " config file found!");
|
||||
config = plugins.lodashObject.assign(config, plugins.smartfile.fs.toObjectSync(configPath));
|
||||
;
|
||||
var config = plugins.npmextra.dataFor({
|
||||
toolName: "npmts",
|
||||
defaultSettings: defaultConfig,
|
||||
cwd: paths.cwd
|
||||
});
|
||||
switch (config.mode) {
|
||||
case "default":
|
||||
case "custom":
|
||||
@ -23,12 +30,6 @@ exports.run = function (argvArg) {
|
||||
process.exit(1);
|
||||
}
|
||||
;
|
||||
}
|
||||
else {
|
||||
plugins.beautylog.log("no config file found: so mode is " + "default".yellow);
|
||||
config.mode = "default";
|
||||
done.resolve(config);
|
||||
}
|
||||
;
|
||||
return done.promise;
|
||||
};
|
||||
|
3
dist/npmts.plugins.d.ts
vendored
3
dist/npmts.plugins.d.ts
vendored
@ -11,9 +11,8 @@ export declare let g: {
|
||||
sourcemaps: any;
|
||||
typedoc: any;
|
||||
};
|
||||
import "babel-preset-es2015";
|
||||
export declare let lodashObject: any;
|
||||
export declare let merge2: any;
|
||||
export import npmextra = require("npmextra");
|
||||
export import projectinfo = require("projectinfo");
|
||||
export import path = require("path");
|
||||
export import Q = require("q");
|
||||
|
3
dist/npmts.plugins.js
vendored
3
dist/npmts.plugins.js
vendored
@ -12,9 +12,8 @@ exports.g = {
|
||||
sourcemaps: require("gulp-sourcemaps"),
|
||||
typedoc: require("gulp-typedoc")
|
||||
};
|
||||
require("babel-preset-es2015");
|
||||
exports.lodashObject = require('lodash/fp/object');
|
||||
exports.merge2 = require("merge2");
|
||||
exports.npmextra = require("npmextra");
|
||||
exports.projectinfo = require("projectinfo");
|
||||
exports.path = require("path");
|
||||
exports.Q = require("q");
|
||||
|
15
dist/npmts.tests.js
vendored
15
dist/npmts.tests.js
vendored
@ -14,19 +14,26 @@ var mocha = function (configArg) {
|
||||
var stream = plugins.gulp.src([plugins.path.join(paths.cwd, "dist/*.js")])
|
||||
.pipe(plugins.g.sourcemaps.init())
|
||||
.pipe(plugins.g.babel({
|
||||
presets: ['es2015']
|
||||
presets: [
|
||||
require.resolve("babel-preset-es2015")
|
||||
]
|
||||
}))
|
||||
.pipe(plugins.g.istanbul())
|
||||
.pipe(plugins.g.istanbul({}))
|
||||
.pipe(plugins.g.sourcemaps.write())
|
||||
.pipe(plugins.g.injectModules())
|
||||
.on("finish", function () {
|
||||
plugins.gulp.src([plugins.path.join(paths.cwd, "test/test.js")])
|
||||
.pipe(plugins.g.babel({
|
||||
presets: ['es2015']
|
||||
presets: [
|
||||
plugins.path.join(paths.npmtsPackageRoot, "node_modules/babel-preset-es2015/index.js")
|
||||
]
|
||||
}))
|
||||
.pipe(plugins.g.injectModules())
|
||||
.pipe(plugins.g.mocha())
|
||||
.pipe(plugins.g.istanbul.writeReports())
|
||||
.pipe(plugins.g.istanbul.writeReports({
|
||||
dir: './coverage',
|
||||
reporters: ['lcovonly', 'json', 'text', 'text-summary']
|
||||
}))
|
||||
.pipe(plugins.g.gFunction(function () {
|
||||
plugins.beautylog.ok("Tested!");
|
||||
done.resolve(configArg);
|
||||
|
10
package.json
10
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "npmts",
|
||||
"version": "5.3.16",
|
||||
"version": "5.3.22",
|
||||
"description": "write npm modules with TypeScript",
|
||||
"main": "dist/index.js",
|
||||
"bin": {
|
||||
@ -29,9 +29,10 @@
|
||||
},
|
||||
"homepage": "https://gitlab.com/pushrocks/npmts#readme",
|
||||
"dependencies": {
|
||||
"@types/minimatch": "*",
|
||||
"@types/q": "*",
|
||||
"@types/shelljs": "*",
|
||||
"@types/minimatch": "^2.0.28",
|
||||
"@types/q": "^0.0.27",
|
||||
"@types/shelljs": "^0.3.27",
|
||||
"babel-preset-es2015": "^6.9.0",
|
||||
"beautylog": "5.0.14",
|
||||
"early": "^2.0.13",
|
||||
"gulp": "3.9.1",
|
||||
@ -46,6 +47,7 @@
|
||||
"gulp-sourcemaps": "^1.6.0",
|
||||
"gulp-typedoc": "^2.0.0",
|
||||
"lodash": "^4.13.1",
|
||||
"npmextra": "^1.0.7",
|
||||
"projectinfo": "1.0.3",
|
||||
"q": "^1.4.1",
|
||||
"shelljs": "^0.7.0",
|
||||
|
@ -1,19 +1,22 @@
|
||||
import "typings-global";
|
||||
import plugins = require("./npmts.plugins");
|
||||
import paths = require("./npmts.paths");
|
||||
import {npmtsOra} from "./npmts.promisechain";
|
||||
export var run = function(argvArg){
|
||||
var done = plugins.Q.defer();
|
||||
var config:any = {};
|
||||
var configPath = plugins.path.join(paths.cwd,"npmts.json");
|
||||
let done = plugins.Q.defer();
|
||||
npmtsOra.text("looking for npmextra.json");
|
||||
let defaultConfig = {
|
||||
mode: "default",
|
||||
notest:false
|
||||
};
|
||||
if(argvArg.notest){
|
||||
config.notest = true;
|
||||
}
|
||||
if(plugins.smartfile.fs.fileExistsSync(configPath)){
|
||||
plugins.beautylog.info("npmts.json".blue + " config file found!");
|
||||
config = plugins.lodashObject.assign(
|
||||
config,
|
||||
plugins.smartfile.fs.toObjectSync(configPath)
|
||||
);
|
||||
defaultConfig.notest = true;
|
||||
};
|
||||
let config = plugins.npmextra.dataFor({
|
||||
toolName:"npmts",
|
||||
defaultSettings:defaultConfig,
|
||||
cwd:paths.cwd
|
||||
});
|
||||
switch (config.mode){
|
||||
case "default":
|
||||
case "custom":
|
||||
@ -24,10 +27,6 @@ export var run = function(argvArg){
|
||||
plugins.beautylog.error("mode " + config.mode.yellow + " not recognised!".red);
|
||||
process.exit(1);
|
||||
};
|
||||
} else {
|
||||
plugins.beautylog.log("no config file found: so mode is " + "default".yellow);
|
||||
config.mode = "default";
|
||||
done.resolve(config);
|
||||
};
|
||||
return done.promise;
|
||||
};
|
@ -11,9 +11,8 @@ export let g = {
|
||||
sourcemaps: require("gulp-sourcemaps"),
|
||||
typedoc: require("gulp-typedoc")
|
||||
};
|
||||
import "babel-preset-es2015";
|
||||
export let lodashObject = require('lodash/fp/object');
|
||||
export let merge2 = require("merge2");
|
||||
export import npmextra = require("npmextra");
|
||||
export import projectinfo = require("projectinfo");
|
||||
export import path = require("path");
|
||||
export import Q = require("q");
|
||||
|
@ -14,19 +14,27 @@ let mocha = function (configArg) {
|
||||
var stream = plugins.gulp.src([plugins.path.join(paths.cwd,"dist/*.js")])
|
||||
.pipe(plugins.g.sourcemaps.init())
|
||||
.pipe(plugins.g.babel({
|
||||
presets: ['es2015']
|
||||
presets: [
|
||||
require.resolve("babel-preset-es2015")
|
||||
]
|
||||
}))
|
||||
.pipe(plugins.g.istanbul({
|
||||
}))
|
||||
.pipe(plugins.g.istanbul())
|
||||
.pipe(plugins.g.sourcemaps.write())
|
||||
.pipe(plugins.g.injectModules())
|
||||
.on("finish",function(){
|
||||
plugins.gulp.src([plugins.path.join(paths.cwd,"test/test.js")])
|
||||
.pipe(plugins.g.babel({
|
||||
presets: ['es2015']
|
||||
presets: [
|
||||
plugins.path.join(paths.npmtsPackageRoot,"node_modules/babel-preset-es2015/index.js")
|
||||
]
|
||||
}))
|
||||
.pipe(plugins.g.injectModules())
|
||||
.pipe(plugins.g.mocha())
|
||||
.pipe(plugins.g.istanbul.writeReports())
|
||||
.pipe(plugins.g.istanbul.writeReports({
|
||||
dir: './coverage',
|
||||
reporters: [ 'lcovonly', 'json', 'text', 'text-summary']
|
||||
}))
|
||||
.pipe(plugins.g.gFunction(function(){
|
||||
plugins.beautylog.ok("Tested!");
|
||||
done.resolve(configArg);
|
||||
|
Reference in New Issue
Block a user