Compare commits

...

11 Commits

Author SHA1 Message Date
6df449394d 5.3.11 2016-07-14 13:08:48 +02:00
27b6119bbb improve README 2016-07-14 13:08:43 +02:00
b22abef889 5.3.10 2016-07-14 13:04:11 +02:00
4d8a7a4202 Merge branch 'master' of gitlab.com:pushrocks/npmts 2016-07-14 13:03:54 +02:00
72bc08e973 5.3.9 2016-07-14 13:03:09 +02:00
430f636ae4 now using EsDoc, closes #2 2016-07-14 13:02:58 +02:00
bbc8f13ecf update docker link in README 2016-07-11 15:50:39 +02:00
a01f07f62c improve README 2016-07-11 14:46:31 +02:00
36316e63b2 5.3.9 2016-07-11 14:42:43 +02:00
5c5e88c226 further improve README 2016-07-11 14:42:36 +02:00
af968f65df update README 2016-07-11 13:46:44 +02:00
8 changed files with 52 additions and 87 deletions

View File

@ -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

View File

@ -3,7 +3,6 @@ Write npm modules with TypeScript without hassle.
## Status ## Status
[![build status](https://gitlab.com/pushrocks/npmts/badges/master/build.svg)](https://gitlab.com/pushrocks/npmts/commits/master) [![build status](https://gitlab.com/pushrocks/npmts/badges/master/build.svg)](https://gitlab.com/pushrocks/npmts/commits/master)
[![Build status](https://ci.appveyor.com/api/projects/status/22fuqa0uv21rcjh4/branch/master?svg=true)](https://ci.appveyor.com/project/philkunz/npmts/branch/master)
[![Dependency Status](https://david-dm.org/pushrocks/npmts.svg)](https://david-dm.org/pushrocks/npmts) [![Dependency Status](https://david-dm.org/pushrocks/npmts.svg)](https://david-dm.org/pushrocks/npmts)
[![bitHound Dependencies](https://www.bithound.io/github/pushrocks/npmts/badges/dependencies.svg)](https://www.bithound.io/github/pushrocks/npmts/master/dependencies/npm) [![bitHound Dependencies](https://www.bithound.io/github/pushrocks/npmts/badges/dependencies.svg)](https://www.bithound.io/github/pushrocks/npmts/master/dependencies/npm)
[![bitHound Code](https://www.bithound.io/github/pushrocks/npmts/badges/code.svg)](https://www.bithound.io/github/pushrocks/npmts) [![bitHound Code](https://www.bithound.io/github/pushrocks/npmts/badges/code.svg)](https://www.bithound.io/github/pushrocks/npmts)
@ -14,10 +13,13 @@ NPMTS is your friend when it comes to write, test, publish and document NPM modu
By default NPMTS will **bundle declaration files**. As a result npm module **code completion in editors like Visual Studio Code** works. By default NPMTS will **bundle declaration files**. As a result npm module **code completion in editors like Visual Studio Code** works.
There is a docker image available that includes npmts to make CI a breeze: 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-node:npmts on Dockerhub](https://hub.docker.com/r/hosttoday/ht-docker-node/)
### 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)"
} }
``` ```
@ -38,7 +40,7 @@ Then add it to your package.json's script section to trigger a build:
1. Clean up from any previous builds (old js files) 1. Clean up from any previous builds (old js files)
1. Install typings 1. Install typings
1. Transpile TypeScript with **inline sourcemaps** and **declaration files** 1. Transpile TypeScript with **inline sourcemaps** and **declaration files**
1. Create JsDoc Documentation 1. Create EsDoc Documentation
1. Instrumentalize created JavaScript files with istanbul 1. Instrumentalize created JavaScript files with istanbul
1. Run Tests 1. Run Tests
1. Create Coverage report 1. Create Coverage report
@ -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.
@ -124,7 +104,6 @@ Any errors will be shown with reference to their originating source in TypeScrip
thanks to autogenerated source maps. thanks to autogenerated source maps.
## Example Usage in modules: ## Example Usage in modules:
* [gulp-typings](https://www.npmjs.com/package/gulp-typings)
* [gulp-browser](https://www.npmjs.com/package/gulp-typings) * [gulp-browser](https://www.npmjs.com/package/gulp-typings)
> We will add more options over time. > We will add more options over time.
@ -132,7 +111,7 @@ thanks to autogenerated source maps.
## Tips and tricks: ## 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 [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 JsDocs for the module * Use [npmpage](https://www.npmjs.com/package/npmtspage) to create a webpage from coverage reports and EsDocs for the module
* Use [hosttoday/ht-docker-node:npmts](https://hub.docker.com/r/hosttoday/ht-docker-node/) for speedy CI builds * Use [hosttoday/ht-docker-node:npmts](https://hub.docker.com/r/hosttoday/ht-docker-node/) for speedy CI builds
## About the authors: ## About the authors:

30
dist/npmts.jsdoc.js vendored
View File

@ -3,26 +3,24 @@ require("typings-global");
var plugins = require("./npmts.plugins"); var plugins = require("./npmts.plugins");
var paths = require("./npmts.paths"); var paths = require("./npmts.paths");
var npmts_promisechain_1 = require("./npmts.promisechain"); var npmts_promisechain_1 = require("./npmts.promisechain");
var genJsdoc = function (configArg) { var genEsDoc = function (configArg) {
var done = plugins.Q.defer(); var done = plugins.Q.defer();
npmts_promisechain_1.npmtsOra.text("now generating " + "JsDoc documentation".yellow); npmts_promisechain_1.npmtsOra.text("now generating " + "EsDoc documentation".yellow);
plugins.gulp.src([ plugins.beautylog.log("ESDoc Output:");
plugins.path.join(paths.cwd, "README.md"), var esdocConfig = {
plugins.path.join(paths.distDir, "**/*.js") source: paths.distDir,
]) destination: paths.docsDir
.pipe(plugins.g.jsdoc3({ };
opts: { plugins.esdoc.generate(esdocConfig, plugins.esdocPublisher);
destination: paths.docsDir plugins.beautylog.ok("Docs by EsDoc have been created!");
} done.resolve(configArg);
}, function () {
plugins.beautylog.ok("JsDoc documentation has been generated!");
done.resolve(configArg);
}));
return done.promise; return done.promise;
}; };
exports.run = function (configArg) { exports.run = function (configArg) {
var done = plugins.Q.defer(); var done = plugins.Q.defer();
genJsdoc(configArg) genEsDoc(configArg)
.then(done.resolve); .then(function () {
done.resolve(configArg);
});
return done.promise; return done.promise;
}; };

View File

@ -1,10 +1,11 @@
import "typings-global"; import "typings-global";
export import beautylog = require("beautylog"); export import beautylog = require("beautylog");
export declare let esdoc: any;
export declare let esdocPublisher: any;
export declare let gulp: any; export declare let gulp: any;
export declare let g: { export declare let g: {
gFunction: any; gFunction: any;
istanbul: any; istanbul: any;
jsdoc3: any;
mocha: any; mocha: any;
replace: any; replace: any;
sourcemaps: any; sourcemaps: any;

View File

@ -1,11 +1,12 @@
"use strict"; "use strict";
require("typings-global"); require("typings-global");
exports.beautylog = require("beautylog"); exports.beautylog = require("beautylog");
exports.esdoc = require("esdoc");
exports.esdocPublisher = require("esdoc/out/src/Publisher/publish");
exports.gulp = require("gulp"); exports.gulp = require("gulp");
exports.g = { exports.g = {
gFunction: require("gulp-function"), gFunction: require("gulp-function"),
istanbul: require("gulp-istanbul"), istanbul: require("gulp-istanbul"),
jsdoc3: require("gulp-jsdoc3"),
mocha: require("gulp-mocha"), mocha: require("gulp-mocha"),
replace: require("gulp-replace"), replace: require("gulp-replace"),
sourcemaps: require("gulp-sourcemaps") sourcemaps: require("gulp-sourcemaps")

View File

@ -1,6 +1,6 @@
{ {
"name": "npmts", "name": "npmts",
"version": "5.3.8", "version": "5.3.11",
"description": "write npm modules with TypeScript", "description": "write npm modules with TypeScript",
"main": "dist/index.js", "main": "dist/index.js",
"bin": { "bin": {
@ -29,11 +29,12 @@
}, },
"homepage": "https://gitlab.com/pushrocks/npmts#readme", "homepage": "https://gitlab.com/pushrocks/npmts#readme",
"dependencies": { "dependencies": {
"@types/minimatch": "^2.0.22-alpha", "@types/minimatch": "^2.0.27-alpha",
"@types/q": "0.0.21-alpha", "@types/q": "0.0.26-alpha",
"@types/shelljs": "^0.3.21-alpha", "@types/shelljs": "^0.3.26-alpha",
"beautylog": "5.0.12", "beautylog": "5.0.13",
"early": "^2.0.13", "early": "^2.0.13",
"esdoc": "^0.4.7",
"gulp": "3.9.1", "gulp": "3.9.1",
"gulp-concat": "^2.6.0", "gulp-concat": "^2.6.0",
"gulp-function": "^1.3.6", "gulp-function": "^1.3.6",
@ -54,9 +55,9 @@
"smartenv": "1.2.5", "smartenv": "1.2.5",
"smartfile": "4.0.10", "smartfile": "4.0.10",
"smartpath": "3.2.2", "smartpath": "3.2.2",
"smartstring": "^2.0.10", "smartstring": "^2.0.14",
"source-map-support": "^0.4.1", "source-map-support": "^0.4.1",
"tsn": "^1.0.5", "tsn": "^1.0.6",
"typescript": "^2.0.0-dev.20160630", "typescript": "^2.0.0-dev.20160630",
"typings-global": "*" "typings-global": "*"
}, },

View File

@ -3,28 +3,26 @@ import plugins = require("./npmts.plugins");
import paths = require("./npmts.paths"); import paths = require("./npmts.paths");
import {npmtsOra} from "./npmts.promisechain"; import {npmtsOra} from "./npmts.promisechain";
let genJsdoc = function(configArg){ let genEsDoc = function(configArg){
let done = plugins.Q.defer(); let done = plugins.Q.defer();
npmtsOra.text("now generating " + "JsDoc documentation".yellow); npmtsOra.text("now generating " + "EsDoc documentation".yellow);
plugins.gulp.src([ plugins.beautylog.log("ESDoc Output:");
plugins.path.join(paths.cwd,"README.md"), let esdocConfig = {
plugins.path.join(paths.distDir,"**/*.js") source: paths.distDir,
]) destination: paths.docsDir
.pipe(plugins.g.jsdoc3({ };
opts: { plugins.esdoc.generate(esdocConfig,plugins.esdocPublisher);
destination: paths.docsDir plugins.beautylog.ok("Docs by EsDoc have been created!");
} done.resolve(configArg);
}, function(){
plugins.beautylog.ok("JsDoc documentation has been generated!");
done.resolve(configArg)
}));
return done.promise; return done.promise;
}; };
export let run = function(configArg){ export let run = function(configArg){
let done = plugins.Q.defer(); let done = plugins.Q.defer();
genJsdoc(configArg) genEsDoc(configArg)
.then(done.resolve); .then(() => {
done.resolve(configArg);
});
return done.promise; return done.promise;
}; };

View File

@ -1,10 +1,11 @@
import "typings-global"; import "typings-global";
export import beautylog = require("beautylog"); export import beautylog = require("beautylog");
export let esdoc = require("esdoc");
export let esdocPublisher = require("esdoc/out/src/Publisher/publish");
export let gulp = require("gulp"); export let gulp = require("gulp");
export let g = { export let g = {
gFunction: require("gulp-function"), gFunction: require("gulp-function"),
istanbul: require("gulp-istanbul"), istanbul: require("gulp-istanbul"),
jsdoc3: require("gulp-jsdoc3"),
mocha: require("gulp-mocha"), mocha: require("gulp-mocha"),
replace: require("gulp-replace"), replace: require("gulp-replace"),
sourcemaps: require("gulp-sourcemaps") sourcemaps: require("gulp-sourcemaps")