Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
36316e63b2 | |||
5c5e88c226 | |||
af968f65df | |||
f0cc2f4cd6 | |||
f167226830 | |||
3e49b365b6 |
@ -45,17 +45,3 @@ trigger:
|
|||||||
- tags
|
- tags
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
|
|
||||||
pages:
|
|
||||||
stage: page
|
|
||||||
script:
|
|
||||||
- npmci test lts
|
|
||||||
- mkdir .public
|
|
||||||
- cp -r test/assets/docs/ .public
|
|
||||||
- cp -r test/assets/coverage/ .public
|
|
||||||
- mv .public public
|
|
||||||
artifacts:
|
|
||||||
paths:
|
|
||||||
- public
|
|
||||||
only:
|
|
||||||
- tags
|
|
34
README.md
34
README.md
@ -3,7 +3,6 @@ Write npm modules with TypeScript without hassle.
|
|||||||
|
|
||||||
## Status
|
## Status
|
||||||
[](https://gitlab.com/pushrocks/npmts/commits/master)
|
[](https://gitlab.com/pushrocks/npmts/commits/master)
|
||||||
[](https://ci.appveyor.com/project/philkunz/npmts/branch/master)
|
|
||||||
[](https://david-dm.org/pushrocks/npmts)
|
[](https://david-dm.org/pushrocks/npmts)
|
||||||
[](https://www.bithound.io/github/pushrocks/npmts/master/dependencies/npm)
|
[](https://www.bithound.io/github/pushrocks/npmts/master/dependencies/npm)
|
||||||
[](https://www.bithound.io/github/pushrocks/npmts)
|
[](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/)
|
[hosttoday/ht-docker-npmg on Dockerhub](https://hub.docker.com/r/hosttoday/ht-docker-npmg/)
|
||||||
|
|
||||||
### Install
|
### 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
|
```sh
|
||||||
npm install npmts -g # installs npmts globally
|
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
|
```json
|
||||||
"scripts": {
|
"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
|
```json
|
||||||
{
|
{
|
||||||
"mode":"default",
|
"mode":"default",
|
||||||
"codecov":{
|
|
||||||
"publish":true,
|
|
||||||
"token":"sometoken"
|
|
||||||
},
|
|
||||||
"ts":{
|
"ts":{
|
||||||
"./customdir/*.ts":"./"
|
"./customdir/*.ts":"./"
|
||||||
},
|
},
|
||||||
"docs": {
|
|
||||||
"publish":true,
|
|
||||||
"destination":"github"
|
|
||||||
},
|
|
||||||
"tsOptions":{
|
"tsOptions":{
|
||||||
"declaration":false,
|
"declaration":false,
|
||||||
"target":"ES6"
|
"target":"ES6"
|
||||||
},
|
},
|
||||||
"typings":[
|
|
||||||
"./ts/typings.json",
|
|
||||||
"./subts1/typings.json",
|
|
||||||
"./subts2/typings.json",
|
|
||||||
"./customdir/typings.json"
|
|
||||||
],
|
|
||||||
"typingsInclude":"auto",
|
|
||||||
"cli":true
|
"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 |
|
| `"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. |
|
| `"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
|
#### TypeScript
|
||||||
by default npmts looks for `./ts/*.ts` and `./test/test.ts` that will compile to
|
by default npmts looks for `./ts/*.ts` and `./test/test.ts` that will compile to
|
||||||
`./dist/*.js` and `./test/test.js`
|
`./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
|
You can then import plugins via the TypeScript `import` Syntax
|
||||||
and tsc will pick up the declaration file automatically.
|
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
|
#### Instrumentalize Code
|
||||||
npmts instrumentalizes (using istanbul) the created JavaScript code to create a coverage report.
|
npmts instrumentalizes (using istanbul) the created JavaScript code to create a coverage report.
|
||||||
|
3
dist/npmts.plugins.d.ts
vendored
3
dist/npmts.plugins.d.ts
vendored
@ -7,6 +7,7 @@ export declare let g: {
|
|||||||
jsdoc3: any;
|
jsdoc3: any;
|
||||||
mocha: any;
|
mocha: any;
|
||||||
replace: any;
|
replace: any;
|
||||||
|
sourcemaps: any;
|
||||||
};
|
};
|
||||||
export declare let lodashObject: any;
|
export declare let lodashObject: any;
|
||||||
export declare let merge2: any;
|
export declare let merge2: any;
|
||||||
@ -22,4 +23,4 @@ export import smartfile = require("smartfile");
|
|||||||
export import smartpath = require("smartpath");
|
export import smartpath = require("smartpath");
|
||||||
export import smartstring = require("smartstring");
|
export import smartstring = require("smartstring");
|
||||||
export declare let sourceMapSupport: any;
|
export declare let sourceMapSupport: any;
|
||||||
export declare let tsn: any;
|
export import tsn = require("tsn");
|
||||||
|
3
dist/npmts.plugins.js
vendored
3
dist/npmts.plugins.js
vendored
@ -7,7 +7,8 @@ exports.g = {
|
|||||||
istanbul: require("gulp-istanbul"),
|
istanbul: require("gulp-istanbul"),
|
||||||
jsdoc3: require("gulp-jsdoc3"),
|
jsdoc3: require("gulp-jsdoc3"),
|
||||||
mocha: require("gulp-mocha"),
|
mocha: require("gulp-mocha"),
|
||||||
replace: require("gulp-replace")
|
replace: require("gulp-replace"),
|
||||||
|
sourcemaps: require("gulp-sourcemaps")
|
||||||
};
|
};
|
||||||
exports.lodashObject = require('lodash/fp/object');
|
exports.lodashObject = require('lodash/fp/object');
|
||||||
exports.merge2 = require("merge2");
|
exports.merge2 = require("merge2");
|
||||||
|
2
dist/npmts.tests.js
vendored
2
dist/npmts.tests.js
vendored
@ -11,7 +11,9 @@ var istanbul = function (configArg) {
|
|||||||
npmts_promisechain_1.npmtsOra.text("Instrumentalizing transpiled JS...");
|
npmts_promisechain_1.npmtsOra.text("Instrumentalizing transpiled JS...");
|
||||||
var done = plugins.Q.defer();
|
var done = plugins.Q.defer();
|
||||||
var stream = plugins.gulp.src([plugins.path.join(paths.cwd, "dist/*.js")])
|
var stream = plugins.gulp.src([plugins.path.join(paths.cwd, "dist/*.js")])
|
||||||
|
.pipe(plugins.g.sourcemaps.init())
|
||||||
.pipe(plugins.g.istanbul()) // Covering files
|
.pipe(plugins.g.istanbul()) // Covering files
|
||||||
|
.pipe(plugins.g.sourcemaps.write())
|
||||||
.pipe(plugins.g.istanbul.hookRequire()) // Force `require` to return covered files
|
.pipe(plugins.g.istanbul.hookRequire()) // Force `require` to return covered files
|
||||||
.pipe(plugins.g.gFunction(function () {
|
.pipe(plugins.g.gFunction(function () {
|
||||||
plugins.beautylog.ok("JS has been instrumentalized to get test code coverage!");
|
plugins.beautylog.ok("JS has been instrumentalized to get test code coverage!");
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "npmts",
|
"name": "npmts",
|
||||||
"version": "5.3.7",
|
"version": "5.3.9",
|
||||||
"description": "write npm modules with TypeScript",
|
"description": "write npm modules with TypeScript",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
@ -42,6 +42,7 @@
|
|||||||
"gulp-jsdoc3": "^0.3.0",
|
"gulp-jsdoc3": "^0.3.0",
|
||||||
"gulp-mocha": "^2.2.0",
|
"gulp-mocha": "^2.2.0",
|
||||||
"gulp-replace": "^0.5.4",
|
"gulp-replace": "^0.5.4",
|
||||||
|
"gulp-sourcemaps": "^1.6.0",
|
||||||
"lodash": "^4.13.1",
|
"lodash": "^4.13.1",
|
||||||
"merge2": "1.0.2",
|
"merge2": "1.0.2",
|
||||||
"projectinfo": "1.0.3",
|
"projectinfo": "1.0.3",
|
||||||
@ -55,7 +56,7 @@
|
|||||||
"smartpath": "3.2.2",
|
"smartpath": "3.2.2",
|
||||||
"smartstring": "^2.0.10",
|
"smartstring": "^2.0.10",
|
||||||
"source-map-support": "^0.4.1",
|
"source-map-support": "^0.4.1",
|
||||||
"tsn": "^1.0.4",
|
"tsn": "^1.0.5",
|
||||||
"typescript": "^2.0.0-dev.20160630",
|
"typescript": "^2.0.0-dev.20160630",
|
||||||
"typings-global": "*"
|
"typings-global": "*"
|
||||||
},
|
},
|
||||||
|
@ -6,7 +6,8 @@ export let g = {
|
|||||||
istanbul: require("gulp-istanbul"),
|
istanbul: require("gulp-istanbul"),
|
||||||
jsdoc3: require("gulp-jsdoc3"),
|
jsdoc3: require("gulp-jsdoc3"),
|
||||||
mocha: require("gulp-mocha"),
|
mocha: require("gulp-mocha"),
|
||||||
replace: require("gulp-replace")
|
replace: require("gulp-replace"),
|
||||||
|
sourcemaps: require("gulp-sourcemaps")
|
||||||
};
|
};
|
||||||
export let lodashObject = require('lodash/fp/object');
|
export let lodashObject = require('lodash/fp/object');
|
||||||
export let merge2 = require("merge2");
|
export let merge2 = require("merge2");
|
||||||
@ -22,4 +23,4 @@ export import smartfile = require("smartfile");
|
|||||||
export import smartpath = require("smartpath");
|
export import smartpath = require("smartpath");
|
||||||
export import smartstring = require("smartstring");
|
export import smartstring = require("smartstring");
|
||||||
export let sourceMapSupport = require("source-map-support").install(); // this is required to display errors correctly during testing
|
export let sourceMapSupport = require("source-map-support").install(); // this is required to display errors correctly during testing
|
||||||
export let tsn = require("tsn");
|
export import tsn = require("tsn");
|
@ -11,7 +11,9 @@ let istanbul = function (configArg) {
|
|||||||
npmtsOra.text("Instrumentalizing transpiled JS...");
|
npmtsOra.text("Instrumentalizing transpiled JS...");
|
||||||
let done = plugins.Q.defer();
|
let done = plugins.Q.defer();
|
||||||
var stream = plugins.gulp.src([plugins.path.join(paths.cwd,"dist/*.js")])
|
var stream = plugins.gulp.src([plugins.path.join(paths.cwd,"dist/*.js")])
|
||||||
|
.pipe(plugins.g.sourcemaps.init())
|
||||||
.pipe(plugins.g.istanbul()) // Covering files
|
.pipe(plugins.g.istanbul()) // Covering files
|
||||||
|
.pipe(plugins.g.sourcemaps.write())
|
||||||
.pipe(plugins.g.istanbul.hookRequire()) // Force `require` to return covered files
|
.pipe(plugins.g.istanbul.hookRequire()) // Force `require` to return covered files
|
||||||
.pipe(plugins.g.gFunction(function(){
|
.pipe(plugins.g.gFunction(function(){
|
||||||
plugins.beautylog.ok("JS has been instrumentalized to get test code coverage!");
|
plugins.beautylog.ok("JS has been instrumentalized to get test code coverage!");
|
||||||
|
Reference in New Issue
Block a user