Compare commits

...

12 Commits

Author SHA1 Message Date
b87de178c0 2.2.4 2016-02-16 09:53:35 +01:00
0580f29d30 update ReadeMe 2016-02-16 09:52:24 +01:00
2c17273671 update badge order 2016-02-14 03:20:53 +01:00
669ed2e6ab add badges 2016-02-14 03:19:54 +01:00
8bc73b2bf4 update readme 2016-02-14 03:13:03 +01:00
78e5defd7c update readme 2016-02-14 03:12:02 +01:00
7e540bda87 2.2.3 2016-02-11 19:10:14 +01:00
b293dfe92d add figlet greeting 2016-02-11 19:10:01 +01:00
a753a5db2c 2.2.2 2016-02-09 20:36:40 +01:00
27f79b4425 readded test.ts to default build process 2016-02-09 20:36:31 +01:00
1ada5dd5a9 2.2.1 2016-02-09 17:42:43 +01:00
a41bfd442c fix coveralls initial value 2016-02-09 17:42:31 +01:00
10 changed files with 51 additions and 13 deletions

View File

@ -2,6 +2,10 @@
Write npm modules with TypeScript without hassle. Write npm modules with TypeScript without hassle.
## Status ## Status
[![Build Status](https://travis-ci.org/pushrocks/npmts.svg?branch=master)](https://travis-ci.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 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 ## How to use npmts
@ -22,6 +26,23 @@ Then use it in package.json's script section to trigger a build:
``` ```
### Default behaviour ### Default behaviour
**Execution order of tasks**
1. Install typings
2. Compile TypeScript
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)
#### 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.
#### TypeScript
by default npmts looks for `./ts/index.ts` and `./ts/test.ts` that will compile to by default npmts looks for `./ts/index.ts` and `./ts/test.ts` that will compile to
`./index.js` and `./test.js` `./index.js` and `./test.js`
@ -34,13 +55,21 @@ You can reference it in your package.json like this:
"typings": "./index.d.ts", "typings": "./index.d.ts",
``` ```
#### Instrumentalize Code
npmts instrumentalizes 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.
When requiring the module from other TypeScript files, When requiring the module from other TypeScript files,
the TypeScript Compiler will use the declaration file to resolve typings. the TypeScript Compiler will use the declaration file to resolve typings.
### Custom behaviour ### Custom behaviour
NPMTS looks for an npmts.json at the root of your package. Custom behaviour can be achieved through a config file at the root of your package.
The file must be named **npmts.json**
```json ```json
{ {
@ -58,6 +87,7 @@ NPMTS looks for an npmts.json at the root of your package.
* **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.
## Readme for Devs ## Readme for Devs
There is a [README-dev.md](README-dev.md) in the repo. 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. This is only of interest for you when looking to contribute to, improve or build upon this package.

View File

@ -76,7 +76,7 @@ var NpmtsOptions;
var done = plugins.q.defer(); var done = plugins.q.defer();
var config = configArg; var config = configArg;
if (typeof config.coveralls === "undefined") { if (typeof config.coveralls === "undefined") {
config.coveralls = true; config.coveralls = false;
} }
if (config.mode == "default") { if (config.mode == "default") {
config.typings = [ config.typings = [
@ -84,6 +84,7 @@ var NpmtsOptions;
]; ];
config.ts = (_a = {}, config.ts = (_a = {},
_a["./ts/index.ts"] = "./index.js", _a["./ts/index.ts"] = "./index.js",
_a["./ts/test.ts"] = "./test/test.js",
_a _a
); );
config.test = ["./index.js"]; config.test = ["./index.js"];
@ -250,5 +251,6 @@ var NpmtsPromisechain;
/// <reference path="./npmts.promisechain.ts" /> /// <reference path="./npmts.promisechain.ts" />
console.log("**** starting NPMTS ****"); console.log("**** starting NPMTS ****");
var plugins = NpmtsPlugins.init(); var plugins = NpmtsPlugins.init();
plugins.beautylog.figletSync("NPMTS");
var paths = NpmtsPaths.init(); var paths = NpmtsPaths.init();
var promisechain = NpmtsPromisechain.init(); var promisechain = NpmtsPromisechain.init();

View File

@ -1,6 +1,6 @@
{ {
"name": "npmts", "name": "npmts",
"version": "2.2.0", "version": "2.2.4",
"description": "write npm modules with TypeScript", "description": "write npm modules with TypeScript",
"main": "index.js", "main": "index.js",
"typings": "./index.d.ts", "typings": "./index.d.ts",
@ -26,19 +26,19 @@
}, },
"homepage": "https://github.com/pushrocks/npmts#readme", "homepage": "https://github.com/pushrocks/npmts#readme",
"dependencies": { "dependencies": {
"beautylog": "2.0.7", "beautylog": "2.1.1",
"fs-extra": "^0.26.5", "fs-extra": "^0.26.5",
"gulp": "3.9.0", "gulp": "3.9.1",
"gulp-coveralls": "^0.1.4", "gulp-coveralls": "^0.1.4",
"gulp-insert": "0.5.0", "gulp-insert": "0.5.0",
"gulp-istanbul": "^0.10.3", "gulp-istanbul": "^0.10.3",
"gulp-mocha": "^2.2.0", "gulp-mocha": "^2.2.0",
"gulp-typescript": "2.10.0", "gulp-typescript": "2.11.0",
"gulp-typings": "0.0.0", "gulp-typings": "0.0.0",
"merge2": "1.0.1", "merge2": "1.0.1",
"q": "^1.4.1", "q": "^1.4.1",
"smartcli": "0.0.11", "smartcli": "0.0.11",
"smartfile": "0.0.11", "smartfile": "0.0.11",
"typings": "^0.6.6" "typings": "^0.6.8"
} }
} }

View File

@ -77,7 +77,7 @@
</div><!-- /wrapper --> </div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'> <div class='footer quiet pad2 space-top1 center small'>
Code coverage Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Tue Feb 09 2016 17:25:54 GMT+0100 (CET) generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Feb 11 2016 19:08:46 GMT+0100 (CET)
</div> </div>
</div> </div>
<script src="../prettify.js"></script> <script src="../prettify.js"></script>

View File

@ -76,7 +76,7 @@ module.exports = testplugin;
</div><!-- /wrapper --> </div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'> <div class='footer quiet pad2 space-top1 center small'>
Code coverage Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Tue Feb 09 2016 17:25:54 GMT+0100 (CET) generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Feb 11 2016 19:08:46 GMT+0100 (CET)
</div> </div>
</div> </div>
<script src="../prettify.js"></script> <script src="../prettify.js"></script>

View File

@ -77,7 +77,7 @@
</div><!-- /wrapper --> </div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'> <div class='footer quiet pad2 space-top1 center small'>
Code coverage Code coverage
generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Tue Feb 09 2016 17:25:54 GMT+0100 (CET) generated by <a href="http://istanbul-js.org/" target="_blank">istanbul</a> at Thu Feb 11 2016 19:08:46 GMT+0100 (CET)
</div> </div>
</div> </div>
<script src="prettify.js"></script> <script src="prettify.js"></script>

2
test/assets/test/test.d.ts vendored Normal file
View File

@ -0,0 +1,2 @@
/// <reference path="ts/typings/main.d.ts" />
declare var testplugin: any;

View File

@ -1,3 +1,5 @@
#!/usr/bin/env node
/// <reference path="./typings/main.d.ts" /> /// <reference path="./typings/main.d.ts" />
console.log("**** starting test ****"); console.log("**** starting test ****");
var testplugin = require("../index.js"); var testplugin = require("../index.js");

View File

@ -7,7 +7,8 @@
/// <reference path="./npmts.compile.ts" /> /// <reference path="./npmts.compile.ts" />
/// <reference path="./npmts.tests.ts" /> /// <reference path="./npmts.tests.ts" />
/// <reference path="./npmts.promisechain.ts" /> /// <reference path="./npmts.promisechain.ts" />
console.log("**** starting NPMTS ****") console.log("**** starting NPMTS ****");
var plugins = NpmtsPlugins.init(); var plugins = NpmtsPlugins.init();
plugins.beautylog.figletSync("NPMTS");
var paths = NpmtsPaths.init(); var paths = NpmtsPaths.init();
var promisechain = NpmtsPromisechain.init(); var promisechain = NpmtsPromisechain.init();

View File

@ -4,14 +4,15 @@ module NpmtsOptions {
var done = plugins.q.defer(); var done = plugins.q.defer();
var config = configArg; var config = configArg;
if (typeof config.coveralls === "undefined"){ if (typeof config.coveralls === "undefined"){
config.coveralls = true; config.coveralls = false;
} }
if (config.mode == "default"){ if (config.mode == "default"){
config.typings = [ config.typings = [
"./ts/" "./ts/"
]; ];
config.ts = { config.ts = {
["./ts/index.ts"]: "./index.js" ["./ts/index.ts"]: "./index.js",
["./ts/test.ts"]: "./test/test.js"
}; };
config.test = ["./index.js"]; config.test = ["./index.js"];
done.resolve(config); done.resolve(config);