update readme
This commit is contained in:
parent
73f5a0b055
commit
848d40eeac
@ -1 +0,0 @@
|
|||||||
# README-dev
|
|
44
README.md
44
README.md
@ -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)
|
[![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)
|
[![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
|
### Install
|
||||||
First install npmts as dev dependency:
|
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**
|
**Execution order of tasks**
|
||||||
|
|
||||||
|
1. Check config in ./npmts.json
|
||||||
|
1. Clean up from any previous builds (old js files)
|
||||||
1. Install typings
|
1. Install typings
|
||||||
2. Transpile TypeScript with inline sourcemaps
|
1. Transpile TypeScript with inline sourcemaps
|
||||||
3. Create Declaration Files
|
1. Create Declaration Files
|
||||||
4. Instrumentalize created JavaScript files with istanbul
|
1. Create JsDoc Documentation
|
||||||
5. Run Tests
|
1. Instrumentalize created JavaScript files with istanbul
|
||||||
6. Create Coverage report
|
1. Run Tests
|
||||||
7. Upload Coverage reports to travis (must be activated, only triggers on travis)
|
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
|
#### Typings
|
||||||
**npmts** looks for `./ts/typings.json` by default and installs any defined typings to `.ts/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
|
#### 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
|
||||||
@ -57,22 +64,22 @@ You can reference it in your package.json like this:
|
|||||||
"typings": "./index.d.ts",
|
"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
|
#### 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
|
#### Tests
|
||||||
When Typings have been installed, TypeScript + Declaration files have been transpiled and the resulting JS has been instrumentalized,
|
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.
|
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.
|
|
||||||
|
|
||||||
When requiring the module from other TypeScript files,
|
|
||||||
the TypeScript Compiler will use the declaration file to resolve typings.
|
|
||||||
|
|
||||||
|
Any errors will be shown with reference to their originating source in TypeScript
|
||||||
|
thanks to autogenerated source maps.
|
||||||
|
|
||||||
|
|
||||||
### Custom behaviour
|
### 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**
|
The file must be named **npmts.json**
|
||||||
|
|
||||||
```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.
|
* **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.
|
* **typings** is an array of all direcories that have a typings.json present. Uses the new typings tool from npm.
|
||||||
|
|
||||||
|
> We will add more options over time.
|
||||||
## 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.
|
|
8
dist/npmts.tests.js
vendored
8
dist/npmts.tests.js
vendored
@ -30,9 +30,11 @@ exports.run = function (configArg) {
|
|||||||
return stream;
|
return stream;
|
||||||
};
|
};
|
||||||
plugins.beautylog.log("now starting tests");
|
plugins.beautylog.log("now starting tests");
|
||||||
console.log("--------------------------------------------------\n" +
|
console.log("--------------------------------------------------------------\n" +
|
||||||
"******************* TESTS: **********************\n" +
|
"***************************" +
|
||||||
"--------------------------------------------------");
|
" TESTS: ".blue +
|
||||||
|
"***************************\n" +
|
||||||
|
"--------------------------------------------------------------");
|
||||||
istanbul().on("finish", function () {
|
istanbul().on("finish", function () {
|
||||||
mocha().on("finish", function () {
|
mocha().on("finish", function () {
|
||||||
plugins.beautylog.ok("Tests have passed!");
|
plugins.beautylog.ok("Tests have passed!");
|
||||||
|
@ -7,5 +7,4 @@ describe("testplugins", function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
//# sourceMappingURL=test.js.map
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsZ0RBQWdEO0FBQ2hELElBQUksVUFBVSxHQUFHLE9BQU8sQ0FBQyxrQkFBa0IsQ0FBQyxDQUFDO0FBQzdDLFFBQVEsQ0FBQyxhQUFhLEVBQUM7SUFDbkIsUUFBUSxDQUFDLGVBQWUsRUFBQztRQUNyQixFQUFFLENBQUMsc0JBQXNCLEVBQUM7WUFDdEIsVUFBVSxDQUFDLFlBQVksRUFBRSxDQUFBO1FBQzdCLENBQUMsQ0FBQyxDQUFDO0lBQ1AsQ0FBQyxDQUFDLENBQUM7QUFDUCxDQUFDLENBQUMsQ0FBQyIsImZpbGUiOiJ0ZXN0LmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8vIDxyZWZlcmVuY2UgcGF0aD1cIi4uL3RzL3R5cGluZ3MvbWFpbi5kLnRzXCIgLz5cbnZhciB0ZXN0cGx1Z2luID0gcmVxdWlyZShcIi4uL2Rpc3QvaW5kZXguanNcIik7XG5kZXNjcmliZShcInRlc3RwbHVnaW5zXCIsZnVuY3Rpb24oKXtcbiAgICBkZXNjcmliZShcIi5sb2dTb21ldGhpbmdcIixmdW5jdGlvbigpe1xuICAgICAgICBpdChcInNob3VsZCBsb2cgc29tZXRoaW5nXCIsZnVuY3Rpb24oKXtcbiAgICAgICAgICAgIHRlc3RwbHVnaW4ubG9nU29tZXRoaW5nKClcbiAgICAgICAgfSk7XG4gICAgfSk7XG59KTsiXSwic291cmNlUm9vdCI6Ii9zb3VyY2UvIn0=
|
|
@ -38,9 +38,11 @@ export var run = function(configArg) {
|
|||||||
|
|
||||||
plugins.beautylog.log("now starting tests");
|
plugins.beautylog.log("now starting tests");
|
||||||
console.log(
|
console.log(
|
||||||
"--------------------------------------------------\n" +
|
"--------------------------------------------------------------\n" +
|
||||||
"******************* TESTS: **********************\n" +
|
"***************************" +
|
||||||
"--------------------------------------------------"
|
" TESTS: ".blue +
|
||||||
|
"***************************\n" +
|
||||||
|
"--------------------------------------------------------------"
|
||||||
);
|
);
|
||||||
istanbul().on("finish",function(){
|
istanbul().on("finish",function(){
|
||||||
mocha().on("finish",function(){
|
mocha().on("finish",function(){
|
||||||
|
Loading…
Reference in New Issue
Block a user