Compare commits
10 Commits
Author | SHA1 | Date | |
---|---|---|---|
b2aaa51882 | |||
8ee6623984 | |||
91ec17c51d | |||
646dbdaa3a | |||
4550fcd375 | |||
4d1b992193 | |||
cf2d482798 | |||
43853e4d71 | |||
6a650b9f1b | |||
c76cc6baf7 |
17
README.md
17
README.md
@ -6,7 +6,7 @@ Write npm modules with TypeScript without hassle. TypeScript ready. Fully ES6.
|
||||
[](https://david-dm.org/pushrocks/npmts)
|
||||
[](https://www.bithound.io/github/pushrocks/npmts/master/dependencies/npm)
|
||||
[](https://www.bithound.io/github/pushrocks/npmts)
|
||||
[](https://codecov.io/github/pushrocks/npmts?branch=master)
|
||||
[](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
||||
|
||||
## What is NPMTS?
|
||||
NPMTS is your friend when it comes to write, test, publish and document NPM modules written in TypeScript.
|
||||
@ -38,12 +38,13 @@ Then add it to your package.json's script section to trigger a build:
|
||||
|
||||
1. **Config:** Check config in ./npmextra.json (Check out [npmextra](https://www.npmjs.com/package/npmextra))
|
||||
1. **Clean:** Clean up from any previous builds (old js files)
|
||||
1. **Transpile:** Transpile TypeScript with **inline sourcemaps** and **declaration files** to ES6
|
||||
1. **Check:** Check project for typings declaration in package.json, unused dependencies and missing dependencies
|
||||
1. **Transpile:** Transpile TypeScript with **inline sourcemaps** and **declaration files** to ES target
|
||||
1. **Documentation:** Create TypeDoc Documentation from TypeScript files
|
||||
1. **Test:** Babelify ES6 to ES5 on the fly, instrumentalize ES5 JavaScript with istanbul and run tests with Mocha.
|
||||
|
||||
### npmextra.json
|
||||
the npmts section in npmtsextra.json can be used to configure npmts.
|
||||
the npmts section in npmextra.json can be used to configure npmts.
|
||||
|
||||
```json
|
||||
{
|
||||
@ -64,6 +65,7 @@ the npmts section in npmtsextra.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 |
|
||||
| `"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. |
|
||||
|
||||
@ -74,7 +76,7 @@ by default npmts looks for `./ts/*.ts` and `./test/test.ts` that will compile to
|
||||
Use commonjs module system for wiring up files.
|
||||
|
||||
### Declaration files
|
||||
**npmts** also creates an `./dist/index.d.ts` declaration file by default.
|
||||
**npmts** also creates declaration files like `./dist/index.d.ts` by default.
|
||||
You can reference it in your package.json like this.
|
||||
|
||||
```json
|
||||
@ -88,7 +90,7 @@ and tsc will pick up the declaration file automatically.
|
||||
|
||||
## Some notes:
|
||||
#### Typings for third party modules that do not bundle declaration files
|
||||
NPMTS does no longer supports typings.json. Instead use the new TypeScript 2.x approach to typings using the @types/ npm scope.
|
||||
NPMTS no longer supports typings.json. Instead use the new TypeScript 2.x approach to typings using the @types/ npm scope.
|
||||
|
||||
#### Instrumentalize Code
|
||||
npmts instrumentalizes (using istanbul) the created JavaScript code to create a coverage report.
|
||||
@ -109,6 +111,11 @@ thanks to autogenerated source maps.
|
||||
* Use [hosttoday/ht-docker-node:npmts](https://hub.docker.com/r/hosttoday/ht-docker-node/) for speedy CI builds
|
||||
* Use [npmdocker](https://www.npmjs.com/package/npmdocker) for running tests consistently with docker.
|
||||
|
||||
## Future Scope:
|
||||
* automatically manage badges in README
|
||||
* manage tslint to enforce code best practices
|
||||
* tear down any differences between local and CI environments by using brand new npmdocker
|
||||
|
||||
## About the authors:
|
||||
[](https://lossless.com/)
|
||||
|
||||
|
28
dist/npmts.check.js
vendored
28
dist/npmts.check.js
vendored
@ -46,13 +46,8 @@ var checkDependencies = function (configArg) {
|
||||
plugins.beautylog.warn("Watch out: unused dependency " + item.red);
|
||||
}
|
||||
;
|
||||
for (var _b = 0, _c = unused.devDependencies; _b < _c.length; _b++) {
|
||||
for (var _b = 0, _c = unused.missing; _b < _c.length; _b++) {
|
||||
var item = _c[_b];
|
||||
plugins.beautylog.log("unused devDependency " + item.red);
|
||||
}
|
||||
;
|
||||
for (var _d = 0, _e = unused.missing; _d < _e.length; _d++) {
|
||||
var item = _e[_d];
|
||||
plugins.beautylog.error("unused devDependency " + item.red);
|
||||
}
|
||||
;
|
||||
@ -60,18 +55,13 @@ var checkDependencies = function (configArg) {
|
||||
plugins.beautylog.info("exiting due to missing dependencies in package.json");
|
||||
process.exit(1);
|
||||
}
|
||||
for (var _f = 0, _g = unused.using; _f < _g.length; _f++) {
|
||||
var item = _g[_f];
|
||||
console.log(item);
|
||||
}
|
||||
;
|
||||
for (var _h = 0, _j = unused.invalidFiles; _h < _j.length; _h++) {
|
||||
var item = _j[_h];
|
||||
for (var _d = 0, _e = unused.invalidFiles; _d < _e.length; _d++) {
|
||||
var item = _e[_d];
|
||||
plugins.beautylog.warn("Watch out: could not parse file " + item.red);
|
||||
}
|
||||
;
|
||||
for (var _k = 0, _l = unused.invalidDirs; _k < _l.length; _k++) {
|
||||
var item = _l[_k];
|
||||
for (var _f = 0, _g = unused.invalidDirs; _f < _g.length; _f++) {
|
||||
var item = _g[_f];
|
||||
plugins.beautylog.warn("Watch out: could not parse directory " + item.red);
|
||||
}
|
||||
;
|
||||
@ -98,11 +88,15 @@ var checkDevDependencies = function (configArg) {
|
||||
plugins.beautylog.log("unused devDependency " + item.red);
|
||||
}
|
||||
;
|
||||
for (var _b = 0, _c = unused.using; _b < _c.length; _b++) {
|
||||
for (var _b = 0, _c = unused.missing; _b < _c.length; _b++) {
|
||||
var item = _c[_b];
|
||||
console.log(item);
|
||||
plugins.beautylog.error("unused devDependency " + item.red);
|
||||
}
|
||||
;
|
||||
if (unused.missing.length > 0) {
|
||||
plugins.beautylog.info("exiting due to missing dependencies in package.json");
|
||||
process.exit(1);
|
||||
}
|
||||
for (var _d = 0, _e = unused.invalidFiles; _d < _e.length; _d++) {
|
||||
var item = _e[_d];
|
||||
plugins.beautylog.warn("Watch out: could not parse file " + item.red);
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "npmts",
|
||||
"version": "5.4.1",
|
||||
"version": "5.4.4",
|
||||
"description": "Write npm modules with TypeScript without hassle. TypeScript ready. Fully ES6.",
|
||||
"main": "dist/index.js",
|
||||
"bin": {
|
||||
|
@ -45,9 +45,6 @@ let checkDependencies = (configArg) => {
|
||||
for (let item of unused.dependencies) {
|
||||
plugins.beautylog.warn(`Watch out: unused dependency ${item.red}`);
|
||||
};
|
||||
for (let item of unused.devDependencies) {
|
||||
plugins.beautylog.log(`unused devDependency ${item.red}`);
|
||||
};
|
||||
for (let item of unused.missing) {
|
||||
plugins.beautylog.error(`unused devDependency ${item.red}`);
|
||||
};
|
||||
@ -55,9 +52,6 @@ let checkDependencies = (configArg) => {
|
||||
plugins.beautylog.info("exiting due to missing dependencies in package.json");
|
||||
process.exit(1);
|
||||
}
|
||||
for (let item of unused.using) {
|
||||
console.log(item);
|
||||
};
|
||||
for (let item of unused.invalidFiles) {
|
||||
plugins.beautylog.warn(`Watch out: could not parse file ${item.red}`);
|
||||
};
|
||||
@ -86,9 +80,13 @@ let checkDevDependencies = (configArg) => {
|
||||
for (let item of unused.devDependencies) {
|
||||
plugins.beautylog.log(`unused devDependency ${item.red}`);
|
||||
};
|
||||
for (let item of unused.using) {
|
||||
console.log(item);
|
||||
for (let item of unused.missing) {
|
||||
plugins.beautylog.error(`unused devDependency ${item.red}`);
|
||||
};
|
||||
if (unused.missing.length > 0) {
|
||||
plugins.beautylog.info("exiting due to missing dependencies in package.json");
|
||||
process.exit(1);
|
||||
}
|
||||
for (let item of unused.invalidFiles) {
|
||||
plugins.beautylog.warn(`Watch out: could not parse file ${item.red}`);
|
||||
};
|
||||
|
Reference in New Issue
Block a user