Compare commits
198 Commits
Author | SHA1 | Date | |
---|---|---|---|
995161dd54 | |||
29c941044f | |||
1dc8b1aeec | |||
a0c83c8f48 | |||
b6e63664bb | |||
88b39213a6 | |||
6dad1c3d85 | |||
7d9b9b2d1d | |||
e3e6a326b5 | |||
3d59f6d393 | |||
07d752449e | |||
ea779add20 | |||
938a7bd872 | |||
45f9674550 | |||
eae983b271 | |||
871990725d | |||
d46bb18893 | |||
d8fb9747cd | |||
53209b18a9 | |||
3e3561f4bb | |||
099b513e0a | |||
cf15c428c1 | |||
3bd876a201 | |||
af62f20614 | |||
69eba08b27 | |||
6635265f4b | |||
ebdda5f969 | |||
f3a24154b4 | |||
2980b6b5f3 | |||
570046ff67 | |||
112ce2d0d6 | |||
791eaefe3c | |||
a3af90844a | |||
e389f78256 | |||
9e8fc76623 | |||
bf20ad9e61 | |||
58043d0fa2 | |||
5b0814520a | |||
848d40eeac | |||
73f5a0b055 | |||
f2a169ac7d | |||
3cdd22044e | |||
60d200135e | |||
e8238dc907 | |||
007e7539c8 | |||
e3c2c56548 | |||
f0954b19e0 | |||
48a9d19b8e | |||
7d39683972 | |||
01e9f386a6 | |||
2f4fb28b5d | |||
50b14e60c6 | |||
4753a4ff82 | |||
fe9ea47208 | |||
c8f29dc146 | |||
e7e228c900 | |||
b76cb1376d | |||
eed1a65415 | |||
040100b73f | |||
3ce49c7e97 | |||
55d7018891 | |||
d98d035902 | |||
217af24d25 | |||
11c43f59d9 | |||
14c36dd894 | |||
9f74fab2b2 | |||
8efa67a4ff | |||
f7304f59a5 | |||
070385867e | |||
e429eb8ae0 | |||
6045174edb | |||
08dcdb2c9f | |||
44aa92c83c | |||
e43541cf90 | |||
414e845b80 | |||
c18eb85ec8 | |||
3ae3598c96 | |||
26eca7aa65 | |||
48d9de65a0 | |||
db63e07fa3 | |||
be65ee65cb | |||
78bbe2d1d7 | |||
3960cd9973 | |||
0bad43d726 | |||
d5407e33dd | |||
2035045aef | |||
de0f8cfb8b | |||
fe7d2f1024 | |||
9f0343b01c | |||
04a02f6b96 | |||
cb3f343c92 | |||
6227e47037 | |||
2730ca4299 | |||
07aae64965 | |||
56841d5bb0 | |||
40301ede35 | |||
70213b04bc | |||
5160aab180 | |||
e8806e548b | |||
fcdaad540e | |||
6f33b1f5ef | |||
45418d6049 | |||
4261ee3687 | |||
9fc3606163 | |||
2436b30605 | |||
9ad59704be | |||
29f3832d63 | |||
2d82a3a037 | |||
4806f5ceff | |||
f2ef982189 | |||
5d6ead017b | |||
1c2b4e421d | |||
6cf7d2ca0b | |||
676c072631 | |||
f29c04e09c | |||
77a06a0fc4 | |||
c9792b1955 | |||
b87de178c0 | |||
0580f29d30 | |||
2c17273671 | |||
669ed2e6ab | |||
8bc73b2bf4 | |||
78e5defd7c | |||
7e540bda87 | |||
b293dfe92d | |||
a753a5db2c | |||
27f79b4425 | |||
1ada5dd5a9 | |||
a41bfd442c | |||
2917b10ffb | |||
bfc5bbbbb7 | |||
cf507a4a17 | |||
73a57ed264 | |||
39b79b679c | |||
cc053ee396 | |||
df5371187b | |||
cbda76c380 | |||
e20bcec133 | |||
3e673e04b2 | |||
2090dad540 | |||
ebe7a02ef0 | |||
3f9194f344 | |||
13c9c96cc6 | |||
3f0b2b1599 | |||
d477e492eb | |||
f39cb03fc2 | |||
f42744b927 | |||
038994e9e5 | |||
7a26721420 | |||
0dc307f082 | |||
4b2c0fe461 | |||
50fd5e83ad | |||
3e55a666b2 | |||
5d8ce3f227 | |||
de4bbaed9f | |||
7d18e92ff1 | |||
634763c03f | |||
3352165436 | |||
6c57a4703f | |||
822734e545 | |||
8dcbe98c60 | |||
2fbcb58078 | |||
362f8d5388 | |||
8fb4a60fb3 | |||
7c6b5afd5f | |||
f83eb035c2 | |||
359e844c69 | |||
6b40cfd954 | |||
8f13dbef9f | |||
9ff2453d7b | |||
e40a82e8c9 | |||
cac50f7099 | |||
ef64874411 | |||
870d24701c | |||
d12a09d3d8 | |||
2a4811ccb0 | |||
146b9cf683 | |||
9110a6701d | |||
3101af3726 | |||
20283c6cda | |||
814542e9cd | |||
bea8a50f0b | |||
d18dc73522 | |||
6bf81fc665 | |||
a9a23687e9 | |||
e50a86439b | |||
ee69817038 | |||
ef314f5b2d | |||
24f9e5e982 | |||
660942e798 | |||
f5bc4578d7 | |||
2a87fc839d | |||
149e0cbc9e | |||
3b69350ce2 | |||
ea793f9556 | |||
5266fcd3df | |||
39b7fe99c7 | |||
e1419d85cc |
12
.gitignore
vendored
12
.gitignore
vendored
@ -1,3 +1,13 @@
|
||||
.idea/
|
||||
.c9/
|
||||
node_modules/
|
||||
node_modules/
|
||||
test/assets/**/node_modules/
|
||||
test/assets/**/docs/
|
||||
test/assets/**/typings/
|
||||
test/assets/**/coverage/
|
||||
ts/*.js
|
||||
ts/*.js.map
|
||||
ts/typings/
|
||||
docs/
|
||||
|
||||
.DS_Store
|
@ -1,5 +1,7 @@
|
||||
.idea/
|
||||
support
|
||||
compile
|
||||
test
|
||||
test/
|
||||
docs/
|
||||
examples
|
||||
.gitignore
|
15
.travis.yml
Normal file
15
.travis.yml
Normal file
@ -0,0 +1,15 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- 4.3.1
|
||||
- stable
|
||||
deploy:
|
||||
provider: npm
|
||||
email: npm@lossless.digital
|
||||
api_key:
|
||||
secure: k075QdAcmEdmAoVaP5vclLnZmhbZB39v85VIUMWAKXbIAU+liHrYZRlIEYfAaIUrf6sha+zAo/U/vjAN7c5ArB7J/HjCLJ3lsi2fWtaSRlYQrYX9/EhU0S+YZjRE8Jrn4hGTcce6I2mANBnEzvzlXrlKaqVvSqOqTO9nJ5aDBCGa5XT3EwlHKkRlAlL3ZOLrRg38R343E8ifZBsbn9G0e+RgDt0sic3WD8NME9lpsQ/99UZKH00duHbhF9nme5Sjdh86y01hvsaBf+CLR4gfS2IntnrCSrZbETFrsOBUyMnJZDQ3qlrjcEaiTkpJ4iSIqr+ftwGMMD6S1MxCTPqkp64UIeMz2Tg41HqoaeIg7z8cF0APv6M9ZAdWhsU43GqsMe70dK900JZpQAkQxMf/6NpPpGfZug6TwqLYSIRzvjvNrhYfuyoGfXdAxrM3SJMkIq6rwE+T/y36kZaC3CrQRyNZypNz0vW1M9HLjJUi2vO0U/CDn8tvi1p6ChrDXDfV3H2UIAMHFlAF+GrT7dMWwD+p+d8mc9gpAFEF9zMqAIJamPhwboJxoHjKQrqrq5czNm75ETL77AzfnU6CfQlG5dTIFnGId8y0ZxXvtpBruDoyC1+ZF23MYZmb+ipxQZM2oLCjNLeL3aEePc/JlSm6Gn8w3sIkZTG261F0XZxdApw=
|
||||
on:
|
||||
tags: true
|
||||
repo: pushrocks/npmts
|
||||
env:
|
||||
global:
|
||||
secure: kPKBMnEKoC+K5dXpl11NhuK3LSp0c0fRO60Akj3QeQBjUWnVAcF0Ht30c31y0lnJaMEzXhmUIKdR7RQnlmw5be4TYGINzY7FD3Dcv7o+HO1ZQrkpMWSu46jF6ZJer9moGjZ8e0rX8wZyB9SqsXYlwWRzqvxfOVxQfTvU3BEnJKHbhq+R5JMJ8dwLBPNTJKMWKq85KNsjo3ap0BjxdBUoRLzvrn31VOPH30BkvmLGc5YiIz5QmITll/T2wmQKYTNT2qDlEJ729B8pYa3eNlCNi89AxsLDGCmEoJAVrPsyw5g+gAyBqZ1GRULy83UJbELUq7cse3MRLMSwCAm4f0INRAuqcyiKYJ4+LHd0NwKrFQ/dQ0pvyBTbbEjNemXaakkWH7S6F03UvF+u+tiQ7C97XH0CRsseGlm36zCkAClEhtWVWA4U0Q5c6zqRAAOYOI0xquXalRKPTJe7fCYewp2eqmlp8drt8MxancyKI/ynXNoR5vGFzDTSRoPjTlaYQPmbiH4+Nd5+6Qoj94PEIqghebIPDQo3C7vWts4WGccux5b2q524UgB63hjJQA6+GQOo1q4RibouS6WScn8/tW/ZOEP+sNhDfkeiZUIjye+Q3PyzonGHefgSQ8wBbsc8LOX0cKUcEFWr14nhdQ9ZeW+hrSSF04TbM4zGJPGcKhmT2UU=
|
133
README.md
Normal file
133
README.md
Normal file
@ -0,0 +1,133 @@
|
||||
# npmts
|
||||
Write npm modules with TypeScript without hassle.
|
||||
|
||||
## Status
|
||||
[](https://travis-ci.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)
|
||||
[](https://codecov.io/github/pushrocks/npmts?branch=master)
|
||||
|
||||
## What is NPMTS?
|
||||
NPMTS is your friend when it comes to write, test, publish and document NPM modules written in TypeScript.
|
||||
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:
|
||||
[hosttoday/ht-docker-npmg on Dockerhub](https://hub.docker.com/r/hosttoday/ht-docker-npmg/)
|
||||
|
||||
### Install
|
||||
First install npmts as dev dependency:
|
||||
|
||||
```sh
|
||||
npm install npmts --save-dev
|
||||
```
|
||||
|
||||
Then use it in package.json's script section to trigger a build:
|
||||
|
||||
```json
|
||||
"scripts": {
|
||||
"test": "npmts"
|
||||
}
|
||||
```
|
||||
|
||||
### Default task execution order
|
||||
|
||||
1. Check config in ./npmts.json
|
||||
1. Clean up from any previous builds (old js files)
|
||||
1. Install typings
|
||||
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 codecov.io (Tests must pass, codecov.io 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.
|
||||
|
||||
```json
|
||||
{
|
||||
"mode":"default",
|
||||
"codecov":true,
|
||||
"ts":{
|
||||
"./customdir/*.ts":"./"
|
||||
},
|
||||
"docs": {
|
||||
"publish":true,
|
||||
"destination":"github"
|
||||
},
|
||||
"tsOptions":{
|
||||
"declaration":false,
|
||||
"target":"ES6"
|
||||
},
|
||||
"typings":[
|
||||
"./ts/typings.json",
|
||||
"./subts1/typings.json",
|
||||
"./subts2/typings.json",
|
||||
"./customdir/typings.json"
|
||||
],
|
||||
"typingsInclude":"auto",
|
||||
"cli":true
|
||||
}
|
||||
```
|
||||
|
||||
| key | default value | description |
|
||||
| --- | --- | --- |
|
||||
| `"codecov"` | `true` | if true, coverage data will be uploaded to codecov when running on travis |
|
||||
| `"docs"` | `{"publish":"false"}` | `{"publish":true, destination:"github"}` lets you control what happens with your module documentation |
|
||||
| `"mode"` | `"default"` | "default" will do some defualt stuff, "custom" only does what you specify |
|
||||
| `"tsOptions"` | `{"target":"ES5", "declaration":"true"}` | specify options for tsc |
|
||||
| `"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. |
|
||||
|
||||
#### 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
|
||||
by default npmts looks for `./ts/*.ts` and `./test/test.ts` that will compile to
|
||||
`./dist/*.js` and `./test/test.js`
|
||||
|
||||
Use commonjs module system for wiring up files.
|
||||
|
||||
#### Declaration files
|
||||
**npmts** also creates an `./dist/index.d.ts` declaration file by default.
|
||||
You can reference it in your package.json like this.
|
||||
|
||||
```json
|
||||
"main": "dist/index.js",
|
||||
"typings": ".dist/index.d.ts",
|
||||
```
|
||||
|
||||
This is in line with the latest TypeScript best practices.
|
||||
You can then import plugins via the TypeScript `import` Syntax
|
||||
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
|
||||
|
||||
#### Instrumentalize Code
|
||||
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 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.
|
||||
|
||||
## Example Usage in modules:
|
||||
* [gulp-typings](https://www.npmjs.com/package/gulp-typings)
|
||||
* [gulp-browser](https://www.npmjs.com/package/gulp-typings)
|
||||
|
||||
> We will add more options over time.
|
||||
|
||||
## About the authors:
|
||||
[](https://lossless.com/)
|
||||
|
||||
[](https://paypal.me/lossless)
|
2
assets/cli.js
Normal file
2
assets/cli.js
Normal file
@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env node
|
||||
var index = require("./index.js");
|
1
assets/node-shebang.js
Normal file
1
assets/node-shebang.js
Normal file
@ -0,0 +1 @@
|
||||
#!/usr/bin/env node
|
@ -1,25 +1,49 @@
|
||||
// import gulp
|
||||
var gulp = require("gulp");
|
||||
var gulpTypescript = require("gulp-typescript");
|
||||
var gulpInsert = require("gulp-insert");
|
||||
var plugins = {
|
||||
beautylog: require("beautylog")
|
||||
beautylog: require("beautylog"),
|
||||
gulp: require("gulp"),
|
||||
g:{
|
||||
typescript: require("gulp-typescript"),
|
||||
typings:require("gulp-typings")
|
||||
},
|
||||
mergeStream: require("merge2"),
|
||||
path: require("path")
|
||||
};
|
||||
|
||||
plugins.beautylog.log('now compiling the mojo.io gulp tasks');
|
||||
paths = {
|
||||
packageBase: plugins.path.resolve(
|
||||
plugins.path.join(__dirname,"../")
|
||||
)
|
||||
};
|
||||
|
||||
gulp.task('indexTS', function() {
|
||||
var stream = gulp.src('../ts/index.ts')
|
||||
.pipe(gulpTypescript({
|
||||
out: "index.js"
|
||||
}))
|
||||
.pipe(gulpInsert.prepend('#!/usr/bin/env node\n\n'))
|
||||
.pipe(gulp.dest("../"));
|
||||
return stream;
|
||||
plugins.beautylog.log('now compiling NPMTS');
|
||||
|
||||
plugins.gulp.task("typings",function(){
|
||||
var stream = plugins.gulp.src(plugins.path.join(paths.packageBase,"ts/typings.json"))
|
||||
.pipe(plugins.g.typings());
|
||||
return stream;
|
||||
});
|
||||
|
||||
gulp.task('default',['indexTS'], function() {
|
||||
plugins.gulp.task("TS",["typings"], function() {
|
||||
var stream = plugins.gulp.src([
|
||||
plugins.path.join(paths.packageBase,'ts/**/*.ts'),
|
||||
"!" + plugins.path.join(paths.packageBase,'ts/typings/**/*.d.ts')
|
||||
])
|
||||
.pipe(plugins.g.typescript({
|
||||
target:"ES5",
|
||||
module:"commonjs"
|
||||
}))
|
||||
.pipe(plugins.gulp.dest(plugins.path.join(paths.packageBase, 'dist/')));
|
||||
return stream;
|
||||
});
|
||||
|
||||
plugins.gulp.task("CLI",function(){
|
||||
var stream = plugins.gulp.src(plugins.path.join(paths.packageBase,"assets/cli.js"))
|
||||
.pipe(plugins.gulp.dest(plugins.path.join(paths.packageBase, 'dist/')))
|
||||
});
|
||||
|
||||
plugins.gulp.task('default',['TS',"CLI"], function() {
|
||||
plugins.beautylog.success('Typescript compiled');
|
||||
});
|
||||
|
||||
gulp.start.apply(gulp, ['default']);
|
||||
plugins.gulp.start.apply(plugins.gulp, ['default']);
|
2
dist/cli.js
vendored
Normal file
2
dist/cli.js
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env node
|
||||
var index = require("./index.js");
|
12
dist/index.js
vendored
Normal file
12
dist/index.js
vendored
Normal file
@ -0,0 +1,12 @@
|
||||
"use strict";
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
console.log("**** starting NPMTS ****");
|
||||
var plugins = require("./npmts.plugins");
|
||||
var promisechain = require("./npmts.promisechain");
|
||||
plugins.beautylog.figletSync("NPMTS");
|
||||
try {
|
||||
promisechain.run();
|
||||
}
|
||||
catch (err) {
|
||||
console.log(err);
|
||||
}
|
18
dist/npmts.assets.js
vendored
Normal file
18
dist/npmts.assets.js
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
var plugins = require("./npmts.plugins");
|
||||
var paths = require("./npmts.paths");
|
||||
exports.run = function (configArg) {
|
||||
var done = plugins.Q.defer();
|
||||
var config = configArg;
|
||||
plugins.beautylog.log("now looking at required assets");
|
||||
if (config.cli == true) {
|
||||
plugins.smartfile.fsaction.copy(plugins.path.join(paths.npmtsAssetsDir, "cli.js"), paths.distDir);
|
||||
plugins.beautylog.ok("CLI asset has been installed!");
|
||||
done.resolve(config);
|
||||
}
|
||||
else {
|
||||
done.resolve(config);
|
||||
}
|
||||
return done.promise;
|
||||
};
|
14
dist/npmts.clean.js
vendored
Normal file
14
dist/npmts.clean.js
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
"use strict";
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
var plugins = require("./npmts.plugins");
|
||||
var paths = require("./npmts.paths");
|
||||
exports.run = function (configArg) {
|
||||
plugins.beautylog.log("now cleaning up from previous builds...");
|
||||
var done = plugins.Q.defer();
|
||||
plugins.smartfile.fsaction.remove(paths.distDir)
|
||||
.then(function () {
|
||||
plugins.beautylog.ok("Cleaned up!");
|
||||
done.resolve(configArg);
|
||||
});
|
||||
return done.promise;
|
||||
};
|
1
dist/npmts.cli.js
vendored
Normal file
1
dist/npmts.cli.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
16
dist/npmts.compile.helpers.js
vendored
Normal file
16
dist/npmts.compile.helpers.js
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
var plugins = require("./npmts.plugins");
|
||||
var paths = require("./npmts.paths");
|
||||
var outputPathIsDir = function (configArg, keyArg) {
|
||||
return plugins.smartpath.check.isDir(plugins.path.join(paths.cwd, configArg.ts[keyArg]));
|
||||
};
|
||||
exports.checkOutputPath = function (configArg, keyArg) {
|
||||
if (!outputPathIsDir(configArg, keyArg)) {
|
||||
plugins.beautylog.warn("Skipping " + keyArg + " because " + configArg.ts[keyArg] + " it is no directory!");
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
;
|
||||
};
|
78
dist/npmts.compile.js
vendored
Normal file
78
dist/npmts.compile.js
vendored
Normal file
@ -0,0 +1,78 @@
|
||||
"use strict";
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
var plugins = require("./npmts.plugins");
|
||||
var paths = require("./npmts.paths");
|
||||
var helpers = require("./npmts.compile.helpers");
|
||||
/**
|
||||
* handles definition to make them fit for modular use
|
||||
*/
|
||||
var definitionHandler = function (configArg) {
|
||||
plugins.beautylog.log("now making declaration files ready");
|
||||
var done = plugins.Q.defer();
|
||||
var configTsLenght = Object.keys(configArg.ts).length;
|
||||
if (configTsLenght == 0) {
|
||||
plugins.beautylog.warn("No declaration files found... Are you sure you don't want them?");
|
||||
done.resolve(configArg); //if there are no definition files, resolve...
|
||||
}
|
||||
var localCounter = 0;
|
||||
for (var key in configArg.ts) {
|
||||
var distPath = configArg.ts[key];
|
||||
var stream = plugins.gulp.src(plugins.path.join(distPath, "**/*.d.ts"))
|
||||
.pipe(plugins.g.replace(plugins.smartstring.typescript.regexReferencePath, ""))
|
||||
.pipe(plugins.gulp.dest(distPath))
|
||||
.pipe(plugins.g.gFunction(function () {
|
||||
localCounter++;
|
||||
if (localCounter == configTsLenght) {
|
||||
plugins.beautylog.ok("declaration files ready!!!");
|
||||
done.resolve(configArg);
|
||||
}
|
||||
;
|
||||
}, "atEnd"));
|
||||
}
|
||||
return done.promise;
|
||||
};
|
||||
exports.run = function (configArg) {
|
||||
var done = plugins.Q.defer();
|
||||
var config = configArg;
|
||||
plugins.beautylog.log("now compiling " + "TypeScript".yellow);
|
||||
var moduleStream = plugins.merge2({ end: false });
|
||||
/* -------------------------------------------------
|
||||
* ----------- compile TypeScript --------------------------
|
||||
* ----------------------------------------------- */
|
||||
var tsOptionsDefault = {
|
||||
declaration: true,
|
||||
target: "ES5",
|
||||
module: "commonjs"
|
||||
};
|
||||
/**
|
||||
* merges default ts options with those found in npmts.json
|
||||
*/
|
||||
var tsOptions = function (keyArg) {
|
||||
return plugins.lodashObject.assign(tsOptionsDefault, config.tsOptions);
|
||||
};
|
||||
for (var keyArg in config.ts) {
|
||||
if (helpers.checkOutputPath(config, keyArg)) {
|
||||
var tsStream = plugins.gulp.src([plugins.path.join(paths.cwd, keyArg), "!**/typings/**"])
|
||||
.pipe(plugins.g.sourcemaps.init()) // This means sourcemaps will be generated
|
||||
.pipe(plugins.g.typescript(tsOptions(keyArg)));
|
||||
var jsStream = tsStream.js
|
||||
.pipe(plugins.g.sourcemaps.write()) // Now the sourcemaps are added to the .js file
|
||||
.pipe(plugins.gulp.dest(config.ts[keyArg]));
|
||||
var declarationStream = tsStream.dts
|
||||
.pipe(plugins.gulp.dest(config.ts[keyArg]));
|
||||
moduleStream.add(tsStream, jsStream, declarationStream);
|
||||
}
|
||||
}
|
||||
moduleStream.on("queueDrain", function () {
|
||||
moduleStream.on("finish", function () {
|
||||
plugins.beautylog.ok("TypeScript has been compiled!");
|
||||
definitionHandler(config)
|
||||
.then(function () {
|
||||
done.resolve(config);
|
||||
});
|
||||
});
|
||||
moduleStream.end();
|
||||
});
|
||||
/*==================== END TS Compilation =====================*/
|
||||
return done.promise;
|
||||
};
|
31
dist/npmts.configfile.js
vendored
Normal file
31
dist/npmts.configfile.js
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
"use strict";
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
var plugins = require("./npmts.plugins");
|
||||
var paths = require("./npmts.paths");
|
||||
exports.run = function () {
|
||||
var done = plugins.Q.defer();
|
||||
var config = {};
|
||||
var configPath = plugins.path.join(paths.cwd, "npmts.json");
|
||||
if (plugins.smartfile.checks.fileExistsSync(configPath)) {
|
||||
plugins.beautylog.info("npmts.json".blue + " config file found!");
|
||||
config = plugins.smartfile.local.toObjectSync(configPath);
|
||||
switch (config.mode) {
|
||||
case "default":
|
||||
case "custom":
|
||||
plugins.beautylog.ok("mode is " + config.mode.yellow);
|
||||
done.resolve(config);
|
||||
break;
|
||||
default:
|
||||
plugins.beautylog.error("mode " + config.mode.yellow + " not recognised!".red);
|
||||
process.exit(1);
|
||||
}
|
||||
;
|
||||
}
|
||||
else {
|
||||
plugins.beautylog.log("no config file found: so mode is " + "default".yellow);
|
||||
config.mode = "default";
|
||||
done.resolve(config);
|
||||
}
|
||||
;
|
||||
return done.promise;
|
||||
};
|
20
dist/npmts.install.js
vendored
Normal file
20
dist/npmts.install.js
vendored
Normal file
@ -0,0 +1,20 @@
|
||||
"use strict";
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
var plugins = require("./npmts.plugins");
|
||||
var paths = require("./npmts.paths");
|
||||
exports.run = function (configArg) {
|
||||
var config = configArg;
|
||||
var done = plugins.Q.defer();
|
||||
/* -------------------------------------------------
|
||||
* ----------- install typings ---------------
|
||||
* ----------------------------------------------- */
|
||||
plugins.beautylog.log("now installing " + "typings".yellow);
|
||||
var absoluteTypingsArray = plugins.smartpath.transform.toAbsolute(config.typings, paths.cwd);
|
||||
plugins.gulp.src(absoluteTypingsArray)
|
||||
.pipe(plugins.g.typings())
|
||||
.pipe(plugins.g.gFunction(function () {
|
||||
plugins.beautylog.ok("typings have been installed!");
|
||||
done.resolve(config);
|
||||
}, "atEnd"));
|
||||
return done.promise;
|
||||
};
|
55
dist/npmts.jsdoc.js
vendored
Normal file
55
dist/npmts.jsdoc.js
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
"use strict";
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
var plugins = require("./npmts.plugins");
|
||||
var paths = require("./npmts.paths");
|
||||
var genJsdoc = function (configArg) {
|
||||
var done = plugins.Q.defer();
|
||||
plugins.beautylog.log("now generating " + "JsDoc documentation".blue);
|
||||
plugins.gulp.src([
|
||||
plugins.path.join(paths.cwd, "README.md"),
|
||||
plugins.path.join(paths.distDir, "**/*.js")
|
||||
])
|
||||
.pipe(plugins.g.jsdoc3({
|
||||
opts: {
|
||||
destination: paths.docsDir
|
||||
}
|
||||
}, function () {
|
||||
plugins.beautylog.ok("JsDoc documentation has been generated!");
|
||||
done.resolve(configArg);
|
||||
}));
|
||||
return done.promise;
|
||||
};
|
||||
exports.publishDocs = function (configArg) {
|
||||
var done = plugins.Q.defer();
|
||||
var gitUrl = plugins.projectinfo.npm(paths.cwd, {
|
||||
gitAccessToken: process.env.GITHUB_TOKEN
|
||||
}).git.httpsUrl;
|
||||
var deployScript = ""
|
||||
+ "cd " + paths.docsDir + " "
|
||||
+ "&& git init " + "> /dev/null 2>&1 "
|
||||
+ "&& git config user.name \"TRAVIS CI\" " + "> /dev/null 2>&1 "
|
||||
+ "&& git config user.email \"travis@shipzone.io\" " + "> /dev/null 2>&1 "
|
||||
+ "&& git add . " + "> /dev/null 2>&1 "
|
||||
+ "&& git commit -m \"Deploy to GitHub Pages\" " + "> /dev/null 2>&1 "
|
||||
+ "&& git push --force --quiet "
|
||||
+ "\"" + gitUrl + "\" "
|
||||
+ "master:gh-pages " + "> /dev/null 2>&1";
|
||||
plugins.beautylog.log("now publishing JsDoc documentation to GitHub");
|
||||
if (!plugins.shelljs.which('git')) {
|
||||
plugins.beautylog.error('Git is not installed!');
|
||||
plugins.shelljs.exit(1);
|
||||
}
|
||||
else if (plugins.shelljs.exec(deployScript).code !== 0) {
|
||||
plugins.beautylog.error('Git failed!');
|
||||
plugins.shelljs.exit(1);
|
||||
}
|
||||
plugins.beautylog.ok("JsDoc documentation has been deployed to GitHub!");
|
||||
done.resolve(configArg);
|
||||
return done.promise;
|
||||
};
|
||||
exports.run = function (configArg) {
|
||||
var done = plugins.Q.defer();
|
||||
genJsdoc(configArg)
|
||||
.then(done.resolve);
|
||||
return done.promise;
|
||||
};
|
50
dist/npmts.options.js
vendored
Normal file
50
dist/npmts.options.js
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
"use strict";
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
var plugins = require("./npmts.plugins");
|
||||
exports.isCi = function () {
|
||||
return plugins.smartci.check.isCi();
|
||||
};
|
||||
exports.isRelease = function () {
|
||||
return plugins.smartci.check.isCi()
|
||||
&& plugins.smartci.check.isTaggedCommit();
|
||||
};
|
||||
exports.doPublish = function () {
|
||||
return exports.isRelease()
|
||||
&& plugins.smartci.get.subJobNumber() == 1;
|
||||
};
|
||||
exports.run = function (configArg) {
|
||||
var done = plugins.Q.defer();
|
||||
var config = configArg;
|
||||
plugins.beautylog.log("now determining build options...");
|
||||
//handle default mode
|
||||
if (config.mode == "default") {
|
||||
config.typings = [
|
||||
"./ts/typings.json"
|
||||
];
|
||||
config.ts = (_a = {},
|
||||
_a["./ts/**/*.ts"] = "./dist/",
|
||||
_a["./test/test.ts"] = "./test/",
|
||||
_a
|
||||
);
|
||||
config.test = ["./index.js"];
|
||||
}
|
||||
//check if config.tsOptions is available
|
||||
config.tsOptions ? void (0) : config.tsOptions = {};
|
||||
// handle state of current build
|
||||
exports.isRelease() ? plugins.beautylog.info("All right: This is a RELEASE build!")
|
||||
: plugins.beautylog.info("NOT A RELEASE build!");
|
||||
exports.isRelease() && exports.doPublish() ? plugins.beautylog.info("All right: This is the first subBuild, so this one publishes COVERAGE + DOCS when tests succeed!")
|
||||
: plugins.beautylog.info("We are not publishing anything!");
|
||||
// handle coveralls
|
||||
config.codecov ? void (0) : config.codecov = true;
|
||||
exports.isCi() ? void (0) : config.codecov = false;
|
||||
config.coverageTreshold ? void (0) : config.coverageTreshold = 70;
|
||||
// handle docs
|
||||
config.docs ? void (0) : config.docs = {};
|
||||
config.docs.publish ? void (0) : config.docs.publish = false;
|
||||
exports.doPublish() ? void (0) : config.docs.publish = false;
|
||||
plugins.beautylog.ok("build options are ready!");
|
||||
done.resolve(config);
|
||||
return done.promise;
|
||||
var _a;
|
||||
};
|
16
dist/npmts.paths.js
vendored
Normal file
16
dist/npmts.paths.js
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
var plugins = require("./npmts.plugins");
|
||||
var paths = {};
|
||||
paths.cwd = plugins.smartcli.get.cwd().path;
|
||||
//Directories
|
||||
paths.tsDir = plugins.path.join(paths.cwd, "ts/");
|
||||
paths.distDir = plugins.path.join(paths.cwd, "dist/");
|
||||
paths.docsDir = plugins.path.join(paths.cwd, "docs/");
|
||||
paths.testDir = plugins.path.join(paths.cwd, "test/");
|
||||
paths.coverageDir = plugins.path.join(paths.cwd, "coverage/");
|
||||
paths.npmtsAssetsDir = plugins.path.join(__dirname, "../assets/");
|
||||
//Files
|
||||
paths.indexTS = plugins.path.join(paths.cwd, "ts/index.ts");
|
||||
paths.testTS = plugins.path.join(paths.cwd, "ts/test.ts");
|
||||
module.exports = paths;
|
30
dist/npmts.plugins.js
vendored
Normal file
30
dist/npmts.plugins.js
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
"use strict";
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
exports.beautylog = require("beautylog");
|
||||
exports.fs = require("fs-extra");
|
||||
exports.gulp = require("gulp");
|
||||
exports.g = {
|
||||
codecov: require("gulp-codecov"),
|
||||
gFunction: require("gulp-function"),
|
||||
istanbul: require("gulp-istanbul"),
|
||||
jsdoc3: require("gulp-jsdoc3"),
|
||||
mocha: require("gulp-mocha"),
|
||||
replace: require("gulp-replace"),
|
||||
sourcemaps: require("gulp-sourcemaps"),
|
||||
typescript: require("gulp-typescript"),
|
||||
typings: require("gulp-typings")
|
||||
};
|
||||
exports.lodashObject = require('lodash/fp/object');
|
||||
exports.merge2 = require("merge2");
|
||||
exports.projectinfo = require("projectinfo");
|
||||
exports.path = require("path");
|
||||
exports.Q = require("q");
|
||||
exports.shelljs = require("shelljs");
|
||||
exports.smartci = require("smartci");
|
||||
exports.smartcli = require("smartcli");
|
||||
exports.smartcov = require("smartcov");
|
||||
exports.smartenv = require("smartenv");
|
||||
exports.smartfile = require("smartfile");
|
||||
exports.smartpath = require("smartpath");
|
||||
exports.smartstring = require("smartstring");
|
||||
exports.sourceMapSupport = require("source-map-support").install(); // this is required to display errors correctly during testing
|
48
dist/npmts.promisechain.js
vendored
Normal file
48
dist/npmts.promisechain.js
vendored
Normal file
@ -0,0 +1,48 @@
|
||||
"use strict";
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
var plugins = require("./npmts.plugins");
|
||||
var NpmtsAssets = require("./npmts.assets");
|
||||
var NpmtsClean = require("./npmts.clean");
|
||||
var NpmtsCompile = require("./npmts.compile");
|
||||
var NpmtsConfigFile = require("./npmts.configfile");
|
||||
var NpmtsInstall = require("./npmts.install");
|
||||
var NpmtsJsdoc = require("./npmts.jsdoc");
|
||||
var NpmtsOptions = require("./npmts.options");
|
||||
var NpmtsPublish = require("./npmts.publish");
|
||||
var NpmtsTests = require("./npmts.tests");
|
||||
exports.run = function () {
|
||||
var promisechain;
|
||||
NpmtsConfigFile.run()
|
||||
.then(NpmtsOptions.run)
|
||||
.then(NpmtsClean.run)
|
||||
.then(NpmtsInstall.run)
|
||||
.then(NpmtsCompile.run)
|
||||
.then(NpmtsAssets.run)
|
||||
.then(NpmtsJsdoc.run)
|
||||
.then(NpmtsTests.run)
|
||||
.then(NpmtsPublish.run)
|
||||
.then(function (configArg) {
|
||||
var shipString = "" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
" # # ( )\n" +
|
||||
" ___#_#___|__\n" +
|
||||
" _ |____________| _\n" +
|
||||
" _=====| | | | | |==== _\n" +
|
||||
" =====| |.---------------------------. | |====\n" +
|
||||
" <--------------------' . . . . . . . . '--------------/\n" +
|
||||
" \\ /\n" +
|
||||
" \\___________________________________________________________/\n" +
|
||||
" wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\n" +
|
||||
" wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\n" +
|
||||
" wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\n";
|
||||
if (process.env.CI) {
|
||||
console.log(shipString);
|
||||
plugins.beautylog.success("READY TO SHIP!");
|
||||
}
|
||||
else {
|
||||
plugins.beautylog.success("Done!");
|
||||
}
|
||||
});
|
||||
return promisechain;
|
||||
};
|
15
dist/npmts.publish.js
vendored
Normal file
15
dist/npmts.publish.js
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
"use strict";
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
var plugins = require("./npmts.plugins");
|
||||
var NpmtsTests = require("./npmts.tests");
|
||||
var NpmtsJsdoc = require("./npmts.jsdoc");
|
||||
exports.run = function (configArg) {
|
||||
var done = plugins.Q.defer();
|
||||
var config = configArg;
|
||||
var promiseArray = [];
|
||||
config.codecov ? promiseArray.push(NpmtsTests.publishCoverage(configArg)) : void (0);
|
||||
config.docs.publish ? promiseArray.push(NpmtsJsdoc.publishDocs(configArg)) : void (0);
|
||||
promiseArray.length === 0 ? plugins.beautylog.info("Did not publish anything!") : void (0);
|
||||
plugins.Q.all(promiseArray).then(done.resolve);
|
||||
return done.promise;
|
||||
};
|
77
dist/npmts.tests.js
vendored
Normal file
77
dist/npmts.tests.js
vendored
Normal file
@ -0,0 +1,77 @@
|
||||
"use strict";
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
var plugins = require("./npmts.plugins");
|
||||
var paths = require("./npmts.paths");
|
||||
exports.publishCoverage = function (configArg) {
|
||||
var done = plugins.Q.defer();
|
||||
plugins.beautylog.log("now uploading coverage data to codecov.io");
|
||||
var stream = plugins.gulp.src([plugins.path.join(paths.cwd, "./coverage/lcov.info")])
|
||||
.pipe(plugins.g.codecov())
|
||||
.pipe(plugins.g.gFunction(function () {
|
||||
plugins.beautylog.ok("Coverage data has been uploaded to codecov.io!");
|
||||
done.resolve(configArg);
|
||||
}, "atEnd"));
|
||||
return done.promise;
|
||||
};
|
||||
/**
|
||||
*
|
||||
* @returns {*}
|
||||
*/
|
||||
var istanbul = function (configArg) {
|
||||
var done = plugins.Q.defer();
|
||||
var stream = plugins.gulp.src([plugins.path.join(paths.cwd, "dist/*.js")])
|
||||
.pipe(plugins.g.istanbul()) // Covering files
|
||||
.pipe(plugins.g.istanbul.hookRequire()) // Force `require` to return covered files
|
||||
.pipe(plugins.g.gFunction(function () {
|
||||
done.resolve(configArg);
|
||||
}, "atEnd"));
|
||||
return done.promise;
|
||||
};
|
||||
/**
|
||||
*
|
||||
* @returns {*}
|
||||
*/
|
||||
var mocha = function (configArg) {
|
||||
var done = plugins.Q.defer();
|
||||
var stream = plugins.gulp.src(["./test/test.js"])
|
||||
.pipe(plugins.g.mocha())
|
||||
.pipe(plugins.g.istanbul.writeReports()) // Creating the reports after tests ran
|
||||
.pipe(plugins.g.gFunction(function () {
|
||||
plugins.beautylog.ok("Tests have passed!");
|
||||
done.resolve(configArg);
|
||||
}, "atEnd"));
|
||||
return done.promise;
|
||||
};
|
||||
var coverage = function (configArg) {
|
||||
var done = plugins.Q.defer();
|
||||
plugins.smartcov.get.percentage(plugins.path.join(paths.coverageDir, "lcov.info"))
|
||||
.then(function (percentageArg) {
|
||||
if (percentageArg >= configArg.coverageTreshold) {
|
||||
plugins.beautylog.ok("your coverage of " + percentageArg.toString().blue + "% ".blue + "exceeds your treshold of " +
|
||||
configArg.coverageTreshold.toString().blue + "%".blue);
|
||||
}
|
||||
else {
|
||||
plugins.beautylog.warn("your coverage of " + percentageArg + "% " + "fails your treshold of " +
|
||||
configArg.coverageTreshold + "%");
|
||||
plugins.beautylog.error("exiting due to coverage failure");
|
||||
process.exit(1);
|
||||
}
|
||||
done.resolve(configArg);
|
||||
});
|
||||
return done.promise;
|
||||
};
|
||||
exports.run = function (configArg) {
|
||||
var done = plugins.Q.defer();
|
||||
var config = configArg;
|
||||
plugins.beautylog.log("now starting tests");
|
||||
console.log("--------------------------------------------------------------\n" +
|
||||
"***************************" +
|
||||
" TESTS: ".blue +
|
||||
"***************************\n" +
|
||||
"--------------------------------------------------------------");
|
||||
istanbul(config)
|
||||
.then(mocha)
|
||||
.then(coverage)
|
||||
.then(done.resolve);
|
||||
return done.promise;
|
||||
};
|
29
index.js
29
index.js
@ -1,29 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/// <reference path="./typings/tsd.d.ts" />
|
||||
var plugins = {
|
||||
beautylog: require("beautylog"),
|
||||
gulp: require("gulp"),
|
||||
gulpTypeScript: require("gulp-typescript"),
|
||||
path: require("path"),
|
||||
smartcli: require("smartcli")
|
||||
};
|
||||
var paths = {};
|
||||
paths.cwd = plugins.smartcli.get.cwd().path;
|
||||
console.log(paths.cwd);
|
||||
paths.indexTS = plugins.path.join(paths.cwd, "ts/index.ts");
|
||||
paths.testTS = plugins.path.join(paths.cwd, "ts/test.ts");
|
||||
plugins.gulp.task("indexTS", function () {
|
||||
plugins.gulp.src(paths.indexTS)
|
||||
.pipe(plugins.gulpTypeScript({
|
||||
out: "index.js"
|
||||
}))
|
||||
.pipe(plugins.gulp.dest(paths.cwd));
|
||||
});
|
||||
plugins.gulp.task("indexTS", function () {
|
||||
plugins.gulp.src(paths.indexTS)
|
||||
.pipe(plugins.gulpTypeScript({
|
||||
out: "test.js"
|
||||
}))
|
||||
.pipe(plugins.gulp.dest(paths.cwd));
|
||||
});
|
45
package.json
45
package.json
@ -1,14 +1,14 @@
|
||||
{
|
||||
"name": "npmts",
|
||||
"version": "0.0.4",
|
||||
"version": "5.1.4",
|
||||
"description": "write npm modules with TypeScript",
|
||||
"main": "index.js",
|
||||
"main": "dist/index.js",
|
||||
"bin": {
|
||||
"npmts": "index.js"
|
||||
"npmts": "dist/cli.js"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "(cd compile && node compile.js)",
|
||||
"testm": "(cd test/ && npm update && npm test)"
|
||||
"test": "(cd compile && node compile.js) && (cd test/assets && node ../../dist/index.js)",
|
||||
"release": "(git add -A && git commit -m 'update' && git push origin master && npm version patch && npm publish)"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -25,10 +25,33 @@
|
||||
},
|
||||
"homepage": "https://github.com/pushrocks/npmts#readme",
|
||||
"dependencies": {
|
||||
"beautylog": "^2.0.2",
|
||||
"gulp": "^3.9.0",
|
||||
"gulp-insert": "^0.5.0",
|
||||
"gulp-typescript": "^2.10.0",
|
||||
"smartcli": "0.0.11"
|
||||
}
|
||||
"beautylog": "4.1.2",
|
||||
"fs-extra": "^0.30.0",
|
||||
"gulp": "3.9.1",
|
||||
"gulp-codecov": "^2.0.1",
|
||||
"gulp-concat": "^2.6.0",
|
||||
"gulp-function": "^1.3.1",
|
||||
"gulp-if": "^2.0.0",
|
||||
"gulp-istanbul": "^0.10.4",
|
||||
"gulp-jsdoc3": "^0.2.1",
|
||||
"gulp-mocha": "^2.2.0",
|
||||
"gulp-replace": "^0.5.4",
|
||||
"gulp-sourcemaps": "^2.0.0-alpha",
|
||||
"gulp-typescript": "2.13.0",
|
||||
"gulp-typings": "1.3.5",
|
||||
"lodash": "^4.11.1",
|
||||
"merge2": "1.0.2",
|
||||
"projectinfo": "1.0.1",
|
||||
"q": "^1.4.1",
|
||||
"shelljs": "^0.7.0",
|
||||
"smartci": "0.0.1",
|
||||
"smartcli": "0.0.11",
|
||||
"smartcov": "0.0.6",
|
||||
"smartenv": "1.2.2",
|
||||
"smartfile": "3.0.5",
|
||||
"smartpath": "3.2.0",
|
||||
"smartstring": "^1.0.2",
|
||||
"source-map-support": "^0.4.0"
|
||||
},
|
||||
"devDependencies": {}
|
||||
}
|
||||
|
3
test/assets/custom.js
Normal file
3
test/assets/custom.js
Normal file
@ -0,0 +1,3 @@
|
||||
var hello = "hello";
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImN1c3RvbS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxJQUFJLEtBQUssR0FBRyxPQUFPLENBQUMiLCJmaWxlIjoiY3VzdG9tLmpzIiwic291cmNlc0NvbnRlbnQiOlsidmFyIGhlbGxvID0gXCJoZWxsb1wiOyJdLCJzb3VyY2VSb290IjoiL3NvdXJjZS8ifQ==
|
2
test/assets/customdir/custom.js
Normal file
2
test/assets/customdir/custom.js
Normal file
@ -0,0 +1,2 @@
|
||||
var hello = "hello";
|
||||
//# sourceMappingURL=custom.js.map
|
1
test/assets/customdir/custom.js.map
Normal file
1
test/assets/customdir/custom.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"custom.js","sourceRoot":"","sources":["custom.ts"],"names":[],"mappings":"AAAA,IAAI,KAAK,GAAG,OAAO,CAAC"}
|
1
test/assets/customdir/custom.ts
Normal file
1
test/assets/customdir/custom.ts
Normal file
@ -0,0 +1 @@
|
||||
var hello = "hello";
|
2
test/assets/customdir/tsfile1.js
Normal file
2
test/assets/customdir/tsfile1.js
Normal file
@ -0,0 +1,2 @@
|
||||
var something = "something";
|
||||
//# sourceMappingURL=tsfile1.js.map
|
1
test/assets/customdir/tsfile1.js.map
Normal file
1
test/assets/customdir/tsfile1.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"tsfile1.js","sourceRoot":"","sources":["tsfile1.ts"],"names":[],"mappings":"AAAA,IAAI,SAAS,GAAG,WAAW,CAAC"}
|
1
test/assets/customdir/tsfile1.ts
Normal file
1
test/assets/customdir/tsfile1.ts
Normal file
@ -0,0 +1 @@
|
||||
var something = "something";
|
7
test/assets/customdir/typings.json
Normal file
7
test/assets/customdir/typings.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"ambientDependencies": {
|
||||
"node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts#78d36dd49b6b55b9fdfe61776a12bf05c8b07777",
|
||||
"colors": "github:DefinitelyTyped/DefinitelyTyped/colors/colors.d.ts#09e37435ffb2c56a6f908081194a74756f24f99d",
|
||||
"vinyl": "github:DefinitelyTyped/DefinitelyTyped/vinyl/vinyl.d.ts#78d36dd49b6b55b9fdfe61776a12bf05c8b07777"
|
||||
}
|
||||
}
|
3
test/assets/dist/index.d.ts
vendored
Normal file
3
test/assets/dist/index.d.ts
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
declare let testplugin: {
|
||||
logSomething: () => void;
|
||||
};
|
9
test/assets/dist/index.js
vendored
Normal file
9
test/assets/dist/index.js
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
var testplugin = {
|
||||
logSomething: function () {
|
||||
console.log("only function executed");
|
||||
}
|
||||
};
|
||||
module.exports = testplugin;
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLDRDQUE0QztBQUM1QyxJQUFJLFVBQVUsR0FBRztJQUNiLFlBQVksRUFBRTtRQUNWLE9BQU8sQ0FBQyxHQUFHLENBQUMsd0JBQXdCLENBQUMsQ0FBQztJQUMxQyxDQUFDO0NBQ0osQ0FBQztBQUNGLE1BQU0sQ0FBQyxPQUFPLEdBQUcsVUFBVSxDQUFDIiwiZmlsZSI6ImluZGV4LmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8vIDxyZWZlcmVuY2UgcGF0aD1cIi4vdHlwaW5ncy9tYWluLmQudHNcIiAvPlxubGV0IHRlc3RwbHVnaW4gPSB7XG4gICAgbG9nU29tZXRoaW5nOiBmdW5jdGlvbigpe1xuICAgICAgICBjb25zb2xlLmxvZyhcIm9ubHkgZnVuY3Rpb24gZXhlY3V0ZWRcIik7XG4gICAgfVxufTtcbm1vZHVsZS5leHBvcnRzID0gdGVzdHBsdWdpbjsiXX0=
|
20
test/assets/npmts.json
Normal file
20
test/assets/npmts.json
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"mode":"default",
|
||||
"ts":{
|
||||
"./customdir/*.ts":"./"
|
||||
},
|
||||
"tsOptions":{
|
||||
"target":"ES5"
|
||||
},
|
||||
"typings":[
|
||||
"./ts/typings.json",
|
||||
"./subts1/typings.json",
|
||||
"./subts2/typings.json",
|
||||
"./customdir/typings.json"
|
||||
],
|
||||
"codecov":true,
|
||||
"docs": {
|
||||
"publish":true
|
||||
},
|
||||
"cli":true
|
||||
}
|
16
test/assets/package.json
Normal file
16
test/assets/package.json
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "testpackage",
|
||||
"version": "2.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/pushrocks/npmts.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "(npmts)"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {}
|
||||
}
|
7
test/assets/subts1/typings.json
Normal file
7
test/assets/subts1/typings.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"ambientDependencies": {
|
||||
"node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts#78d36dd49b6b55b9fdfe61776a12bf05c8b07777",
|
||||
"colors": "github:DefinitelyTyped/DefinitelyTyped/colors/colors.d.ts#09e37435ffb2c56a6f908081194a74756f24f99d",
|
||||
"vinyl": "github:DefinitelyTyped/DefinitelyTyped/vinyl/vinyl.d.ts#78d36dd49b6b55b9fdfe61776a12bf05c8b07777"
|
||||
}
|
||||
}
|
BIN
test/assets/test/.DS_Store
vendored
Normal file
BIN
test/assets/test/.DS_Store
vendored
Normal file
Binary file not shown.
1
test/assets/test/test.d.ts
vendored
Normal file
1
test/assets/test/test.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
||||
declare var testplugin: any;
|
11
test/assets/test/test.js
Normal file
11
test/assets/test/test.js
Normal file
@ -0,0 +1,11 @@
|
||||
/// <reference path="../ts/typings/main.d.ts" />
|
||||
var testplugin = require("../dist/index.js");
|
||||
describe("testplugins", function () {
|
||||
describe(".logSomething", function () {
|
||||
it("should log something", function () {
|
||||
testplugin.logSomething();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsZ0RBQWdEO0FBQ2hELElBQUksVUFBVSxHQUFHLE9BQU8sQ0FBQyxrQkFBa0IsQ0FBQyxDQUFDO0FBQzdDLFFBQVEsQ0FBQyxhQUFhLEVBQUM7SUFDbkIsUUFBUSxDQUFDLGVBQWUsRUFBQztRQUNyQixFQUFFLENBQUMsc0JBQXNCLEVBQUM7WUFDdEIsVUFBVSxDQUFDLFlBQVksRUFBRSxDQUFBO1FBQzdCLENBQUMsQ0FBQyxDQUFDO0lBQ1AsQ0FBQyxDQUFDLENBQUM7QUFDUCxDQUFDLENBQUMsQ0FBQyIsImZpbGUiOiJ0ZXN0LmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8vIDxyZWZlcmVuY2UgcGF0aD1cIi4uL3RzL3R5cGluZ3MvbWFpbi5kLnRzXCIgLz5cbnZhciB0ZXN0cGx1Z2luID0gcmVxdWlyZShcIi4uL2Rpc3QvaW5kZXguanNcIik7XG5kZXNjcmliZShcInRlc3RwbHVnaW5zXCIsZnVuY3Rpb24oKXtcbiAgICBkZXNjcmliZShcIi5sb2dTb21ldGhpbmdcIixmdW5jdGlvbigpe1xuICAgICAgICBpdChcInNob3VsZCBsb2cgc29tZXRoaW5nXCIsZnVuY3Rpb24oKXtcbiAgICAgICAgICAgIHRlc3RwbHVnaW4ubG9nU29tZXRoaW5nKClcbiAgICAgICAgfSk7XG4gICAgfSk7XG59KTsiXX0=
|
1
test/assets/test/test.js.map
Normal file
1
test/assets/test/test.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,IAAI,UAAU,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAC7C,QAAQ,CAAC,aAAa,EAAC;IACnB,QAAQ,CAAC,eAAe,EAAC;QACrB,EAAE,CAAC,sBAAsB,EAAC;YACtB,UAAU,CAAC,YAAY,EAAE,CAAA;QAC7B,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
9
test/assets/test/test.ts
Normal file
9
test/assets/test/test.ts
Normal file
@ -0,0 +1,9 @@
|
||||
/// <reference path="../ts/typings/main.d.ts" />
|
||||
var testplugin = require("../dist/index.js");
|
||||
describe("testplugins",function(){
|
||||
describe(".logSomething",function(){
|
||||
it("should log something",function(){
|
||||
testplugin.logSomething()
|
||||
});
|
||||
});
|
||||
});
|
8
test/assets/test/typings.json
Normal file
8
test/assets/test/typings.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"ambientDependencies": {
|
||||
"node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts#78d36dd49b6b55b9fdfe61776a12bf05c8b07777",
|
||||
|
||||
"colors": "github:DefinitelyTyped/DefinitelyTyped/colors/colors.d.ts#09e37435ffb2c56a6f908081194a74756f24f99d",
|
||||
"vinyl": "github:DefinitelyTyped/DefinitelyTyped/vinyl/vinyl.d.ts#78d36dd49b6b55b9fdfe61776a12bf05c8b07777"
|
||||
}
|
||||
}
|
8
test/assets/ts/index.js
Normal file
8
test/assets/ts/index.js
Normal file
@ -0,0 +1,8 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
var testplugin = {
|
||||
logSomething: function () {
|
||||
console.log("only function executed");
|
||||
}
|
||||
};
|
||||
module.exports = testplugin;
|
||||
//# sourceMappingURL=index.js.map
|
1
test/assets/ts/index.js.map
Normal file
1
test/assets/ts/index.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,IAAI,UAAU,GAAG;IACb,YAAY,EAAE;QACV,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;IAC1C,CAAC;CACJ,CAAC;AACF,MAAM,CAAC,OAAO,GAAG,UAAU,CAAC"}
|
7
test/assets/ts/index.ts
Normal file
7
test/assets/ts/index.ts
Normal file
@ -0,0 +1,7 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
let testplugin = {
|
||||
logSomething: function(){
|
||||
console.log("only function executed");
|
||||
}
|
||||
};
|
||||
module.exports = testplugin;
|
8
test/assets/ts/typings.json
Normal file
8
test/assets/ts/typings.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"ambientDependencies": {
|
||||
"node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts",
|
||||
"mocha": "github:Bartvds/tsd-deftools/typings/DefinitelyTyped/mocha/mocha.d.ts",
|
||||
"colors": "github:DefinitelyTyped/DefinitelyTyped/colors/colors.d.ts",
|
||||
"vinyl": "github:DefinitelyTyped/DefinitelyTyped/vinyl/vinyl.d.ts"
|
||||
}
|
||||
}
|
3
test/assets/tsfile1.js
Normal file
3
test/assets/tsfile1.js
Normal file
@ -0,0 +1,3 @@
|
||||
var something = "something";
|
||||
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRzZmlsZTEudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsSUFBSSxTQUFTLEdBQUcsV0FBVyxDQUFDIiwiZmlsZSI6InRzZmlsZTEuanMiLCJzb3VyY2VzQ29udGVudCI6WyJ2YXIgc29tZXRoaW5nID0gXCJzb21ldGhpbmdcIjsiXSwic291cmNlUm9vdCI6Ii9zb3VyY2UvIn0=
|
21
test/node_modules/npmts/LICENSE
generated
vendored
21
test/node_modules/npmts/LICENSE
generated
vendored
@ -1,21 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Push.Rocks
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
42
test/node_modules/npmts/package.json
generated
vendored
42
test/node_modules/npmts/package.json
generated
vendored
@ -1,42 +0,0 @@
|
||||
{
|
||||
"name": "npmts",
|
||||
"version": "0.0.3",
|
||||
"description": "write npm modules with TypeScript",
|
||||
"main": "index.js",
|
||||
"bin": {
|
||||
"npmts": "index.js"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "(cd compile && node compile.js)",
|
||||
"testm": "(cd test/ && npm update && npm test)"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/pushrocks/npmts.git"
|
||||
},
|
||||
"keywords": [
|
||||
"TypeScript",
|
||||
"Declaration"
|
||||
],
|
||||
"author": {
|
||||
"name": "Lossless Digital UG",
|
||||
"url": "haftungsbeschraenkt"
|
||||
},
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/pushrocks/npmts/issues"
|
||||
},
|
||||
"homepage": "https://github.com/pushrocks/npmts#readme",
|
||||
"dependencies": {
|
||||
"beautylog": "^2.0.2",
|
||||
"gulp": "^3.9.0",
|
||||
"gulp-insert": "^0.5.0",
|
||||
"gulp-typescript": "^2.10.0",
|
||||
"smartcli": "0.0.11"
|
||||
},
|
||||
"gitHead": "a1146e4c79f5e97f51d540c82a2307b3cd5ba9b0",
|
||||
"readme": "ERROR: No README data found!",
|
||||
"_id": "npmts@0.0.3",
|
||||
"_shasum": "f845bce63cb3c5185e995c9e55222fb4e187a7e5",
|
||||
"_from": "npmts@0.0.3"
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
{
|
||||
"name": "test",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "(npmts)"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"npmts": "*"
|
||||
}
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
(function () {
|
||||
console.log("test");
|
||||
}());
|
||||
//# sourceMappingURL=index.js.map
|
@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,CAAC;IACG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;AACvB,CAAC,EAAE,CAAC,CAAC"}
|
@ -1,3 +0,0 @@
|
||||
(function(){
|
||||
console.log("test")
|
||||
}());
|
28
ts/index.js
28
ts/index.js
@ -1,28 +0,0 @@
|
||||
/// <reference path="./typings/tsd.d.ts" />
|
||||
var plugins = {
|
||||
beautylog: require("beautylog"),
|
||||
gulp: require("gulp"),
|
||||
gulpTypeScript: require("gulp-typescript"),
|
||||
path: require("path"),
|
||||
smartcli: require("smartcli")
|
||||
};
|
||||
var paths = {};
|
||||
paths.cwd = plugins.smartcli.get.cwd().path;
|
||||
console.log(paths.cwd);
|
||||
paths.indexTS = plugins.path.join(paths.cwd, "ts/index.ts");
|
||||
paths.testTS = plugins.path.join(paths.cwd, "ts/test.ts");
|
||||
plugins.gulp.task("indexTS", function () {
|
||||
plugins.gulp.src(paths.indexTS)
|
||||
.pipe(plugins.gulpTypeScript({
|
||||
out: "index.js"
|
||||
}))
|
||||
.pipe(plugins.gulp.dest(paths.cwd));
|
||||
});
|
||||
plugins.gulp.task("indexTS", function () {
|
||||
plugins.gulp.src(paths.indexTS)
|
||||
.pipe(plugins.gulpTypeScript({
|
||||
out: "test.js"
|
||||
}))
|
||||
.pipe(plugins.gulp.dest(paths.cwd));
|
||||
});
|
||||
//# sourceMappingURL=index.js.map
|
@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,IAAI,OAAO,GAAG;IACV,SAAS,EAAE,OAAO,CAAC,WAAW,CAAC;IAC/B,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC;IACrB,cAAc,EAAE,OAAO,CAAC,iBAAiB,CAAC;IAC1C,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC;IACrB,QAAQ,EAAE,OAAO,CAAC,UAAU,CAAC;CAChC,CAAC;AAEF,IAAI,KAAK,GAAO,EAAE,CAAC;AACnB,KAAK,CAAC,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC;AAC5C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AACvB,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,EAAC,aAAa,CAAC,CAAC;AAC3D,KAAK,CAAC,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,EAAC,YAAY,CAAC,CAAC;AAEzD,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;IACzB,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC;SAC1B,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC;QACzB,GAAG,EAAE,UAAU;KAClB,CAAC,CAAC;SACF,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAA;AAC3C,CAAC,CAAC,CAAC;AAEH,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;IACzB,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC;SAC1B,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC;QACzB,GAAG,EAAE,SAAS;KACjB,CAAC,CAAC;SACF,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAA;AAC3C,CAAC,CAAC,CAAC"}
|
39
ts/index.ts
39
ts/index.ts
@ -1,30 +1,13 @@
|
||||
/// <reference path="./typings/tsd.d.ts" />
|
||||
var plugins = {
|
||||
beautylog: require("beautylog"),
|
||||
gulp: require("gulp"),
|
||||
gulpTypeScript: require("gulp-typescript"),
|
||||
path: require("path"),
|
||||
smartcli: require("smartcli")
|
||||
};
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
console.log("**** starting NPMTS ****");
|
||||
import plugins = require("./npmts.plugins");
|
||||
import promisechain = require("./npmts.promisechain");
|
||||
plugins.beautylog.figletSync("NPMTS");
|
||||
|
||||
var paths:any = {};
|
||||
paths.cwd = plugins.smartcli.get.cwd().path;
|
||||
console.log(paths.cwd);
|
||||
paths.indexTS = plugins.path.join(paths.cwd,"ts/index.ts");
|
||||
paths.testTS = plugins.path.join(paths.cwd,"ts/test.ts");
|
||||
try {
|
||||
promisechain.run();
|
||||
}
|
||||
catch(err){
|
||||
console.log(err);
|
||||
}
|
||||
|
||||
plugins.gulp.task("indexTS", function(){
|
||||
plugins.gulp.src(paths.indexTS)
|
||||
.pipe(plugins.gulpTypeScript({
|
||||
out: "index.js"
|
||||
}))
|
||||
.pipe(plugins.gulp.dest(paths.cwd))
|
||||
});
|
||||
|
||||
plugins.gulp.task("indexTS", function(){
|
||||
plugins.gulp.src(paths.indexTS)
|
||||
.pipe(plugins.gulpTypeScript({
|
||||
out: "test.js"
|
||||
}))
|
||||
.pipe(plugins.gulp.dest(paths.cwd))
|
||||
});
|
17
ts/npmts.assets.ts
Normal file
17
ts/npmts.assets.ts
Normal file
@ -0,0 +1,17 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
import plugins = require("./npmts.plugins");
|
||||
import paths = require("./npmts.paths");
|
||||
|
||||
export var run = function(configArg){
|
||||
let done = plugins.Q.defer();
|
||||
let config = configArg;
|
||||
plugins.beautylog.log("now looking at required assets");
|
||||
if(config.cli == true){
|
||||
plugins.smartfile.fsaction.copy(plugins.path.join(paths.npmtsAssetsDir,"cli.js"),paths.distDir);
|
||||
plugins.beautylog.ok("CLI asset has been installed!");
|
||||
done.resolve(config);
|
||||
} else {
|
||||
done.resolve(config);
|
||||
}
|
||||
return done.promise;
|
||||
};
|
14
ts/npmts.clean.ts
Normal file
14
ts/npmts.clean.ts
Normal file
@ -0,0 +1,14 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
import plugins = require("./npmts.plugins");
|
||||
import paths = require("./npmts.paths");
|
||||
|
||||
export let run = function(configArg){
|
||||
plugins.beautylog.log("now cleaning up from previous builds...");
|
||||
let done = plugins.Q.defer();
|
||||
plugins.smartfile.fsaction.remove(paths.distDir)
|
||||
.then(function(){
|
||||
plugins.beautylog.ok("Cleaned up!");
|
||||
done.resolve(configArg);
|
||||
});
|
||||
return done.promise;
|
||||
};
|
1
ts/npmts.cli.ts
Normal file
1
ts/npmts.cli.ts
Normal file
@ -0,0 +1 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
15
ts/npmts.compile.helpers.ts
Normal file
15
ts/npmts.compile.helpers.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import plugins = require("./npmts.plugins");
|
||||
import paths = require("./npmts.paths");
|
||||
|
||||
let outputPathIsDir = function (configArg,keyArg) {
|
||||
return plugins.smartpath.check.isDir(plugins.path.join(paths.cwd, configArg.ts[keyArg]));
|
||||
};
|
||||
|
||||
export let checkOutputPath = function(configArg,keyArg){
|
||||
if(!outputPathIsDir(configArg,keyArg)) {
|
||||
plugins.beautylog.warn("Skipping " + keyArg + " because " + configArg.ts[keyArg] + " it is no directory!")
|
||||
return false
|
||||
} else {
|
||||
return true;
|
||||
};
|
||||
}
|
90
ts/npmts.compile.ts
Normal file
90
ts/npmts.compile.ts
Normal file
@ -0,0 +1,90 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
import plugins = require("./npmts.plugins");
|
||||
import paths = require("./npmts.paths");
|
||||
|
||||
import helpers = require("./npmts.compile.helpers");
|
||||
|
||||
/**
|
||||
* handles definition to make them fit for modular use
|
||||
*/
|
||||
let definitionHandler = function(configArg){
|
||||
plugins.beautylog.log("now making declaration files ready");
|
||||
let done = plugins.Q.defer();
|
||||
let configTsLenght = Object.keys(configArg.ts).length;
|
||||
if(configTsLenght == 0) {
|
||||
plugins.beautylog.warn("No declaration files found... Are you sure you don't want them?");
|
||||
done.resolve(configArg); //if there are no definition files, resolve...
|
||||
}
|
||||
let localCounter = 0;
|
||||
for (let key in configArg.ts){
|
||||
let distPath = configArg.ts[key];
|
||||
let stream = plugins.gulp.src(plugins.path.join(distPath,"**/*.d.ts"))
|
||||
.pipe(plugins.g.replace(plugins.smartstring.typescript.regexReferencePath,""))
|
||||
.pipe(plugins.gulp.dest(distPath))
|
||||
.pipe(plugins.g.gFunction(function(){
|
||||
localCounter++
|
||||
if(localCounter == configTsLenght){
|
||||
plugins.beautylog.ok("declaration files ready!!!");
|
||||
done.resolve(configArg)
|
||||
};
|
||||
},"atEnd"));
|
||||
|
||||
}
|
||||
return done.promise;
|
||||
}
|
||||
|
||||
|
||||
export let run = function (configArg) {
|
||||
let done = plugins.Q.defer();
|
||||
let config = configArg;
|
||||
plugins.beautylog.log("now compiling " + "TypeScript".yellow);
|
||||
let moduleStream = plugins.merge2({ end: false });
|
||||
|
||||
/* -------------------------------------------------
|
||||
* ----------- compile TypeScript --------------------------
|
||||
* ----------------------------------------------- */
|
||||
|
||||
let tsOptionsDefault = {
|
||||
declaration: true,
|
||||
target: "ES5",
|
||||
module: "commonjs"
|
||||
};
|
||||
|
||||
/**
|
||||
* merges default ts options with those found in npmts.json
|
||||
*/
|
||||
let tsOptions = function (keyArg:string) {
|
||||
return plugins.lodashObject.assign(tsOptionsDefault, config.tsOptions)
|
||||
};
|
||||
|
||||
for (let keyArg in config.ts) {
|
||||
if (helpers.checkOutputPath(config,keyArg)) {
|
||||
let tsStream = plugins.gulp.src([plugins.path.join(paths.cwd, keyArg), "!**/typings/**"])
|
||||
.pipe(plugins.g.sourcemaps.init()) // This means sourcemaps will be generated
|
||||
.pipe(plugins.g.typescript(tsOptions(keyArg)));
|
||||
|
||||
let jsStream = tsStream.js
|
||||
.pipe(plugins.g.sourcemaps.write()) // Now the sourcemaps are added to the .js file
|
||||
.pipe(plugins.gulp.dest(config.ts[keyArg]));
|
||||
let declarationStream = tsStream.dts
|
||||
.pipe(plugins.gulp.dest(config.ts[keyArg]));
|
||||
moduleStream.add(tsStream,jsStream,declarationStream);
|
||||
}
|
||||
}
|
||||
|
||||
moduleStream.on("queueDrain", function () {
|
||||
moduleStream.on("finish", function () {
|
||||
plugins.beautylog.ok("TypeScript has been compiled!");
|
||||
definitionHandler(config)
|
||||
.then(function(){
|
||||
done.resolve(config);
|
||||
});
|
||||
});
|
||||
moduleStream.end();
|
||||
});
|
||||
/*==================== END TS Compilation =====================*/
|
||||
|
||||
|
||||
|
||||
return done.promise;
|
||||
};
|
27
ts/npmts.configfile.ts
Normal file
27
ts/npmts.configfile.ts
Normal file
@ -0,0 +1,27 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
import plugins = require("./npmts.plugins");
|
||||
import paths = require("./npmts.paths");
|
||||
export var run = function(){
|
||||
var done = plugins.Q.defer();
|
||||
var config:any = {};
|
||||
var configPath = plugins.path.join(paths.cwd,"npmts.json");
|
||||
if(plugins.smartfile.checks.fileExistsSync(configPath)){
|
||||
plugins.beautylog.info("npmts.json".blue + " config file found!");
|
||||
config = plugins.smartfile.local.toObjectSync(configPath);
|
||||
switch (config.mode){
|
||||
case "default":
|
||||
case "custom":
|
||||
plugins.beautylog.ok("mode is " + config.mode.yellow);
|
||||
done.resolve(config);
|
||||
break;
|
||||
default:
|
||||
plugins.beautylog.error("mode " + config.mode.yellow + " not recognised!".red);
|
||||
process.exit(1);
|
||||
};
|
||||
} else {
|
||||
plugins.beautylog.log("no config file found: so mode is " + "default".yellow);
|
||||
config.mode = "default";
|
||||
done.resolve(config);
|
||||
};
|
||||
return done.promise;
|
||||
};
|
19
ts/npmts.install.ts
Normal file
19
ts/npmts.install.ts
Normal file
@ -0,0 +1,19 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
import plugins = require("./npmts.plugins");
|
||||
import paths = require("./npmts.paths");
|
||||
export var run = function(configArg){
|
||||
var config = configArg;
|
||||
var done = plugins.Q.defer();
|
||||
/* -------------------------------------------------
|
||||
* ----------- install typings ---------------
|
||||
* ----------------------------------------------- */
|
||||
plugins.beautylog.log("now installing " + "typings".yellow);
|
||||
var absoluteTypingsArray = plugins.smartpath.transform.toAbsolute(config.typings,paths.cwd);
|
||||
plugins.gulp.src(absoluteTypingsArray)
|
||||
.pipe(plugins.g.typings())
|
||||
.pipe(plugins.g.gFunction(function(){
|
||||
plugins.beautylog.ok("typings have been installed!");
|
||||
done.resolve(config);
|
||||
},"atEnd"));
|
||||
return done.promise;
|
||||
};
|
64
ts/npmts.jsdoc.ts
Normal file
64
ts/npmts.jsdoc.ts
Normal file
@ -0,0 +1,64 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
import plugins = require("./npmts.plugins");
|
||||
import paths = require("./npmts.paths");
|
||||
|
||||
let genJsdoc = function(configArg){
|
||||
let done = plugins.Q.defer();
|
||||
plugins.beautylog.log("now generating " + "JsDoc documentation".blue);
|
||||
plugins.gulp.src([
|
||||
plugins.path.join(paths.cwd,"README.md"),
|
||||
plugins.path.join(paths.distDir,"**/*.js")
|
||||
])
|
||||
.pipe(plugins.g.jsdoc3({
|
||||
opts: {
|
||||
destination: paths.docsDir
|
||||
}
|
||||
}, function(){
|
||||
plugins.beautylog.ok("JsDoc documentation has been generated!");
|
||||
done.resolve(configArg)
|
||||
}));
|
||||
return done.promise;
|
||||
};
|
||||
|
||||
export let publishDocs = function(configArg){
|
||||
let done = plugins.Q.defer();
|
||||
let gitUrl = plugins.projectinfo.npm(
|
||||
paths.cwd,
|
||||
{
|
||||
gitAccessToken:process.env.GITHUB_TOKEN
|
||||
}
|
||||
).git.httpsUrl;
|
||||
|
||||
let deployScript = ""
|
||||
+ "cd " + paths.docsDir + " "
|
||||
+ "&& git init " + "> /dev/null 2>&1 "
|
||||
+ "&& git config user.name \"TRAVIS CI\" " + "> /dev/null 2>&1 "
|
||||
+ "&& git config user.email \"travis@shipzone.io\" " + "> /dev/null 2>&1 "
|
||||
+ "&& git add . " + "> /dev/null 2>&1 "
|
||||
+ "&& git commit -m \"Deploy to GitHub Pages\" " + "> /dev/null 2>&1 "
|
||||
+ "&& git push --force --quiet "
|
||||
+ "\"" + gitUrl + "\" "
|
||||
+ "master:gh-pages " + "> /dev/null 2>&1";
|
||||
|
||||
|
||||
plugins.beautylog.log("now publishing JsDoc documentation to GitHub");
|
||||
if (!plugins.shelljs.which('git')) {
|
||||
plugins.beautylog.error('Git is not installed!');
|
||||
plugins.shelljs.exit(1);
|
||||
} else if (plugins.shelljs.exec(deployScript).code !== 0) {
|
||||
plugins.beautylog.error('Git failed!');
|
||||
plugins.shelljs.exit(1);
|
||||
}
|
||||
plugins.beautylog.ok("JsDoc documentation has been deployed to GitHub!");
|
||||
done.resolve(configArg);
|
||||
|
||||
return done.promise;
|
||||
};
|
||||
|
||||
|
||||
export let run = function(configArg){
|
||||
let done = plugins.Q.defer();
|
||||
genJsdoc(configArg)
|
||||
.then(done.resolve);
|
||||
return done.promise;
|
||||
};
|
60
ts/npmts.options.ts
Normal file
60
ts/npmts.options.ts
Normal file
@ -0,0 +1,60 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
import plugins = require("./npmts.plugins");
|
||||
|
||||
export let isCi = function(){
|
||||
return plugins.smartci.check.isCi();
|
||||
};
|
||||
|
||||
export let isRelease = function():boolean {
|
||||
return plugins.smartci.check.isCi()
|
||||
&& plugins.smartci.check.isTaggedCommit();
|
||||
};
|
||||
|
||||
export let doPublish = function():boolean {
|
||||
return isRelease()
|
||||
&& plugins.smartci.get.subJobNumber() == 1;
|
||||
};
|
||||
|
||||
export var run = function(configArg){
|
||||
var done = plugins.Q.defer();
|
||||
var config = configArg;
|
||||
|
||||
plugins.beautylog.log("now determining build options...");
|
||||
|
||||
//handle default mode
|
||||
if (config.mode == "default"){
|
||||
config.typings = [
|
||||
"./ts/typings.json"
|
||||
];
|
||||
config.ts = {
|
||||
["./ts/**/*.ts"]: "./dist/",
|
||||
["./test/test.ts"]: "./test/"
|
||||
};
|
||||
config.test = ["./index.js"];
|
||||
}
|
||||
|
||||
//check if config.tsOptions is available
|
||||
config.tsOptions ? void(0) : config.tsOptions = {};
|
||||
|
||||
// handle state of current build
|
||||
|
||||
isRelease() ? plugins.beautylog.info("All right: This is a RELEASE build!")
|
||||
: plugins.beautylog.info("NOT A RELEASE build!");
|
||||
isRelease() && doPublish() ? plugins.beautylog.info("All right: This is the first subBuild, so this one publishes COVERAGE + DOCS when tests succeed!")
|
||||
: plugins.beautylog.info("We are not publishing anything!");
|
||||
|
||||
// handle coveralls
|
||||
config.codecov ? void(0) : config.codecov = true;
|
||||
isCi() ? void(0) : config.codecov = false;
|
||||
|
||||
config.coverageTreshold ? void(0) : config.coverageTreshold = 70;
|
||||
|
||||
// handle docs
|
||||
config.docs ? void(0) : config.docs = {};
|
||||
config.docs.publish ? void(0) : config.docs.publish = false;
|
||||
doPublish() ? void(0) : config.docs.publish = false;
|
||||
|
||||
plugins.beautylog.ok("build options are ready!");
|
||||
done.resolve(config);
|
||||
return done.promise;
|
||||
};
|
19
ts/npmts.paths.ts
Normal file
19
ts/npmts.paths.ts
Normal file
@ -0,0 +1,19 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
import plugins = require("./npmts.plugins");
|
||||
var paths:any = {};
|
||||
paths.cwd = plugins.smartcli.get.cwd().path;
|
||||
|
||||
//Directories
|
||||
paths.tsDir = plugins.path.join(paths.cwd,"ts/");
|
||||
paths.distDir = plugins.path.join(paths.cwd,"dist/");
|
||||
paths.docsDir = plugins.path.join(paths.cwd,"docs/");
|
||||
paths.testDir = plugins.path.join(paths.cwd,"test/");
|
||||
paths.coverageDir = plugins.path.join(paths.cwd,"coverage/");
|
||||
|
||||
paths.npmtsAssetsDir = plugins.path.join(__dirname,"../assets/");
|
||||
|
||||
//Files
|
||||
paths.indexTS = plugins.path.join(paths.cwd,"ts/index.ts");
|
||||
paths.testTS = plugins.path.join(paths.cwd,"ts/test.ts");
|
||||
|
||||
export = paths;
|
30
ts/npmts.plugins.ts
Normal file
30
ts/npmts.plugins.ts
Normal file
@ -0,0 +1,30 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
export let beautylog = require("beautylog");
|
||||
export let fs = require("fs-extra");
|
||||
export let gulp = require("gulp");
|
||||
export let g = {
|
||||
codecov: require("gulp-codecov"),
|
||||
gFunction: require("gulp-function"),
|
||||
istanbul: require("gulp-istanbul"),
|
||||
jsdoc3: require("gulp-jsdoc3"),
|
||||
mocha: require("gulp-mocha"),
|
||||
replace: require("gulp-replace"),
|
||||
sourcemaps: require("gulp-sourcemaps"),
|
||||
typescript: require("gulp-typescript"),
|
||||
typings: require("gulp-typings")
|
||||
|
||||
};
|
||||
export let lodashObject = require('lodash/fp/object');
|
||||
export let merge2 = require("merge2");
|
||||
export let projectinfo = require("projectinfo");
|
||||
export let path = require("path");
|
||||
export let Q = require("q");
|
||||
export let shelljs = require("shelljs");
|
||||
export let smartci = require("smartci");
|
||||
export let smartcli = require("smartcli");
|
||||
export let smartcov = require("smartcov");
|
||||
export let smartenv = require("smartenv");
|
||||
export let smartfile = require("smartfile");
|
||||
export let smartpath = require("smartpath");
|
||||
export let smartstring = require("smartstring");
|
||||
export let sourceMapSupport = require("source-map-support").install(); // this is required to display errors correctly during testing
|
49
ts/npmts.promisechain.ts
Normal file
49
ts/npmts.promisechain.ts
Normal file
@ -0,0 +1,49 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
import plugins = require("./npmts.plugins");
|
||||
|
||||
import NpmtsAssets = require("./npmts.assets");
|
||||
import NpmtsClean = require("./npmts.clean");
|
||||
import NpmtsCompile = require("./npmts.compile");
|
||||
import NpmtsConfigFile = require("./npmts.configfile");
|
||||
import NpmtsInstall = require("./npmts.install");
|
||||
import NpmtsJsdoc = require("./npmts.jsdoc");
|
||||
import NpmtsOptions = require("./npmts.options");
|
||||
import NpmtsPublish = require("./npmts.publish");
|
||||
import NpmtsTests = require("./npmts.tests");
|
||||
|
||||
export var run = function(){
|
||||
var promisechain;
|
||||
NpmtsConfigFile.run()
|
||||
.then(NpmtsOptions.run)
|
||||
.then(NpmtsClean.run)
|
||||
.then(NpmtsInstall.run)
|
||||
.then(NpmtsCompile.run)
|
||||
.then(NpmtsAssets.run)
|
||||
.then(NpmtsJsdoc.run)
|
||||
.then(NpmtsTests.run)
|
||||
.then(NpmtsPublish.run)
|
||||
.then(function(configArg){
|
||||
let shipString = "" +
|
||||
"\n" +
|
||||
"\n" +
|
||||
" # # ( )\n" +
|
||||
" ___#_#___|__\n" +
|
||||
" _ |____________| _\n" +
|
||||
" _=====| | | | | |==== _\n" +
|
||||
" =====| |.---------------------------. | |====\n" +
|
||||
" <--------------------' . . . . . . . . '--------------/\n" +
|
||||
" \\ /\n" +
|
||||
" \\___________________________________________________________/\n" +
|
||||
" wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\n" +
|
||||
" wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\n" +
|
||||
" wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww\n"
|
||||
if (process.env.CI){
|
||||
console.log(shipString);
|
||||
plugins.beautylog.success("READY TO SHIP!");
|
||||
} else {
|
||||
plugins.beautylog.success("Done!")
|
||||
}
|
||||
|
||||
});
|
||||
return promisechain;
|
||||
};
|
18
ts/npmts.publish.ts
Normal file
18
ts/npmts.publish.ts
Normal file
@ -0,0 +1,18 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
import plugins = require("./npmts.plugins");
|
||||
import paths = require("./npmts.paths");
|
||||
import NpmtsTests = require("./npmts.tests");
|
||||
import NpmtsJsdoc = require("./npmts.jsdoc");
|
||||
|
||||
|
||||
export let run = function(configArg){
|
||||
let done = plugins.Q.defer();
|
||||
let config = configArg;
|
||||
let promiseArray = [];
|
||||
config.codecov ? promiseArray.push(NpmtsTests.publishCoverage(configArg)) : void(0);
|
||||
config.docs.publish ? promiseArray.push(NpmtsJsdoc.publishDocs(configArg)) : void(0);
|
||||
promiseArray.length === 0 ? plugins.beautylog.info("Did not publish anything!") : void(0);
|
||||
|
||||
plugins.Q.all(promiseArray).then(done.resolve);
|
||||
return done.promise;
|
||||
};
|
88
ts/npmts.tests.ts
Normal file
88
ts/npmts.tests.ts
Normal file
@ -0,0 +1,88 @@
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
import plugins = require("./npmts.plugins");
|
||||
import paths = require("./npmts.paths");
|
||||
|
||||
export let publishCoverage = function(configArg){
|
||||
let done = plugins.Q.defer();
|
||||
plugins.beautylog.log("now uploading coverage data to codecov.io");
|
||||
var stream = plugins.gulp.src([plugins.path.join(paths.cwd,"./coverage/lcov.info")])
|
||||
.pipe(plugins.g.codecov())
|
||||
.pipe(plugins.g.gFunction(function(){
|
||||
plugins.beautylog.ok("Coverage data has been uploaded to codecov.io!");
|
||||
done.resolve(configArg);
|
||||
},"atEnd"));
|
||||
return done.promise;
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @returns {*}
|
||||
*/
|
||||
let istanbul = function (configArg) {
|
||||
let done = plugins.Q.defer();
|
||||
var stream = plugins.gulp.src([plugins.path.join(paths.cwd,"dist/*.js")])
|
||||
.pipe(plugins.g.istanbul()) // Covering files
|
||||
.pipe(plugins.g.istanbul.hookRequire()) // Force `require` to return covered files
|
||||
.pipe(plugins.g.gFunction(function(){
|
||||
done.resolve(configArg);
|
||||
},"atEnd"));
|
||||
return done.promise;
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @returns {*}
|
||||
*/
|
||||
let mocha = function (configArg) {
|
||||
let done = plugins.Q.defer();
|
||||
let stream = plugins.gulp.src(["./test/test.js"])
|
||||
.pipe(plugins.g.mocha())
|
||||
.pipe(plugins.g.istanbul.writeReports()) // Creating the reports after tests ran
|
||||
.pipe(plugins.g.gFunction(function(){
|
||||
plugins.beautylog.ok("Tests have passed!");
|
||||
done.resolve(configArg);
|
||||
},"atEnd"));
|
||||
return done.promise;
|
||||
};
|
||||
|
||||
let coverage = function(configArg){
|
||||
let done = plugins.Q.defer();
|
||||
plugins.smartcov.get.percentage(plugins.path.join(paths.coverageDir,"lcov.info"))
|
||||
.then(function(percentageArg){
|
||||
if (percentageArg >= configArg.coverageTreshold){
|
||||
plugins.beautylog.ok(
|
||||
"your coverage of " + percentageArg.toString().blue + "% ".blue + "exceeds your treshold of " +
|
||||
configArg.coverageTreshold.toString().blue + "%".blue
|
||||
);
|
||||
} else {
|
||||
plugins.beautylog.warn(
|
||||
"your coverage of " + percentageArg + "% " + "fails your treshold of " +
|
||||
configArg.coverageTreshold + "%"
|
||||
);
|
||||
plugins.beautylog.error("exiting due to coverage failure");
|
||||
process.exit(1);
|
||||
}
|
||||
done.resolve(configArg);
|
||||
});
|
||||
return done.promise;
|
||||
};
|
||||
|
||||
export let run = function(configArg) {
|
||||
let done = plugins.Q.defer();
|
||||
let config = configArg;
|
||||
|
||||
plugins.beautylog.log("now starting tests");
|
||||
console.log(
|
||||
"--------------------------------------------------------------\n" +
|
||||
"***************************" +
|
||||
" TESTS: ".blue +
|
||||
"***************************\n" +
|
||||
"--------------------------------------------------------------"
|
||||
);
|
||||
|
||||
istanbul(config)
|
||||
.then(mocha)
|
||||
.then(coverage)
|
||||
.then(done.resolve);
|
||||
return done.promise;
|
||||
};
|
18
ts/tsd.json
18
ts/tsd.json
@ -1,18 +0,0 @@
|
||||
{
|
||||
"version": "v4",
|
||||
"repo": "borisyankov/DefinitelyTyped",
|
||||
"ref": "master",
|
||||
"path": "typings",
|
||||
"bundle": "typings/tsd.d.ts",
|
||||
"installed": {
|
||||
"node/node.d.ts": {
|
||||
"commit": "78d36dd49b6b55b9fdfe61776a12bf05c8b07777"
|
||||
},
|
||||
"colors/colors.d.ts": {
|
||||
"commit": "09e37435ffb2c56a6f908081194a74756f24f99d"
|
||||
},
|
||||
"vinyl/vinyl.d.ts": {
|
||||
"commit": "78d36dd49b6b55b9fdfe61776a12bf05c8b07777"
|
||||
}
|
||||
}
|
||||
}
|
8
ts/typings.json
Normal file
8
ts/typings.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"ambientDependencies": {
|
||||
"colors": "github:DefinitelyTyped/DefinitelyTyped/colors/colors.d.ts#09e37435ffb2c56a6f908081194a74756f24f99d",
|
||||
"istanbul": "registry:dt/istanbul#0.4.0+20160316155526",
|
||||
"node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts#78d36dd49b6b55b9fdfe61776a12bf05c8b07777",
|
||||
"vinyl": "github:DefinitelyTyped/DefinitelyTyped/vinyl/vinyl.d.ts#78d36dd49b6b55b9fdfe61776a12bf05c8b07777"
|
||||
}
|
||||
}
|
123
ts/typings/colors/colors.d.ts
vendored
123
ts/typings/colors/colors.d.ts
vendored
@ -1,123 +0,0 @@
|
||||
// Type definitions for Colors.js 0.6.0-1
|
||||
// Project: https://github.com/Marak/colors.js
|
||||
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "colors" {
|
||||
interface Color {
|
||||
(text: string): string;
|
||||
|
||||
black: Color;
|
||||
red: Color;
|
||||
green: Color;
|
||||
yellow: Color;
|
||||
blue: Color;
|
||||
magenta: Color;
|
||||
cyan: Color;
|
||||
white: Color;
|
||||
gray: Color;
|
||||
grey: Color;
|
||||
|
||||
bgBlack: Color;
|
||||
bgRed: Color;
|
||||
bgGreen: Color;
|
||||
bgYellow: Color;
|
||||
bgBlue: Color;
|
||||
bgMagenta: Color;
|
||||
bgCyan: Color;
|
||||
bgWhite: Color;
|
||||
|
||||
reset: Color;
|
||||
bold: Color;
|
||||
dim: Color;
|
||||
italic: Color;
|
||||
underline: Color;
|
||||
inverse: Color;
|
||||
hidden: Color;
|
||||
strikethrough: Color;
|
||||
|
||||
rainbow: Color;
|
||||
zebra: Color;
|
||||
america: Color;
|
||||
trap: Color;
|
||||
random: Color;
|
||||
}
|
||||
|
||||
module e {
|
||||
export function setTheme(theme:any): void;
|
||||
|
||||
export var black: Color;
|
||||
export var red: Color;
|
||||
export var green: Color;
|
||||
export var yellow: Color;
|
||||
export var blue: Color;
|
||||
export var magenta: Color;
|
||||
export var cyan: Color;
|
||||
export var white: Color;
|
||||
export var gray: Color;
|
||||
export var grey: Color;
|
||||
|
||||
export var bgBlack: Color;
|
||||
export var bgRed: Color;
|
||||
export var bgGreen: Color;
|
||||
export var bgYellow: Color;
|
||||
export var bgBlue: Color;
|
||||
export var bgMagenta: Color;
|
||||
export var bgCyan: Color;
|
||||
export var bgWhite: Color;
|
||||
|
||||
export var reset: Color;
|
||||
export var bold: Color;
|
||||
export var dim: Color;
|
||||
export var italic: Color;
|
||||
export var underline: Color;
|
||||
export var inverse: Color;
|
||||
export var hidden: Color;
|
||||
export var strikethrough: Color;
|
||||
|
||||
export var rainbow: Color;
|
||||
export var zebra: Color;
|
||||
export var america: Color;
|
||||
export var trap: Color;
|
||||
export var random: Color;
|
||||
}
|
||||
|
||||
export = e;
|
||||
}
|
||||
|
||||
interface String {
|
||||
black: string;
|
||||
red: string;
|
||||
green: string;
|
||||
yellow: string;
|
||||
blue: string;
|
||||
magenta: string;
|
||||
cyan: string;
|
||||
white: string;
|
||||
gray: string;
|
||||
grey: string;
|
||||
|
||||
bgBlack: string;
|
||||
bgRed: string;
|
||||
bgGreen: string;
|
||||
bgYellow: string;
|
||||
bgBlue: string;
|
||||
bgMagenta: string;
|
||||
bgCyan: string;
|
||||
bgWhite: string;
|
||||
|
||||
reset: string;
|
||||
bold: string;
|
||||
dim: string;
|
||||
italic: string;
|
||||
underline: string;
|
||||
inverse: string;
|
||||
hidden: string;
|
||||
strikethrough: string;
|
||||
|
||||
rainbow: string;
|
||||
zebra: string;
|
||||
america: string;
|
||||
trap: string;
|
||||
random: string;
|
||||
}
|
2090
ts/typings/node/node.d.ts
vendored
2090
ts/typings/node/node.d.ts
vendored
File diff suppressed because it is too large
Load Diff
3
ts/typings/tsd.d.ts
vendored
3
ts/typings/tsd.d.ts
vendored
@ -1,3 +0,0 @@
|
||||
/// <reference path="node/node.d.ts" />
|
||||
/// <reference path="colors/colors.d.ts" />
|
||||
/// <reference path="vinyl/vinyl.d.ts" />
|
109
ts/typings/vinyl/vinyl.d.ts
vendored
109
ts/typings/vinyl/vinyl.d.ts
vendored
@ -1,109 +0,0 @@
|
||||
// Type definitions for vinyl 0.4.3
|
||||
// Project: https://github.com/wearefractal/vinyl
|
||||
// Definitions by: vvakame <https://github.com/vvakame/>, jedmao <https://github.com/jedmao>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module 'vinyl' {
|
||||
|
||||
import fs = require('fs');
|
||||
|
||||
/**
|
||||
* A virtual file format.
|
||||
*/
|
||||
class File {
|
||||
constructor(options?: {
|
||||
/**
|
||||
* Default: process.cwd()
|
||||
*/
|
||||
cwd?: string;
|
||||
/**
|
||||
* Used for relative pathing. Typically where a glob starts.
|
||||
*/
|
||||
base?: string;
|
||||
/**
|
||||
* Full path to the file.
|
||||
*/
|
||||
path?: string;
|
||||
/**
|
||||
* Path history. Has no effect if options.path is passed.
|
||||
*/
|
||||
history?: string[];
|
||||
/**
|
||||
* The result of an fs.stat call. See fs.Stats for more information.
|
||||
*/
|
||||
stat?: fs.Stats;
|
||||
/**
|
||||
* File contents.
|
||||
* Type: Buffer, Stream, or null
|
||||
*/
|
||||
contents?: Buffer | NodeJS.ReadWriteStream;
|
||||
});
|
||||
|
||||
/**
|
||||
* Default: process.cwd()
|
||||
*/
|
||||
public cwd: string;
|
||||
/**
|
||||
* Used for relative pathing. Typically where a glob starts.
|
||||
*/
|
||||
public base: string;
|
||||
/**
|
||||
* Full path to the file.
|
||||
*/
|
||||
public path: string;
|
||||
public stat: fs.Stats;
|
||||
/**
|
||||
* Type: Buffer|Stream|null (Default: null)
|
||||
*/
|
||||
public contents: Buffer | NodeJS.ReadableStream;
|
||||
/**
|
||||
* Returns path.relative for the file base and file path.
|
||||
* Example:
|
||||
* var file = new File({
|
||||
* cwd: "/",
|
||||
* base: "/test/",
|
||||
* path: "/test/file.js"
|
||||
* });
|
||||
* console.log(file.relative); // file.js
|
||||
*/
|
||||
public relative: string;
|
||||
|
||||
public isBuffer(): boolean;
|
||||
|
||||
public isStream(): boolean;
|
||||
|
||||
public isNull(): boolean;
|
||||
|
||||
public isDirectory(): boolean;
|
||||
|
||||
/**
|
||||
* Returns a new File object with all attributes cloned. Custom attributes are deep-cloned.
|
||||
*/
|
||||
public clone(opts?: { contents?: boolean }): File;
|
||||
|
||||
/**
|
||||
* If file.contents is a Buffer, it will write it to the stream.
|
||||
* If file.contents is a Stream, it will pipe it to the stream.
|
||||
* If file.contents is null, it will do nothing.
|
||||
*/
|
||||
public pipe<T extends NodeJS.ReadWriteStream>(
|
||||
stream: T,
|
||||
opts?: {
|
||||
/**
|
||||
* If false, the destination stream will not be ended (same as node core).
|
||||
*/
|
||||
end?: boolean;
|
||||
}
|
||||
): T;
|
||||
|
||||
/**
|
||||
* Returns a pretty String interpretation of the File. Useful for console.log.
|
||||
*/
|
||||
public inspect(): string;
|
||||
}
|
||||
|
||||
export = File;
|
||||
|
||||
}
|
Reference in New Issue
Block a user