|
|
|
@ -3,7 +3,6 @@ Write npm modules with TypeScript without hassle.
|
|
|
|
|
|
|
|
|
|
## Status
|
|
|
|
|
[](https://gitlab.com/pushrocks/npmts/commits/master)
|
|
|
|
|
[](https://ci.appveyor.com/project/philkunz/npmts/branch/master)
|
|
|
|
|
[](https://david-dm.org/pushrocks/npmts)
|
|
|
|
|
[](https://www.bithound.io/github/pushrocks/npmts/master/dependencies/npm)
|
|
|
|
|
[](https://www.bithound.io/github/pushrocks/npmts)
|
|
|
|
@ -17,7 +16,10 @@ There is a docker image available that includes npmts to make CI a breeze:
|
|
|
|
|
[hosttoday/ht-docker-npmg on Dockerhub](https://hub.docker.com/r/hosttoday/ht-docker-npmg/)
|
|
|
|
|
|
|
|
|
|
### Install
|
|
|
|
|
First install npmts globally, then install the npmts checker:
|
|
|
|
|
First install npmts globally, then install the npmts-g locally.
|
|
|
|
|
|
|
|
|
|
> **npmts-g* checks if the global version of npmts suffices the modules requirements.
|
|
|
|
|
If not it installs npmts locally in the right version during npm install.
|
|
|
|
|
|
|
|
|
|
```sh
|
|
|
|
|
npm install npmts -g # installs npmts globally
|
|
|
|
@ -28,7 +30,7 @@ Then add it to your package.json's script section to trigger a build:
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
"scripts": {
|
|
|
|
|
"test": "npmts"
|
|
|
|
|
"test": "(npmts)"
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
@ -49,28 +51,13 @@ the npmts.json is the main config file. You can use it to customize the behaviou
|
|
|
|
|
```json
|
|
|
|
|
{
|
|
|
|
|
"mode":"default",
|
|
|
|
|
"codecov":{
|
|
|
|
|
"publish":true,
|
|
|
|
|
"token":"sometoken"
|
|
|
|
|
},
|
|
|
|
|
"ts":{
|
|
|
|
|
"./customdir/*.ts":"./"
|
|
|
|
|
},
|
|
|
|
|
"docs": {
|
|
|
|
|
"publish":true,
|
|
|
|
|
"destination":"github"
|
|
|
|
|
},
|
|
|
|
|
"tsOptions":{
|
|
|
|
|
"declaration":false,
|
|
|
|
|
"target":"ES6"
|
|
|
|
|
},
|
|
|
|
|
"typings":[
|
|
|
|
|
"./ts/typings.json",
|
|
|
|
|
"./subts1/typings.json",
|
|
|
|
|
"./subts2/typings.json",
|
|
|
|
|
"./customdir/typings.json"
|
|
|
|
|
],
|
|
|
|
|
"typingsInclude":"auto",
|
|
|
|
|
"cli":true
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
@ -84,14 +71,6 @@ the npmts.json is the main config file. You can use it to customize the behaviou
|
|
|
|
|
| `"typings"` | `["./ts/typings.json"]` | allows you to specify multiple locations for typings.json to install. This is needed for modules that do not yet bundle typings |
|
|
|
|
|
| `"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. |
|
|
|
|
|
|
|
|
|
|
#### Typings
|
|
|
|
|
**npmts** looks for `./ts/typings.json` by default and installs any defined typings to `.ts/typings/`.
|
|
|
|
|
|
|
|
|
|
> Note: You can reference the typings files in any of your TypeScript code with a
|
|
|
|
|
`/// <reference path="/some/path/main.d.ts">`
|
|
|
|
|
We are currently working on a "typingsInclude" option, that will autoload any typings during compilation.
|
|
|
|
|
tsconfig is NOT supported, since it would render this module useless
|
|
|
|
|
|
|
|
|
|
#### TypeScript
|
|
|
|
|
by default npmts looks for `./ts/*.ts` and `./test/test.ts` that will compile to
|
|
|
|
|
`./dist/*.js` and `./test/test.js`
|
|
|
|
@ -111,7 +90,8 @@ This is in line with the latest TypeScript best practices.
|
|
|
|
|
You can then import plugins via the TypeScript `import` Syntax
|
|
|
|
|
and tsc will pick up the declaration file automatically.
|
|
|
|
|
|
|
|
|
|
> Note: If you don't want declaration files, set tsOptions.declaration to false in npmts.json
|
|
|
|
|
#### 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.
|
|
|
|
|
|
|
|
|
|
#### Instrumentalize Code
|
|
|
|
|
npmts instrumentalizes (using istanbul) the created JavaScript code to create a coverage report.
|
|
|
|
|