update readme

This commit is contained in:
Philipp Kunz 2016-03-27 12:32:55 +02:00
parent 73f5a0b055
commit 848d40eeac
5 changed files with 35 additions and 29 deletions

View File

@ -1 +0,0 @@
# README-dev

View File

@ -8,7 +8,8 @@ Write npm modules with TypeScript without hassle.
[![bitHound Code](https://www.bithound.io/github/pushrocks/npmts/badges/code.svg)](https://www.bithound.io/github/pushrocks/npmts)
[![Coverage Status](https://coveralls.io/repos/github/pushrocks/npmts/badge.svg?branch=master)](https://coveralls.io/github/pushrocks/npmts?branch=master)
## How to use npmts
## What is NPMTS?
NPMTS is your friend when it comes to write, test, publish and document NPM modules written in TypeScript.
### Install
First install npmts as dev dependency:
@ -29,18 +30,24 @@ Then use it in package.json's script section to trigger a build:
**Execution order of tasks**
1. Check config in ./npmts.json
1. Clean up from any previous builds (old js files)
1. Install typings
2. Transpile TypeScript with inline sourcemaps
3. Create Declaration Files
4. Instrumentalize created JavaScript files with istanbul
5. Run Tests
6. Create Coverage report
7. Upload Coverage reports to travis (must be activated, only triggers on travis)
1. Transpile TypeScript with inline sourcemaps
1. Create Declaration Files
1. Create JsDoc Documentation
1. Instrumentalize created JavaScript files with istanbul
1. Run Tests
1. Create Coverage report
1. Upload Coverage reports to travis (Tests must pass, Coveralls must be activated, by default only triggers on travis)
1. Upload JsDoc Documentation to gh-pages branch on GitHub. (Tests must pass, requires GitHub Token)
#### npmts.json
the npmts.json is the main config file. You can use it to customize the behaviour of NPMTS.
#### Typings
**npmts** looks for `./ts/typings.json` by default and installs any defined typings to `.ts/typings/`.
You can then reference the ./ts/typings/main.d.ts file in your TypeScript code.
You can then reference the ./ts/typings/main.d.ts file in any of your TypeScript code.
#### TypeScript
by default npmts looks for `./ts/*.ts` and `./test/test.ts` that will compile to
@ -57,22 +64,22 @@ You can reference it in your package.json like this:
"typings": "./index.d.ts",
```
You can then import plugins via the TypeScript `import` Syntax
and tsc will pick up the declaration file automatically.
#### Instrumentalize Code
npmts instrumentalizes the created JavaScript code to create a coverage report.
npmts instrumentalizes (using istanbul) the created JavaScript code to create a coverage report.
#### Tests
When Typings have been installed, TypeScript + Declaration files have been transpiled and the resulting JS has been instrumentalized,
npmts runs `.test/test.js` with mocha.
Any errors will be shown with reference to their originating source in TypeScript.
When requiring the module from other TypeScript files,
the TypeScript Compiler will use the declaration file to resolve typings.
npmts looks for `.test/test.ts` which will be transpiled to test.js and run with mocha.
Any errors will be shown with reference to their originating source in TypeScript
thanks to autogenerated source maps.
### Custom behaviour
Custom behaviour can be achieved through a config file at the root of your package.
Custom behaviour can be achieved through the npmts.json config file at the root of your package.
The file must be named **npmts.json**
```json
@ -91,7 +98,4 @@ The file must be named **npmts.json**
* **ts** You can list as many TypeScript files as you like. The key represents the source TypeScript file, the value the output file.
* **typings** is an array of all direcories that have a typings.json present. Uses the new typings tool from npm.
## Readme for Devs
There is a [README-dev.md](README-dev.md) in the repo.
This is only of interest for you when looking to contribute to, improve or build upon this package.
> We will add more options over time.

8
dist/npmts.tests.js vendored
View File

@ -30,9 +30,11 @@ exports.run = function (configArg) {
return stream;
};
plugins.beautylog.log("now starting tests");
console.log("--------------------------------------------------\n" +
"******************* TESTS: **********************\n" +
"--------------------------------------------------");
console.log("--------------------------------------------------------------\n" +
"***************************" +
" TESTS: ".blue +
"***************************\n" +
"--------------------------------------------------------------");
istanbul().on("finish", function () {
mocha().on("finish", function () {
plugins.beautylog.ok("Tests have passed!");

View File

@ -7,5 +7,4 @@ describe("testplugins", function () {
});
});
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsZ0RBQWdEO0FBQ2hELElBQUksVUFBVSxHQUFHLE9BQU8sQ0FBQyxrQkFBa0IsQ0FBQyxDQUFDO0FBQzdDLFFBQVEsQ0FBQyxhQUFhLEVBQUM7SUFDbkIsUUFBUSxDQUFDLGVBQWUsRUFBQztRQUNyQixFQUFFLENBQUMsc0JBQXNCLEVBQUM7WUFDdEIsVUFBVSxDQUFDLFlBQVksRUFBRSxDQUFBO1FBQzdCLENBQUMsQ0FBQyxDQUFDO0lBQ1AsQ0FBQyxDQUFDLENBQUM7QUFDUCxDQUFDLENBQUMsQ0FBQyIsImZpbGUiOiJ0ZXN0LmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8vIDxyZWZlcmVuY2UgcGF0aD1cIi4uL3RzL3R5cGluZ3MvbWFpbi5kLnRzXCIgLz5cbnZhciB0ZXN0cGx1Z2luID0gcmVxdWlyZShcIi4uL2Rpc3QvaW5kZXguanNcIik7XG5kZXNjcmliZShcInRlc3RwbHVnaW5zXCIsZnVuY3Rpb24oKXtcbiAgICBkZXNjcmliZShcIi5sb2dTb21ldGhpbmdcIixmdW5jdGlvbigpe1xuICAgICAgICBpdChcInNob3VsZCBsb2cgc29tZXRoaW5nXCIsZnVuY3Rpb24oKXtcbiAgICAgICAgICAgIHRlc3RwbHVnaW4ubG9nU29tZXRoaW5nKClcbiAgICAgICAgfSk7XG4gICAgfSk7XG59KTsiXSwic291cmNlUm9vdCI6Ii9zb3VyY2UvIn0=
//# sourceMappingURL=test.js.map

View File

@ -38,9 +38,11 @@ export var run = function(configArg) {
plugins.beautylog.log("now starting tests");
console.log(
"--------------------------------------------------\n" +
"******************* TESTS: **********************\n" +
"--------------------------------------------------"
"--------------------------------------------------------------\n" +
"***************************" +
" TESTS: ".blue +
"***************************\n" +
"--------------------------------------------------------------"
);
istanbul().on("finish",function(){
mocha().on("finish",function(){