Compare commits
39 Commits
Author | SHA1 | Date | |
---|---|---|---|
923d78caab | |||
6587b74a23 | |||
aa0a35f258 | |||
09b8809ede | |||
e25566490b | |||
3ed7473066 | |||
1202a68b01 | |||
c67d43e16d | |||
df74769533 | |||
5aef714497 | |||
24701afcb2 | |||
cbfbd4ee67 | |||
6df449394d | |||
27b6119bbb | |||
b22abef889 | |||
4d8a7a4202 | |||
72bc08e973 | |||
430f636ae4 | |||
bbc8f13ecf | |||
a01f07f62c | |||
36316e63b2 | |||
5c5e88c226 | |||
af968f65df | |||
f0cc2f4cd6 | |||
f167226830 | |||
3e49b365b6 | |||
c833374fdd | |||
778f057d87 | |||
8f57bf4dd5 | |||
5a9f07002f | |||
ca5ff20107 | |||
a406ff648a | |||
dab1f8514b | |||
b80c1f9090 | |||
fcd2616a3c | |||
1723193d27 | |||
88cd04d0e2 | |||
c4faa56d0d | |||
20ad0d0b38 |
11
.gitignore
vendored
11
.gitignore
vendored
@ -1,13 +1,4 @@
|
|||||||
.idea/
|
|
||||||
.c9/
|
|
||||||
node_modules/
|
node_modules/
|
||||||
test/assets/**/node_modules/
|
test/
|
||||||
test/assets/**/docs/
|
|
||||||
test/assets/**/typings/
|
|
||||||
test/assets/**/coverage/
|
|
||||||
ts/*.js
|
|
||||||
ts/*.js.map
|
|
||||||
ts/typings/
|
|
||||||
docs/
|
docs/
|
||||||
|
|
||||||
.DS_Store
|
.DS_Store
|
@ -45,17 +45,3 @@ trigger:
|
|||||||
- tags
|
- tags
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
|
|
||||||
pages:
|
|
||||||
stage: page
|
|
||||||
script:
|
|
||||||
- npmci test lts
|
|
||||||
- mkdir .public
|
|
||||||
- cp -r test/assets/docs/ .public
|
|
||||||
- cp -r test/assets/coverage/ .public
|
|
||||||
- mv .public public
|
|
||||||
artifacts:
|
|
||||||
paths:
|
|
||||||
- public
|
|
||||||
only:
|
|
||||||
- tags
|
|
44
README.md
44
README.md
@ -3,7 +3,6 @@ Write npm modules with TypeScript without hassle.
|
|||||||
|
|
||||||
## Status
|
## Status
|
||||||
[](https://gitlab.com/pushrocks/npmts/commits/master)
|
[](https://gitlab.com/pushrocks/npmts/commits/master)
|
||||||
[](https://ci.appveyor.com/project/philkunz/npmts/branch/master)
|
|
||||||
[](https://david-dm.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/master/dependencies/npm)
|
||||||
[](https://www.bithound.io/github/pushrocks/npmts)
|
[](https://www.bithound.io/github/pushrocks/npmts)
|
||||||
@ -14,10 +13,13 @@ NPMTS is your friend when it comes to write, test, publish and document NPM modu
|
|||||||
By default NPMTS will **bundle declaration files**. As a result npm module **code completion in editors like Visual Studio Code** works.
|
By default NPMTS will **bundle declaration files**. As a result npm module **code completion in editors like Visual Studio Code** works.
|
||||||
|
|
||||||
There is a docker image available that includes npmts to make CI a breeze:
|
There is a docker image available that includes npmts to make CI a breeze:
|
||||||
[hosttoday/ht-docker-npmg on Dockerhub](https://hub.docker.com/r/hosttoday/ht-docker-npmg/)
|
[hosttoday/ht-docker-node:npmts on Dockerhub](https://hub.docker.com/r/hosttoday/ht-docker-node/)
|
||||||
|
|
||||||
### Install
|
### Install
|
||||||
First install npmts globally, then install the npmts checker:
|
First install npmts globally, then install the npmts-g locally.
|
||||||
|
|
||||||
|
> **npmts-g* checks if the global version of npmts suffices the modules requirements.
|
||||||
|
If not it installs npmts locally in the right version during npm install.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
npm install npmts -g # installs npmts globally
|
npm install npmts -g # installs npmts globally
|
||||||
@ -28,7 +30,7 @@ Then add it to your package.json's script section to trigger a build:
|
|||||||
|
|
||||||
```json
|
```json
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "npmts"
|
"test": "(npmts)"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -37,9 +39,8 @@ Then add it to your package.json's script section to trigger a build:
|
|||||||
1. Check config in ./npmts.json
|
1. Check config in ./npmts.json
|
||||||
1. Clean up from any previous builds (old js files)
|
1. Clean up from any previous builds (old js files)
|
||||||
1. Install typings
|
1. Install typings
|
||||||
1. Transpile TypeScript with inline sourcemaps
|
1. Transpile TypeScript with **inline sourcemaps** and **declaration files**
|
||||||
1. Create Declaration Files
|
1. Create EsDoc Documentation
|
||||||
1. Create JsDoc Documentation
|
|
||||||
1. Instrumentalize created JavaScript files with istanbul
|
1. Instrumentalize created JavaScript files with istanbul
|
||||||
1. Run Tests
|
1. Run Tests
|
||||||
1. Create Coverage report
|
1. Create Coverage report
|
||||||
@ -50,28 +51,13 @@ the npmts.json is the main config file. You can use it to customize the behaviou
|
|||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"mode":"default",
|
"mode":"default",
|
||||||
"codecov":{
|
|
||||||
"publish":true,
|
|
||||||
"token":"sometoken"
|
|
||||||
},
|
|
||||||
"ts":{
|
"ts":{
|
||||||
"./customdir/*.ts":"./"
|
"./customdir/*.ts":"./"
|
||||||
},
|
},
|
||||||
"docs": {
|
|
||||||
"publish":true,
|
|
||||||
"destination":"github"
|
|
||||||
},
|
|
||||||
"tsOptions":{
|
"tsOptions":{
|
||||||
"declaration":false,
|
"declaration":false,
|
||||||
"target":"ES6"
|
"target":"ES6"
|
||||||
},
|
},
|
||||||
"typings":[
|
|
||||||
"./ts/typings.json",
|
|
||||||
"./subts1/typings.json",
|
|
||||||
"./subts2/typings.json",
|
|
||||||
"./customdir/typings.json"
|
|
||||||
],
|
|
||||||
"typingsInclude":"auto",
|
|
||||||
"cli":true
|
"cli":true
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@ -85,14 +71,6 @@ the npmts.json is the main config file. You can use it to customize the behaviou
|
|||||||
| `"typings"` | `["./ts/typings.json"]` | allows you to specify multiple locations for typings.json to install. This is needed for modules that do not yet bundle typings |
|
| `"typings"` | `["./ts/typings.json"]` | allows you to specify multiple locations for typings.json to install. This is needed for modules that do not yet bundle typings |
|
||||||
| `"cli"` | "false" | some modules are designed to be used from cli. If set to true NPMTS will create a cli.js that wires you dist files up for cli use. |
|
| `"cli"` | "false" | some modules are designed to be used from cli. If set to true NPMTS will create a cli.js that wires you dist files up for cli use. |
|
||||||
|
|
||||||
#### Typings
|
|
||||||
**npmts** looks for `./ts/typings.json` by default and installs any defined typings to `.ts/typings/`.
|
|
||||||
|
|
||||||
> Note: You can reference the typings files in any of your TypeScript code with a
|
|
||||||
`/// <reference path="/some/path/main.d.ts">`
|
|
||||||
We are currently working on a "typingsInclude" option, that will autoload any typings during compilation.
|
|
||||||
tsconfig is NOT supported, since it would render this module useless
|
|
||||||
|
|
||||||
#### TypeScript
|
#### TypeScript
|
||||||
by default npmts looks for `./ts/*.ts` and `./test/test.ts` that will compile to
|
by default npmts looks for `./ts/*.ts` and `./test/test.ts` that will compile to
|
||||||
`./dist/*.js` and `./test/test.js`
|
`./dist/*.js` and `./test/test.js`
|
||||||
@ -112,7 +90,8 @@ This is in line with the latest TypeScript best practices.
|
|||||||
You can then import plugins via the TypeScript `import` Syntax
|
You can then import plugins via the TypeScript `import` Syntax
|
||||||
and tsc will pick up the declaration file automatically.
|
and tsc will pick up the declaration file automatically.
|
||||||
|
|
||||||
> Note: If you don't want declaration files, set tsOptions.declaration to false in npmts.json
|
#### Typings for third party modules that do not bundle declaration files
|
||||||
|
NPMTS does no longer supports typings.json. Instead use the new TypeScript 2.x approach to typings using the @types/ npm scope.
|
||||||
|
|
||||||
#### Instrumentalize Code
|
#### Instrumentalize Code
|
||||||
npmts instrumentalizes (using istanbul) the created JavaScript code to create a coverage report.
|
npmts instrumentalizes (using istanbul) the created JavaScript code to create a coverage report.
|
||||||
@ -125,7 +104,6 @@ Any errors will be shown with reference to their originating source in TypeScrip
|
|||||||
thanks to autogenerated source maps.
|
thanks to autogenerated source maps.
|
||||||
|
|
||||||
## Example Usage in modules:
|
## Example Usage in modules:
|
||||||
* [gulp-typings](https://www.npmjs.com/package/gulp-typings)
|
|
||||||
* [gulp-browser](https://www.npmjs.com/package/gulp-typings)
|
* [gulp-browser](https://www.npmjs.com/package/gulp-typings)
|
||||||
|
|
||||||
> We will add more options over time.
|
> We will add more options over time.
|
||||||
@ -133,7 +111,7 @@ thanks to autogenerated source maps.
|
|||||||
## Tips and tricks:
|
## Tips and tricks:
|
||||||
|
|
||||||
* Use [npmts-g](https://www.npmjs.com/package/npmts-g) to use globally installed npmts and install npmts locally if no global npmts is available.
|
* Use [npmts-g](https://www.npmjs.com/package/npmts-g) to use globally installed npmts and install npmts locally if no global npmts is available.
|
||||||
* Use [npmpage](https://www.npmjs.com/package/npmtspage) to create a webpage from coverage reports and JsDocs for the module
|
* Use [npmpage](https://www.npmjs.com/package/npmtspage) to create a webpage from coverage reports and EsDocs for the module
|
||||||
* Use [hosttoday/ht-docker-node:npmts](https://hub.docker.com/r/hosttoday/ht-docker-node/) for speedy CI builds
|
* Use [hosttoday/ht-docker-node:npmts](https://hub.docker.com/r/hosttoday/ht-docker-node/) for speedy CI builds
|
||||||
|
|
||||||
## About the authors:
|
## About the authors:
|
||||||
|
@ -1 +0,0 @@
|
|||||||
#!/usr/bin/env node
|
|
@ -1,49 +0,0 @@
|
|||||||
// import gulp
|
|
||||||
var plugins = {
|
|
||||||
beautylog: require("beautylog"),
|
|
||||||
gulp: require("gulp"),
|
|
||||||
g:{
|
|
||||||
typescript: require("gulp-typescript"),
|
|
||||||
typings:require("gulp-typings")
|
|
||||||
},
|
|
||||||
mergeStream: require("merge2"),
|
|
||||||
path: require("path")
|
|
||||||
};
|
|
||||||
|
|
||||||
paths = {
|
|
||||||
packageBase: plugins.path.resolve(
|
|
||||||
plugins.path.join(__dirname,"../")
|
|
||||||
)
|
|
||||||
};
|
|
||||||
|
|
||||||
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;
|
|
||||||
});
|
|
||||||
|
|
||||||
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');
|
|
||||||
});
|
|
||||||
|
|
||||||
plugins.gulp.start.apply(plugins.gulp, ['default']);
|
|
1
dist/index.d.ts
vendored
Normal file
1
dist/index.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
import "typings-global";
|
4
dist/npmts.assets.d.ts
vendored
Normal file
4
dist/npmts.assets.d.ts
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
/// <reference types="q" />
|
||||||
|
import "typings-global";
|
||||||
|
import plugins = require("./npmts.plugins");
|
||||||
|
export declare var run: (configArg: any) => plugins.Q.Promise<{}>;
|
2
dist/npmts.assets.js
vendored
2
dist/npmts.assets.js
vendored
@ -8,7 +8,7 @@ exports.run = function (configArg) {
|
|||||||
var config = configArg;
|
var config = configArg;
|
||||||
npmts_promisechain_1.npmtsOra.text("now looking at " + "required assets".yellow);
|
npmts_promisechain_1.npmtsOra.text("now looking at " + "required assets".yellow);
|
||||||
if (config.cli == true) {
|
if (config.cli == true) {
|
||||||
plugins.smartfile.fsaction.copy(plugins.path.join(paths.npmtsAssetsDir, "cli.js"), paths.distDir);
|
plugins.smartfile.fs.copy(plugins.path.join(paths.npmtsAssetsDir, "cli.js"), paths.distDir);
|
||||||
plugins.beautylog.ok("installed CLI assets!");
|
plugins.beautylog.ok("installed CLI assets!");
|
||||||
done.resolve(config);
|
done.resolve(config);
|
||||||
}
|
}
|
||||||
|
4
dist/npmts.clean.d.ts
vendored
Normal file
4
dist/npmts.clean.d.ts
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
/// <reference types="q" />
|
||||||
|
import "typings-global";
|
||||||
|
import plugins = require("./npmts.plugins");
|
||||||
|
export declare let run: (configArg: any) => plugins.Q.Promise<{}>;
|
2
dist/npmts.clean.js
vendored
2
dist/npmts.clean.js
vendored
@ -5,7 +5,7 @@ var paths = require("./npmts.paths");
|
|||||||
var npmts_promisechain_1 = require("./npmts.promisechain");
|
var npmts_promisechain_1 = require("./npmts.promisechain");
|
||||||
var removeDist = function () {
|
var removeDist = function () {
|
||||||
npmts_promisechain_1.npmtsOra.text("cleaning " + "dist".yellow + " folder");
|
npmts_promisechain_1.npmtsOra.text("cleaning " + "dist".yellow + " folder");
|
||||||
return plugins.smartfile.fsaction.remove(paths.distDir);
|
return plugins.smartfile.fs.remove(paths.distDir);
|
||||||
};
|
};
|
||||||
var removeTypings = function () {
|
var removeTypings = function () {
|
||||||
var done = plugins.Q.defer();
|
var done = plugins.Q.defer();
|
||||||
|
2
dist/npmts.cli.js
vendored
2
dist/npmts.cli.js
vendored
@ -1,2 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
require("typings-global");
|
|
4
dist/npmts.compile.d.ts
vendored
Normal file
4
dist/npmts.compile.d.ts
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
/// <reference types="q" />
|
||||||
|
import "typings-global";
|
||||||
|
import plugins = require("./npmts.plugins");
|
||||||
|
export declare let run: (configArg: any) => plugins.Q.Promise<{}>;
|
1
dist/npmts.compile.helpers.d.ts
vendored
Normal file
1
dist/npmts.compile.helpers.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
export declare let checkOutputPath: (tsArrayArg: any, keyArg: any) => boolean;
|
74
dist/npmts.compile.js
vendored
74
dist/npmts.compile.js
vendored
@ -1,44 +1,15 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
require("typings-global");
|
require("typings-global");
|
||||||
var plugins = require("./npmts.plugins");
|
var plugins = require("./npmts.plugins");
|
||||||
var paths = require("./npmts.paths");
|
|
||||||
var helpers = require("./npmts.compile.helpers");
|
var helpers = require("./npmts.compile.helpers");
|
||||||
var npmts_promisechain_1 = require("./npmts.promisechain");
|
var npmts_promisechain_1 = require("./npmts.promisechain");
|
||||||
/**
|
var promiseArray = [];
|
||||||
* handles definition to make them fit for modular use
|
|
||||||
*/
|
|
||||||
var definitionHandler = function (configArg) {
|
|
||||||
npmts_promisechain_1.npmtsOra.text("now making declaration files ready");
|
|
||||||
var done = plugins.Q.defer();
|
|
||||||
var configTsLenght = Object.keys(configArg.ts).length;
|
|
||||||
if (configTsLenght == 0) {
|
|
||||||
plugins.beautylog.warn("No TS file and thus no definitions found!");
|
|
||||||
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("made declaration files ready!");
|
|
||||||
done.resolve(configArg);
|
|
||||||
}
|
|
||||||
;
|
|
||||||
}, "atEnd"));
|
|
||||||
}
|
|
||||||
return done.promise;
|
|
||||||
};
|
|
||||||
var compileTs = function (tsFileArrayArg, tsOptionsArg) {
|
var compileTs = function (tsFileArrayArg, tsOptionsArg) {
|
||||||
if (tsOptionsArg === void 0) { tsOptionsArg = {}; }
|
if (tsOptionsArg === void 0) { tsOptionsArg = {}; }
|
||||||
var done = plugins.Q.defer();
|
var done = plugins.Q.defer();
|
||||||
var moduleStream = plugins.merge2({ end: false });
|
|
||||||
var tsOptionsDefault = {
|
var tsOptionsDefault = {
|
||||||
declaration: true,
|
declaration: true,
|
||||||
target: "ES5",
|
target: "ES6",
|
||||||
module: "commonjs"
|
module: "commonjs"
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
@ -47,22 +18,25 @@ var compileTs = function (tsFileArrayArg, tsOptionsArg) {
|
|||||||
var tsOptions = function (keyArg) {
|
var tsOptions = function (keyArg) {
|
||||||
return plugins.lodashObject.assign(tsOptionsDefault, tsOptionsArg);
|
return plugins.lodashObject.assign(tsOptionsDefault, tsOptionsArg);
|
||||||
};
|
};
|
||||||
for (var keyArg in tsFileArrayArg) {
|
var _loop_1 = function(keyArg) {
|
||||||
|
plugins.beautylog.info("TypeScript assignment: transpile from " + keyArg.blue + " to " + tsFileArrayArg[keyArg].blue);
|
||||||
if (helpers.checkOutputPath(tsFileArrayArg, keyArg)) {
|
if (helpers.checkOutputPath(tsFileArrayArg, keyArg)) {
|
||||||
var tsStream = plugins.gulp.src([plugins.path.join(paths.cwd, keyArg), "!**/typings/**"])
|
var filesReadPromise = plugins.smartfile.fs.listFileTree(process.cwd(), keyArg)
|
||||||
.pipe(plugins.g.sourcemaps.init()) // This means sourcemaps will be generated
|
.then(function (filesToConvertArg) {
|
||||||
.pipe(plugins.g.typescript(tsOptions(keyArg)));
|
var filesToConvertAbsolute = plugins.smartpath.transform.toAbsolute(filesToConvertArg, process.cwd());
|
||||||
var jsStream = tsStream.js
|
var destDir = plugins.smartpath.transform.toAbsolute(tsFileArrayArg[keyArg], process.cwd());
|
||||||
.pipe(plugins.g.sourcemaps.write()) // Now the sourcemaps are added to the .js file
|
var filesCompiledPromise = plugins.tsn.compile(filesToConvertAbsolute, destDir);
|
||||||
.pipe(plugins.gulp.dest(tsFileArrayArg[keyArg]));
|
promiseArray.push(filesCompiledPromise);
|
||||||
var declarationStream = tsStream.dts
|
});
|
||||||
.pipe(plugins.gulp.dest(tsFileArrayArg[keyArg]));
|
promiseArray.push(filesReadPromise);
|
||||||
moduleStream.add(tsStream, jsStream, declarationStream);
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
for (var keyArg in tsFileArrayArg) {
|
||||||
|
_loop_1(keyArg);
|
||||||
}
|
}
|
||||||
moduleStream.on("queueDrain", function () {
|
;
|
||||||
done.resolve();
|
plugins.Q.all(promiseArray)
|
||||||
});
|
.then(done.resolve);
|
||||||
return done.promise;
|
return done.promise;
|
||||||
};
|
};
|
||||||
exports.run = function (configArg) {
|
exports.run = function (configArg) {
|
||||||
@ -71,15 +45,13 @@ exports.run = function (configArg) {
|
|||||||
npmts_promisechain_1.npmtsOra.text("now compiling " + "TypeScript".yellow);
|
npmts_promisechain_1.npmtsOra.text("now compiling " + "TypeScript".yellow);
|
||||||
compileTs(config.ts, config.tsOptions)
|
compileTs(config.ts, config.tsOptions)
|
||||||
.then(function () {
|
.then(function () {
|
||||||
compileTs(config.testTs);
|
plugins.beautylog.ok("compiled main TypeScript!");
|
||||||
|
plugins.beautylog.log("now compiling tests!");
|
||||||
|
return compileTs(config.testTs);
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
plugins.beautylog.ok("compiled TypeScript!");
|
plugins.beautylog.ok("compiled all TypeScript!");
|
||||||
definitionHandler(config)
|
done.resolve(config);
|
||||||
.then(function () {
|
|
||||||
done.resolve(config);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
/*==================== END TS Compilation =====================*/
|
|
||||||
return done.promise;
|
return done.promise;
|
||||||
};
|
};
|
||||||
|
4
dist/npmts.configfile.d.ts
vendored
Normal file
4
dist/npmts.configfile.d.ts
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
/// <reference types="q" />
|
||||||
|
import "typings-global";
|
||||||
|
import plugins = require("./npmts.plugins");
|
||||||
|
export declare var run: (argvArg: any) => plugins.Q.Promise<{}>;
|
4
dist/npmts.configfile.js
vendored
4
dist/npmts.configfile.js
vendored
@ -9,9 +9,9 @@ exports.run = function (argvArg) {
|
|||||||
if (argvArg.notest) {
|
if (argvArg.notest) {
|
||||||
config.notest = true;
|
config.notest = true;
|
||||||
}
|
}
|
||||||
if (plugins.smartfile.checks.fileExistsSync(configPath)) {
|
if (plugins.smartfile.fs.fileExistsSync(configPath)) {
|
||||||
plugins.beautylog.info("npmts.json".blue + " config file found!");
|
plugins.beautylog.info("npmts.json".blue + " config file found!");
|
||||||
config = plugins.smartfile.local.toObjectSync(configPath);
|
config = plugins.lodashObject.assign(config, plugins.smartfile.fs.toObjectSync(configPath));
|
||||||
switch (config.mode) {
|
switch (config.mode) {
|
||||||
case "default":
|
case "default":
|
||||||
case "custom":
|
case "custom":
|
||||||
|
21
dist/npmts.install.js
vendored
21
dist/npmts.install.js
vendored
@ -1,21 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
require("typings-global");
|
|
||||||
var plugins = require("./npmts.plugins");
|
|
||||||
var paths = require("./npmts.paths");
|
|
||||||
var npmts_promisechain_1 = require("./npmts.promisechain");
|
|
||||||
exports.run = function (configArg) {
|
|
||||||
var config = configArg;
|
|
||||||
var done = plugins.Q.defer();
|
|
||||||
/* -------------------------------------------------
|
|
||||||
* ----------- install typings ---------------
|
|
||||||
* ----------------------------------------------- */
|
|
||||||
npmts_promisechain_1.npmtsOra.text("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 installed!");
|
|
||||||
done.resolve(config);
|
|
||||||
}, "atEnd"));
|
|
||||||
return done.promise;
|
|
||||||
};
|
|
28
dist/npmts.jsdoc.js
vendored
28
dist/npmts.jsdoc.js
vendored
@ -1,28 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
require("typings-global");
|
|
||||||
var plugins = require("./npmts.plugins");
|
|
||||||
var paths = require("./npmts.paths");
|
|
||||||
var npmts_promisechain_1 = require("./npmts.promisechain");
|
|
||||||
var genJsdoc = function (configArg) {
|
|
||||||
var done = plugins.Q.defer();
|
|
||||||
npmts_promisechain_1.npmtsOra.text("now generating " + "JsDoc documentation".yellow);
|
|
||||||
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.run = function (configArg) {
|
|
||||||
var done = plugins.Q.defer();
|
|
||||||
genJsdoc(configArg)
|
|
||||||
.then(done.resolve);
|
|
||||||
return done.promise;
|
|
||||||
};
|
|
5
dist/npmts.options.d.ts
vendored
Normal file
5
dist/npmts.options.d.ts
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
/// <reference types="q" />
|
||||||
|
import "typings-global";
|
||||||
|
import plugins = require("./npmts.plugins");
|
||||||
|
export declare let isCi: () => any;
|
||||||
|
export declare var run: (configArg: any) => plugins.Q.Promise<{}>;
|
12
dist/npmts.paths.d.ts
vendored
Normal file
12
dist/npmts.paths.d.ts
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import "typings-global";
|
||||||
|
export declare let npmtsPackageRoot: string;
|
||||||
|
export declare let cwd: string;
|
||||||
|
export declare let tsDir: string;
|
||||||
|
export declare let distDir: string;
|
||||||
|
export declare let docsDir: string;
|
||||||
|
export declare let testDir: string;
|
||||||
|
export declare let typingsDir: string;
|
||||||
|
export declare let coverageDir: string;
|
||||||
|
export declare let npmtsAssetsDir: string;
|
||||||
|
export declare let indexTS: string;
|
||||||
|
export declare let testTS: string;
|
29
dist/npmts.plugins.d.ts
vendored
Normal file
29
dist/npmts.plugins.d.ts
vendored
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
import "typings-global";
|
||||||
|
export import beautylog = require("beautylog");
|
||||||
|
export declare let gulp: any;
|
||||||
|
export declare let g: {
|
||||||
|
babel: any;
|
||||||
|
istanbul: any;
|
||||||
|
gFunction: any;
|
||||||
|
injectModules: any;
|
||||||
|
mocha: any;
|
||||||
|
replace: any;
|
||||||
|
sourcemaps: any;
|
||||||
|
typedoc: any;
|
||||||
|
};
|
||||||
|
import "babel-preset-es2015";
|
||||||
|
export declare let lodashObject: any;
|
||||||
|
export declare let merge2: any;
|
||||||
|
export import projectinfo = require("projectinfo");
|
||||||
|
export import path = require("path");
|
||||||
|
export import Q = require("q");
|
||||||
|
export import shelljs = require("shelljs");
|
||||||
|
export declare let smartci: any;
|
||||||
|
export import smartcli = require("smartcli");
|
||||||
|
export declare let smartcov: any;
|
||||||
|
export import smartenv = require("smartenv");
|
||||||
|
export import smartfile = require("smartfile");
|
||||||
|
export import smartpath = require("smartpath");
|
||||||
|
export import smartstring = require("smartstring");
|
||||||
|
export declare let sourceMapSupport: any;
|
||||||
|
export import tsn = require("tsn");
|
11
dist/npmts.plugins.js
vendored
11
dist/npmts.plugins.js
vendored
@ -1,18 +1,18 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
require("typings-global");
|
require("typings-global");
|
||||||
exports.beautylog = require("beautylog");
|
exports.beautylog = require("beautylog");
|
||||||
exports.fs = require("fs-extra");
|
|
||||||
exports.gulp = require("gulp");
|
exports.gulp = require("gulp");
|
||||||
exports.g = {
|
exports.g = {
|
||||||
gFunction: require("gulp-function"),
|
babel: require("gulp-babel"),
|
||||||
istanbul: require("gulp-istanbul"),
|
istanbul: require("gulp-istanbul"),
|
||||||
jsdoc3: require("gulp-jsdoc3"),
|
gFunction: require("gulp-function"),
|
||||||
|
injectModules: require("gulp-inject-modules"),
|
||||||
mocha: require("gulp-mocha"),
|
mocha: require("gulp-mocha"),
|
||||||
replace: require("gulp-replace"),
|
replace: require("gulp-replace"),
|
||||||
sourcemaps: require("gulp-sourcemaps"),
|
sourcemaps: require("gulp-sourcemaps"),
|
||||||
typescript: require("gulp-typescript"),
|
typedoc: require("gulp-typedoc")
|
||||||
typings: require("gulp-typings")
|
|
||||||
};
|
};
|
||||||
|
require("babel-preset-es2015");
|
||||||
exports.lodashObject = require('lodash/fp/object');
|
exports.lodashObject = require('lodash/fp/object');
|
||||||
exports.merge2 = require("merge2");
|
exports.merge2 = require("merge2");
|
||||||
exports.projectinfo = require("projectinfo");
|
exports.projectinfo = require("projectinfo");
|
||||||
@ -27,3 +27,4 @@ exports.smartfile = require("smartfile");
|
|||||||
exports.smartpath = require("smartpath");
|
exports.smartpath = require("smartpath");
|
||||||
exports.smartstring = require("smartstring");
|
exports.smartstring = require("smartstring");
|
||||||
exports.sourceMapSupport = require("source-map-support").install(); // this is required to display errors correctly during testing
|
exports.sourceMapSupport = require("source-map-support").install(); // this is required to display errors correctly during testing
|
||||||
|
exports.tsn = require("tsn");
|
||||||
|
6
dist/npmts.promisechain.d.ts
vendored
Normal file
6
dist/npmts.promisechain.d.ts
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
/// <reference types="q" />
|
||||||
|
import "typings-global";
|
||||||
|
import plugins = require("./npmts.plugins");
|
||||||
|
import { Ora } from "beautylog";
|
||||||
|
export declare let npmtsOra: Ora;
|
||||||
|
export declare let promisechain: (argvArg: any) => plugins.Q.Promise<{}>;
|
8
dist/npmts.promisechain.js
vendored
8
dist/npmts.promisechain.js
vendored
@ -6,10 +6,8 @@ var NpmtsAssets = require("./npmts.assets");
|
|||||||
var NpmtsClean = require("./npmts.clean");
|
var NpmtsClean = require("./npmts.clean");
|
||||||
var NpmtsCompile = require("./npmts.compile");
|
var NpmtsCompile = require("./npmts.compile");
|
||||||
var NpmtsConfigFile = require("./npmts.configfile");
|
var NpmtsConfigFile = require("./npmts.configfile");
|
||||||
var NpmtsInstall = require("./npmts.install");
|
var NpmtsTypeDoc = require("./npmts.typedoc");
|
||||||
var NpmtsJsdoc = require("./npmts.jsdoc");
|
|
||||||
var NpmtsOptions = require("./npmts.options");
|
var NpmtsOptions = require("./npmts.options");
|
||||||
var NpmtsPublish = require("./npmts.publish");
|
|
||||||
var NpmtsTests = require("./npmts.tests");
|
var NpmtsTests = require("./npmts.tests");
|
||||||
exports.promisechain = function (argvArg) {
|
exports.promisechain = function (argvArg) {
|
||||||
var done = plugins.Q.defer();
|
var done = plugins.Q.defer();
|
||||||
@ -17,12 +15,10 @@ exports.promisechain = function (argvArg) {
|
|||||||
NpmtsConfigFile.run(argvArg)
|
NpmtsConfigFile.run(argvArg)
|
||||||
.then(NpmtsOptions.run)
|
.then(NpmtsOptions.run)
|
||||||
.then(NpmtsClean.run)
|
.then(NpmtsClean.run)
|
||||||
.then(NpmtsInstall.run)
|
|
||||||
.then(NpmtsCompile.run)
|
.then(NpmtsCompile.run)
|
||||||
.then(NpmtsAssets.run)
|
.then(NpmtsAssets.run)
|
||||||
.then(NpmtsJsdoc.run)
|
.then(NpmtsTypeDoc.run)
|
||||||
.then(NpmtsTests.run)
|
.then(NpmtsTests.run)
|
||||||
.then(NpmtsPublish.run)
|
|
||||||
.then(function (configArg) {
|
.then(function (configArg) {
|
||||||
var shipString = "" +
|
var shipString = "" +
|
||||||
"\n" +
|
"\n" +
|
||||||
|
9
dist/npmts.publish.js
vendored
9
dist/npmts.publish.js
vendored
@ -1,9 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
require("typings-global");
|
|
||||||
var plugins = require("./npmts.plugins");
|
|
||||||
exports.run = function (configArg) {
|
|
||||||
var done = plugins.Q.defer();
|
|
||||||
var config = configArg;
|
|
||||||
done.resolve();
|
|
||||||
return done.promise;
|
|
||||||
};
|
|
4
dist/npmts.tests.d.ts
vendored
Normal file
4
dist/npmts.tests.d.ts
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
/// <reference types="q" />
|
||||||
|
import "typings-global";
|
||||||
|
import plugins = require("./npmts.plugins");
|
||||||
|
export declare let run: (configArg: any) => plugins.Q.Promise<{}>;
|
53
dist/npmts.tests.js
vendored
53
dist/npmts.tests.js
vendored
@ -7,32 +7,31 @@ var npmts_promisechain_1 = require("./npmts.promisechain");
|
|||||||
*
|
*
|
||||||
* @returns {*}
|
* @returns {*}
|
||||||
*/
|
*/
|
||||||
var istanbul = function (configArg) {
|
var mocha = function (configArg) {
|
||||||
npmts_promisechain_1.npmtsOra.text("Instrumentalizing transpiled JS...");
|
npmts_promisechain_1.npmtsOra.text("Instrumentalizing and testing transpiled JS");
|
||||||
|
npmts_promisechain_1.npmtsOra.end(); // end npmtsOra for tests.
|
||||||
var done = plugins.Q.defer();
|
var done = plugins.Q.defer();
|
||||||
var stream = plugins.gulp.src([plugins.path.join(paths.cwd, "dist/*.js")])
|
var stream = plugins.gulp.src([plugins.path.join(paths.cwd, "dist/*.js")])
|
||||||
.pipe(plugins.g.istanbul()) // Covering files
|
.pipe(plugins.g.sourcemaps.init())
|
||||||
.pipe(plugins.g.istanbul.hookRequire()) // Force `require` to return covered files
|
.pipe(plugins.g.babel({
|
||||||
.pipe(plugins.g.gFunction(function () {
|
presets: ['es2015']
|
||||||
plugins.beautylog.ok("JS has been instrumentalized to get test code coverage!");
|
}))
|
||||||
done.resolve(configArg);
|
.pipe(plugins.g.istanbul())
|
||||||
}, "atEnd"));
|
.pipe(plugins.g.sourcemaps.write())
|
||||||
return done.promise;
|
.pipe(plugins.g.injectModules())
|
||||||
};
|
.on("finish", function () {
|
||||||
/**
|
plugins.gulp.src([plugins.path.join(paths.cwd, "test/test.js")])
|
||||||
*
|
.pipe(plugins.g.babel({
|
||||||
* @returns {*}
|
presets: ['es2015']
|
||||||
*/
|
}))
|
||||||
var mocha = function (configArg) {
|
.pipe(plugins.g.injectModules())
|
||||||
var done = plugins.Q.defer();
|
.pipe(plugins.g.mocha())
|
||||||
npmts_promisechain_1.npmtsOra.end(); // end npmtsOra for tests.
|
.pipe(plugins.g.istanbul.writeReports())
|
||||||
var stream = plugins.gulp.src(["./test/test.js"])
|
.pipe(plugins.g.gFunction(function () {
|
||||||
.pipe(plugins.g.mocha())
|
plugins.beautylog.ok("Tested!");
|
||||||
.pipe(plugins.g.istanbul.writeReports()) // Creating the reports after tests ran
|
done.resolve(configArg);
|
||||||
.pipe(plugins.g.gFunction(function () {
|
}, "atEnd"));
|
||||||
plugins.beautylog.ok("Tests have passed!");
|
});
|
||||||
done.resolve(configArg);
|
|
||||||
}, "atEnd"));
|
|
||||||
return done.promise;
|
return done.promise;
|
||||||
};
|
};
|
||||||
var coverage = function (configArg) {
|
var coverage = function (configArg) {
|
||||||
@ -56,19 +55,19 @@ var coverage = function (configArg) {
|
|||||||
exports.run = function (configArg) {
|
exports.run = function (configArg) {
|
||||||
var done = plugins.Q.defer();
|
var done = plugins.Q.defer();
|
||||||
var config = configArg;
|
var config = configArg;
|
||||||
if (!config.notest) {
|
if (config.notest != true) {
|
||||||
npmts_promisechain_1.npmtsOra.text("now starting tests");
|
npmts_promisechain_1.npmtsOra.text("now starting tests");
|
||||||
plugins.beautylog.log("-------------------------------------------------------\n" +
|
plugins.beautylog.log("-------------------------------------------------------\n" +
|
||||||
"*************************** TESTS: ***************************\n" +
|
"*************************** TESTS: ***************************\n" +
|
||||||
"--------------------------------------------------------------");
|
"--------------------------------------------------------------");
|
||||||
istanbul(config)
|
mocha(config)
|
||||||
.then(mocha)
|
|
||||||
.then(coverage)
|
.then(coverage)
|
||||||
.then(function () {
|
.then(function () {
|
||||||
done.resolve(config);
|
done.resolve(config);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
npmts_promisechain_1.npmtsOra.end();
|
||||||
done.resolve(config);
|
done.resolve(config);
|
||||||
}
|
}
|
||||||
return done.promise;
|
return done.promise;
|
||||||
|
4
dist/npmts.typedoc.d.ts
vendored
Normal file
4
dist/npmts.typedoc.d.ts
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
/// <reference types="q" />
|
||||||
|
import "typings-global";
|
||||||
|
import plugins = require("./npmts.plugins");
|
||||||
|
export declare let run: (configArg: any) => plugins.Q.Promise<{}>;
|
35
dist/npmts.typedoc.js
vendored
Normal file
35
dist/npmts.typedoc.js
vendored
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
"use strict";
|
||||||
|
require("typings-global");
|
||||||
|
var plugins = require("./npmts.plugins");
|
||||||
|
var paths = require("./npmts.paths");
|
||||||
|
var npmts_promisechain_1 = require("./npmts.promisechain");
|
||||||
|
var genTypeDoc = function (configArg) {
|
||||||
|
var done = plugins.Q.defer();
|
||||||
|
npmts_promisechain_1.npmtsOra.text("now generating " + "TypeDoc documentation".yellow);
|
||||||
|
plugins.beautylog.log("TypeDoc Output:");
|
||||||
|
plugins.gulp.src(plugins.path.join(paths.tsDir, "**/*.ts"))
|
||||||
|
.pipe(plugins.g.typedoc({
|
||||||
|
// TypeScript options (see typescript docs)
|
||||||
|
module: "commonjs",
|
||||||
|
target: "es6",
|
||||||
|
includeDeclarations: true,
|
||||||
|
// Output options (see typedoc docs)
|
||||||
|
out: paths.docsDir,
|
||||||
|
json: plugins.path.join(paths.docsDir, "file.json"),
|
||||||
|
// TypeDoc options (see typedoc docs)
|
||||||
|
name: "my-project",
|
||||||
|
//theme: "default",
|
||||||
|
ignoreCompilerErrors: true,
|
||||||
|
version: true,
|
||||||
|
}))
|
||||||
|
.pipe(plugins.g.gFunction(done.resolve, "atEnd"));
|
||||||
|
return done.promise;
|
||||||
|
};
|
||||||
|
exports.run = function (configArg) {
|
||||||
|
var done = plugins.Q.defer();
|
||||||
|
genTypeDoc(configArg)
|
||||||
|
.then(function () {
|
||||||
|
done.resolve(configArg);
|
||||||
|
});
|
||||||
|
return done.promise;
|
||||||
|
};
|
38
package.json
38
package.json
@ -1,16 +1,18 @@
|
|||||||
{
|
{
|
||||||
"name": "npmts",
|
"name": "npmts",
|
||||||
"version": "5.3.3",
|
"version": "5.3.16",
|
||||||
"description": "write npm modules with TypeScript",
|
"description": "write npm modules with TypeScript",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
"npmts": "dist/cli.js"
|
"npmts": "dist/cli.js"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(npm run compile && npm run check && npm run checkVersion)",
|
"test": "(npm run compile && npm run setupCheck && npm run check && npm run checkVersion && npm run checkNoTest)",
|
||||||
"check": "(cd ./test/assets && node ../../dist/index.js)",
|
"compile": "(rm -rf test/ && rm -r dist/ && mkdir dist/ && tsc && cp assets/cli.js dist/ )",
|
||||||
"checkVersion": "cd ./test/assets && node ../../dist/index.js -v",
|
"setupCheck": "(git clone https://gitlab.com/sandboxzone/sandbox-npmts.git test/)",
|
||||||
"compile": "(cd compile && node compile.js)"
|
"check": "(cd test && node ../dist/index.js)",
|
||||||
|
"checkVersion": "(cd test/ && node ../dist/index.js -v)",
|
||||||
|
"checkNoTest": "(cd test && node ../dist/index.js --notest)"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@ -27,33 +29,37 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://gitlab.com/pushrocks/npmts#readme",
|
"homepage": "https://gitlab.com/pushrocks/npmts#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"beautylog": "5.0.11",
|
"@types/minimatch": "*",
|
||||||
|
"@types/q": "*",
|
||||||
|
"@types/shelljs": "*",
|
||||||
|
"beautylog": "5.0.14",
|
||||||
"early": "^2.0.13",
|
"early": "^2.0.13",
|
||||||
"fs-extra": "^0.30.0",
|
|
||||||
"gulp": "3.9.1",
|
"gulp": "3.9.1",
|
||||||
|
"gulp-babel": "^6.1.2",
|
||||||
"gulp-concat": "^2.6.0",
|
"gulp-concat": "^2.6.0",
|
||||||
"gulp-function": "^1.3.6",
|
"gulp-function": "^1.3.6",
|
||||||
"gulp-if": "^2.0.1",
|
"gulp-if": "^2.0.1",
|
||||||
|
"gulp-inject-modules": "^1.0.0",
|
||||||
"gulp-istanbul": "^1.0.0",
|
"gulp-istanbul": "^1.0.0",
|
||||||
"gulp-jsdoc3": "^0.3.0",
|
|
||||||
"gulp-mocha": "^2.2.0",
|
"gulp-mocha": "^2.2.0",
|
||||||
"gulp-replace": "^0.5.4",
|
"gulp-replace": "^0.5.4",
|
||||||
"gulp-sourcemaps": "^2.0.0-alpha",
|
"gulp-sourcemaps": "^1.6.0",
|
||||||
"gulp-typescript": "2.13.6",
|
"gulp-typedoc": "^2.0.0",
|
||||||
"gulp-typings": "2.0.0",
|
|
||||||
"lodash": "^4.13.1",
|
"lodash": "^4.13.1",
|
||||||
"merge2": "1.0.2",
|
|
||||||
"projectinfo": "1.0.3",
|
"projectinfo": "1.0.3",
|
||||||
"q": "^1.4.1",
|
"q": "^1.4.1",
|
||||||
"shelljs": "^0.7.0",
|
"shelljs": "^0.7.0",
|
||||||
"smartci": "0.0.1",
|
"smartci": "0.0.1",
|
||||||
"smartcli": "1.0.2",
|
"smartcli": "1.0.4",
|
||||||
"smartcov": "0.0.6",
|
"smartcov": "0.0.6",
|
||||||
"smartenv": "1.2.5",
|
"smartenv": "1.2.5",
|
||||||
"smartfile": "3.0.10",
|
"smartfile": "4.0.10",
|
||||||
"smartpath": "3.2.2",
|
"smartpath": "3.2.2",
|
||||||
"smartstring": "^2.0.6",
|
"smartstring": "^2.0.14",
|
||||||
"source-map-support": "^0.4.0",
|
"source-map-support": "^0.4.2",
|
||||||
|
"tsn": "^1.0.7",
|
||||||
|
"typedoc": "^0.4.4",
|
||||||
|
"typescript": "^2.0.0-dev.20160630",
|
||||||
"typings-global": "*"
|
"typings-global": "*"
|
||||||
},
|
},
|
||||||
"devDependencies": {}
|
"devDependencies": {}
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
var hello = "hello";
|
|
||||||
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImN1c3RvbS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxJQUFJLEtBQUssR0FBRyxPQUFPLENBQUMiLCJmaWxlIjoiY3VzdG9tLmpzIiwic291cmNlc0NvbnRlbnQiOlsidmFyIGhlbGxvID0gXCJoZWxsb1wiOyJdLCJzb3VyY2VSb290IjoiL3NvdXJjZS8ifQ==
|
|
@ -1,2 +0,0 @@
|
|||||||
var hello = "hello";
|
|
||||||
//# sourceMappingURL=custom.js.map
|
|
@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"custom.js","sourceRoot":"","sources":["custom.ts"],"names":[],"mappings":"AAAA,IAAI,KAAK,GAAG,OAAO,CAAC"}
|
|
@ -1 +0,0 @@
|
|||||||
var hello = "hello";
|
|
@ -1,2 +0,0 @@
|
|||||||
var something = "something";
|
|
||||||
//# sourceMappingURL=tsfile1.js.map
|
|
@ -1 +0,0 @@
|
|||||||
{"version":3,"file":"tsfile1.js","sourceRoot":"","sources":["tsfile1.ts"],"names":[],"mappings":"AAAA,IAAI,SAAS,GAAG,WAAW,CAAC"}
|
|
@ -1 +0,0 @@
|
|||||||
var something = "something";
|
|
@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"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
3
test/assets/dist/index.d.ts
vendored
@ -1,3 +0,0 @@
|
|||||||
declare let testplugin: {
|
|
||||||
logSomething: () => void;
|
|
||||||
};
|
|
9
test/assets/dist/index.js
vendored
9
test/assets/dist/index.js
vendored
@ -1,9 +0,0 @@
|
|||||||
/// <reference path="./typings/index.d.ts" />
|
|
||||||
var testplugin = {
|
|
||||||
logSomething: function () {
|
|
||||||
console.log("only function executed");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
module.exports = testplugin;
|
|
||||||
|
|
||||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLDZDQUE2QztBQUM3QyxJQUFJLFVBQVUsR0FBRztJQUNiLFlBQVksRUFBRTtRQUNWLE9BQU8sQ0FBQyxHQUFHLENBQUMsd0JBQXdCLENBQUMsQ0FBQztJQUMxQyxDQUFDO0NBQ0osQ0FBQztBQUNGLE1BQU0sQ0FBQyxPQUFPLEdBQUcsVUFBVSxDQUFDIiwiZmlsZSI6ImluZGV4LmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8vIDxyZWZlcmVuY2UgcGF0aD1cIi4vdHlwaW5ncy9pbmRleC5kLnRzXCIgLz5cbmxldCB0ZXN0cGx1Z2luID0ge1xuICAgIGxvZ1NvbWV0aGluZzogZnVuY3Rpb24oKXtcbiAgICAgICAgY29uc29sZS5sb2coXCJvbmx5IGZ1bmN0aW9uIGV4ZWN1dGVkXCIpO1xuICAgIH1cbn07XG5tb2R1bGUuZXhwb3J0cyA9IHRlc3RwbHVnaW47Il19
|
|
@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"mode":"default",
|
|
||||||
"ts":{
|
|
||||||
"./customdir/*.ts":"./"
|
|
||||||
},
|
|
||||||
"tsOptions":{
|
|
||||||
"target":"ES5"
|
|
||||||
},
|
|
||||||
"typings":[
|
|
||||||
"./ts/typings.json",
|
|
||||||
"./subts1/typings.json",
|
|
||||||
"./subts2/typings.json",
|
|
||||||
"./customdir/typings.json"
|
|
||||||
],
|
|
||||||
"docs": {
|
|
||||||
"publish":true
|
|
||||||
},
|
|
||||||
"cli":true
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
{
|
|
||||||
"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": {}
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"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
BIN
test/assets/test/.DS_Store
vendored
Binary file not shown.
2
test/assets/test/test.d.ts
vendored
2
test/assets/test/test.d.ts
vendored
@ -1,2 +0,0 @@
|
|||||||
/// <reference path="../ts/typings/index.d.ts" />
|
|
||||||
declare var testplugin: any;
|
|
@ -1,11 +0,0 @@
|
|||||||
/// <reference path="../ts/typings/index.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,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsaURBQWlEO0FBQ2pELElBQUksVUFBVSxHQUFHLE9BQU8sQ0FBQyxrQkFBa0IsQ0FBQyxDQUFDO0FBQzdDLFFBQVEsQ0FBQyxhQUFhLEVBQUM7SUFDbkIsUUFBUSxDQUFDLGVBQWUsRUFBQztRQUNyQixFQUFFLENBQUMsc0JBQXNCLEVBQUM7WUFDdEIsVUFBVSxDQUFDLFlBQVksRUFBRSxDQUFBO1FBQzdCLENBQUMsQ0FBQyxDQUFDO0lBQ1AsQ0FBQyxDQUFDLENBQUM7QUFDUCxDQUFDLENBQUMsQ0FBQyIsImZpbGUiOiJ0ZXN0LmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8vIDxyZWZlcmVuY2UgcGF0aD1cIi4uL3RzL3R5cGluZ3MvaW5kZXguZC50c1wiIC8+XG52YXIgdGVzdHBsdWdpbiA9IHJlcXVpcmUoXCIuLi9kaXN0L2luZGV4LmpzXCIpO1xuZGVzY3JpYmUoXCJ0ZXN0cGx1Z2luc1wiLGZ1bmN0aW9uKCl7XG4gICAgZGVzY3JpYmUoXCIubG9nU29tZXRoaW5nXCIsZnVuY3Rpb24oKXtcbiAgICAgICAgaXQoXCJzaG91bGQgbG9nIHNvbWV0aGluZ1wiLGZ1bmN0aW9uKCl7XG4gICAgICAgICAgICB0ZXN0cGx1Z2luLmxvZ1NvbWV0aGluZygpXG4gICAgICAgIH0pO1xuICAgIH0pO1xufSk7Il19
|
|
@ -1,9 +0,0 @@
|
|||||||
/// <reference path="../ts/typings/index.d.ts" />
|
|
||||||
var testplugin = require("../dist/index.js");
|
|
||||||
describe("testplugins",function(){
|
|
||||||
describe(".logSomething",function(){
|
|
||||||
it("should log something",function(){
|
|
||||||
testplugin.logSomething()
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"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"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
/// <reference path="./typings/index.d.ts" />
|
|
||||||
let testplugin = {
|
|
||||||
logSomething: function(){
|
|
||||||
console.log("only function executed");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
module.exports = testplugin;
|
|
@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"globalDependencies": {
|
|
||||||
"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"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
var something = "something";
|
|
||||||
|
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRzZmlsZTEudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsSUFBSSxTQUFTLEdBQUcsV0FBVyxDQUFDIiwiZmlsZSI6InRzZmlsZTEuanMiLCJzb3VyY2VzQ29udGVudCI6WyJ2YXIgc29tZXRoaW5nID0gXCJzb21ldGhpbmdcIjsiXSwic291cmNlUm9vdCI6Ii9zb3VyY2UvIn0=
|
|
@ -8,7 +8,7 @@ export var run = function(configArg){
|
|||||||
let config = configArg;
|
let config = configArg;
|
||||||
npmtsOra.text("now looking at " + "required assets".yellow);
|
npmtsOra.text("now looking at " + "required assets".yellow);
|
||||||
if(config.cli == true){
|
if(config.cli == true){
|
||||||
plugins.smartfile.fsaction.copy(plugins.path.join(paths.npmtsAssetsDir,"cli.js"),paths.distDir);
|
plugins.smartfile.fs.copy(plugins.path.join(paths.npmtsAssetsDir,"cli.js"),paths.distDir);
|
||||||
plugins.beautylog.ok("installed CLI assets!");
|
plugins.beautylog.ok("installed CLI assets!");
|
||||||
done.resolve(config);
|
done.resolve(config);
|
||||||
} else {
|
} else {
|
||||||
|
@ -5,7 +5,7 @@ import {npmtsOra} from "./npmts.promisechain";
|
|||||||
|
|
||||||
let removeDist = function(){
|
let removeDist = function(){
|
||||||
npmtsOra.text("cleaning " + "dist".yellow + " folder");
|
npmtsOra.text("cleaning " + "dist".yellow + " folder");
|
||||||
return plugins.smartfile.fsaction.remove(paths.distDir);
|
return plugins.smartfile.fs.remove(paths.distDir);
|
||||||
};
|
};
|
||||||
|
|
||||||
let removeTypings = function(){
|
let removeTypings = function(){
|
||||||
|
@ -1 +0,0 @@
|
|||||||
import "typings-global";
|
|
@ -4,42 +4,13 @@ import paths = require("./npmts.paths");
|
|||||||
import helpers = require("./npmts.compile.helpers");
|
import helpers = require("./npmts.compile.helpers");
|
||||||
import {npmtsOra} from "./npmts.promisechain";
|
import {npmtsOra} from "./npmts.promisechain";
|
||||||
|
|
||||||
/**
|
let promiseArray = [];
|
||||||
* handles definition to make them fit for modular use
|
let compileTs = (tsFileArrayArg:string[],tsOptionsArg = {}) => {
|
||||||
*/
|
|
||||||
let definitionHandler = function(configArg){
|
|
||||||
npmtsOra.text("now making declaration files ready");
|
|
||||||
let done = plugins.Q.defer();
|
let done = plugins.Q.defer();
|
||||||
let configTsLenght = Object.keys(configArg.ts).length;
|
|
||||||
if(configTsLenght == 0) {
|
|
||||||
plugins.beautylog.warn("No TS file and thus no definitions found!");
|
|
||||||
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("made declaration files ready!");
|
|
||||||
done.resolve(configArg)
|
|
||||||
};
|
|
||||||
},"atEnd"));
|
|
||||||
|
|
||||||
}
|
|
||||||
return done.promise;
|
|
||||||
}
|
|
||||||
|
|
||||||
let compileTs = (tsFileArrayArg,tsOptionsArg = {}) => {
|
|
||||||
let done = plugins.Q.defer();
|
|
||||||
let moduleStream = plugins.merge2({ end: false });
|
|
||||||
|
|
||||||
let tsOptionsDefault = {
|
let tsOptionsDefault = {
|
||||||
declaration: true,
|
declaration: true,
|
||||||
target: "ES5",
|
target: "ES6",
|
||||||
module: "commonjs"
|
module: "commonjs"
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -50,22 +21,23 @@ let compileTs = (tsFileArrayArg,tsOptionsArg = {}) => {
|
|||||||
return plugins.lodashObject.assign(tsOptionsDefault, tsOptionsArg)
|
return plugins.lodashObject.assign(tsOptionsDefault, tsOptionsArg)
|
||||||
};
|
};
|
||||||
for (let keyArg in tsFileArrayArg) {
|
for (let keyArg in tsFileArrayArg) {
|
||||||
|
plugins.beautylog.info(`TypeScript assignment: transpile from ${keyArg.blue} to ${tsFileArrayArg[keyArg].blue}`);
|
||||||
if (helpers.checkOutputPath(tsFileArrayArg,keyArg)) {
|
if (helpers.checkOutputPath(tsFileArrayArg,keyArg)) {
|
||||||
let tsStream = plugins.gulp.src([plugins.path.join(paths.cwd, keyArg), "!**/typings/**"])
|
let filesReadPromise = plugins.smartfile.fs.listFileTree(process.cwd(),keyArg)
|
||||||
.pipe(plugins.g.sourcemaps.init()) // This means sourcemaps will be generated
|
.then((filesToConvertArg) => {
|
||||||
.pipe(plugins.g.typescript(tsOptions(keyArg)));
|
let filesToConvertAbsolute = plugins.smartpath.transform.toAbsolute(filesToConvertArg,process.cwd());
|
||||||
|
let destDir = plugins.smartpath.transform.toAbsolute(tsFileArrayArg[keyArg],process.cwd());
|
||||||
let jsStream = tsStream.js
|
let filesCompiledPromise = plugins.tsn.compile(
|
||||||
.pipe(plugins.g.sourcemaps.write()) // Now the sourcemaps are added to the .js file
|
filesToConvertAbsolute,
|
||||||
.pipe(plugins.gulp.dest(tsFileArrayArg[keyArg]));
|
destDir
|
||||||
let declarationStream = tsStream.dts
|
);
|
||||||
.pipe(plugins.gulp.dest(tsFileArrayArg[keyArg]));
|
promiseArray.push(filesCompiledPromise);
|
||||||
moduleStream.add(tsStream,jsStream,declarationStream);
|
});
|
||||||
|
promiseArray.push(filesReadPromise);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
moduleStream.on("queueDrain",() => {
|
plugins.Q.all(promiseArray)
|
||||||
done.resolve();
|
.then(done.resolve);
|
||||||
})
|
|
||||||
return done.promise;
|
return done.promise;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,18 +49,13 @@ export let run = function (configArg) {
|
|||||||
|
|
||||||
compileTs(config.ts,config.tsOptions)
|
compileTs(config.ts,config.tsOptions)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
compileTs(config.testTs);
|
plugins.beautylog.ok("compiled main TypeScript!");
|
||||||
|
plugins.beautylog.log("now compiling tests!");
|
||||||
|
return compileTs(config.testTs);
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
plugins.beautylog.ok("compiled TypeScript!");
|
plugins.beautylog.ok("compiled all TypeScript!");
|
||||||
definitionHandler(config)
|
done.resolve(config);
|
||||||
.then(function(){
|
|
||||||
done.resolve(config);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
/*==================== END TS Compilation =====================*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return done.promise;
|
return done.promise;
|
||||||
};
|
};
|
||||||
|
@ -8,9 +8,12 @@ export var run = function(argvArg){
|
|||||||
if(argvArg.notest){
|
if(argvArg.notest){
|
||||||
config.notest = true;
|
config.notest = true;
|
||||||
}
|
}
|
||||||
if(plugins.smartfile.checks.fileExistsSync(configPath)){
|
if(plugins.smartfile.fs.fileExistsSync(configPath)){
|
||||||
plugins.beautylog.info("npmts.json".blue + " config file found!");
|
plugins.beautylog.info("npmts.json".blue + " config file found!");
|
||||||
config = plugins.smartfile.local.toObjectSync(configPath);
|
config = plugins.lodashObject.assign(
|
||||||
|
config,
|
||||||
|
plugins.smartfile.fs.toObjectSync(configPath)
|
||||||
|
);
|
||||||
switch (config.mode){
|
switch (config.mode){
|
||||||
case "default":
|
case "default":
|
||||||
case "custom":
|
case "custom":
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
import "typings-global";
|
|
||||||
import plugins = require("./npmts.plugins");
|
|
||||||
import paths = require("./npmts.paths");
|
|
||||||
import {npmtsOra} from "./npmts.promisechain";
|
|
||||||
|
|
||||||
export var run = function(configArg){
|
|
||||||
var config = configArg;
|
|
||||||
var done = plugins.Q.defer();
|
|
||||||
/* -------------------------------------------------
|
|
||||||
* ----------- install typings ---------------
|
|
||||||
* ----------------------------------------------- */
|
|
||||||
npmtsOra.text("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 installed!");
|
|
||||||
done.resolve(config);
|
|
||||||
},"atEnd"));
|
|
||||||
return done.promise;
|
|
||||||
};
|
|
@ -1,30 +0,0 @@
|
|||||||
import "typings-global";
|
|
||||||
import plugins = require("./npmts.plugins");
|
|
||||||
import paths = require("./npmts.paths");
|
|
||||||
import {npmtsOra} from "./npmts.promisechain";
|
|
||||||
|
|
||||||
let genJsdoc = function(configArg){
|
|
||||||
let done = plugins.Q.defer();
|
|
||||||
npmtsOra.text("now generating " + "JsDoc documentation".yellow);
|
|
||||||
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 run = function(configArg){
|
|
||||||
let done = plugins.Q.defer();
|
|
||||||
genJsdoc(configArg)
|
|
||||||
.then(done.resolve);
|
|
||||||
return done.promise;
|
|
||||||
};
|
|
@ -1,24 +1,23 @@
|
|||||||
import "typings-global";
|
import "typings-global";
|
||||||
export import beautylog = require("beautylog");
|
export import beautylog = require("beautylog");
|
||||||
export let fs = require("fs-extra");
|
|
||||||
export let gulp = require("gulp");
|
export let gulp = require("gulp");
|
||||||
export let g = {
|
export let g = {
|
||||||
gFunction: require("gulp-function"),
|
babel: require("gulp-babel"),
|
||||||
istanbul: require("gulp-istanbul"),
|
istanbul: require("gulp-istanbul"),
|
||||||
jsdoc3: require("gulp-jsdoc3"),
|
gFunction: require("gulp-function"),
|
||||||
|
injectModules: require("gulp-inject-modules"),
|
||||||
mocha: require("gulp-mocha"),
|
mocha: require("gulp-mocha"),
|
||||||
replace: require("gulp-replace"),
|
replace: require("gulp-replace"),
|
||||||
sourcemaps: require("gulp-sourcemaps"),
|
sourcemaps: require("gulp-sourcemaps"),
|
||||||
typescript: require("gulp-typescript"),
|
typedoc: require("gulp-typedoc")
|
||||||
typings: require("gulp-typings")
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
import "babel-preset-es2015";
|
||||||
export let lodashObject = require('lodash/fp/object');
|
export let lodashObject = require('lodash/fp/object');
|
||||||
export let merge2 = require("merge2");
|
export let merge2 = require("merge2");
|
||||||
export import projectinfo = require("projectinfo");
|
export import projectinfo = require("projectinfo");
|
||||||
export let path = require("path");
|
export import path = require("path");
|
||||||
export let Q = require("q");
|
export import Q = require("q");
|
||||||
export let shelljs = require("shelljs");
|
export import shelljs = require("shelljs");
|
||||||
export let smartci = require("smartci");
|
export let smartci = require("smartci");
|
||||||
export import smartcli = require("smartcli");
|
export import smartcli = require("smartcli");
|
||||||
export let smartcov = require("smartcov");
|
export let smartcov = require("smartcov");
|
||||||
@ -26,4 +25,5 @@ export import smartenv = require("smartenv");
|
|||||||
export import smartfile = require("smartfile");
|
export import smartfile = require("smartfile");
|
||||||
export import smartpath = require("smartpath");
|
export import smartpath = require("smartpath");
|
||||||
export import smartstring = require("smartstring");
|
export import smartstring = require("smartstring");
|
||||||
export let sourceMapSupport = require("source-map-support").install(); // this is required to display errors correctly during testing
|
export let sourceMapSupport = require("source-map-support").install(); // this is required to display errors correctly during testing
|
||||||
|
export import tsn = require("tsn");
|
@ -1,5 +1,6 @@
|
|||||||
import "typings-global";
|
import "typings-global";
|
||||||
import plugins = require("./npmts.plugins");
|
import plugins = require("./npmts.plugins");
|
||||||
|
import {Ora} from "beautylog"
|
||||||
|
|
||||||
export let npmtsOra = new plugins.beautylog.Ora("setting up TaskChain","cyan");
|
export let npmtsOra = new plugins.beautylog.Ora("setting up TaskChain","cyan");
|
||||||
|
|
||||||
@ -7,10 +8,8 @@ import NpmtsAssets = require("./npmts.assets");
|
|||||||
import NpmtsClean = require("./npmts.clean");
|
import NpmtsClean = require("./npmts.clean");
|
||||||
import NpmtsCompile = require("./npmts.compile");
|
import NpmtsCompile = require("./npmts.compile");
|
||||||
import NpmtsConfigFile = require("./npmts.configfile");
|
import NpmtsConfigFile = require("./npmts.configfile");
|
||||||
import NpmtsInstall = require("./npmts.install");
|
import NpmtsTypeDoc = require("./npmts.typedoc");
|
||||||
import NpmtsJsdoc = require("./npmts.jsdoc");
|
|
||||||
import NpmtsOptions = require("./npmts.options");
|
import NpmtsOptions = require("./npmts.options");
|
||||||
import NpmtsPublish = require("./npmts.publish");
|
|
||||||
import NpmtsTests = require("./npmts.tests");
|
import NpmtsTests = require("./npmts.tests");
|
||||||
|
|
||||||
export let promisechain = function(argvArg){
|
export let promisechain = function(argvArg){
|
||||||
@ -19,12 +18,10 @@ export let promisechain = function(argvArg){
|
|||||||
NpmtsConfigFile.run(argvArg)
|
NpmtsConfigFile.run(argvArg)
|
||||||
.then(NpmtsOptions.run)
|
.then(NpmtsOptions.run)
|
||||||
.then(NpmtsClean.run)
|
.then(NpmtsClean.run)
|
||||||
.then(NpmtsInstall.run)
|
|
||||||
.then(NpmtsCompile.run)
|
.then(NpmtsCompile.run)
|
||||||
.then(NpmtsAssets.run)
|
.then(NpmtsAssets.run)
|
||||||
.then(NpmtsJsdoc.run)
|
.then(NpmtsTypeDoc.run)
|
||||||
.then(NpmtsTests.run)
|
.then(NpmtsTests.run)
|
||||||
.then(NpmtsPublish.run)
|
|
||||||
.then(function(configArg){
|
.then(function(configArg){
|
||||||
let shipString = "" +
|
let shipString = "" +
|
||||||
"\n" +
|
"\n" +
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
import "typings-global";
|
|
||||||
import plugins = require("./npmts.plugins");
|
|
||||||
import paths = require("./npmts.paths");
|
|
||||||
import NpmtsJsdoc = require("./npmts.jsdoc");
|
|
||||||
|
|
||||||
export let run = function(configArg){
|
|
||||||
let done = plugins.Q.defer();
|
|
||||||
let config = configArg;
|
|
||||||
done.resolve();
|
|
||||||
return done.promise;
|
|
||||||
};
|
|
@ -7,33 +7,31 @@ import {npmtsOra} from "./npmts.promisechain";
|
|||||||
*
|
*
|
||||||
* @returns {*}
|
* @returns {*}
|
||||||
*/
|
*/
|
||||||
let istanbul = function (configArg) {
|
let mocha = function (configArg) {
|
||||||
npmtsOra.text("Instrumentalizing transpiled JS...");
|
npmtsOra.text("Instrumentalizing and testing transpiled JS");
|
||||||
|
npmtsOra.end(); // end npmtsOra for tests.
|
||||||
let done = plugins.Q.defer();
|
let done = plugins.Q.defer();
|
||||||
var stream = plugins.gulp.src([plugins.path.join(paths.cwd,"dist/*.js")])
|
var stream = plugins.gulp.src([plugins.path.join(paths.cwd,"dist/*.js")])
|
||||||
.pipe(plugins.g.istanbul()) // Covering files
|
.pipe(plugins.g.sourcemaps.init())
|
||||||
.pipe(plugins.g.istanbul.hookRequire()) // Force `require` to return covered files
|
.pipe(plugins.g.babel({
|
||||||
.pipe(plugins.g.gFunction(function(){
|
presets: ['es2015']
|
||||||
plugins.beautylog.ok("JS has been instrumentalized to get test code coverage!");
|
}))
|
||||||
done.resolve(configArg);
|
.pipe(plugins.g.istanbul())
|
||||||
},"atEnd"));
|
.pipe(plugins.g.sourcemaps.write())
|
||||||
return done.promise;
|
.pipe(plugins.g.injectModules())
|
||||||
};
|
.on("finish",function(){
|
||||||
|
plugins.gulp.src([plugins.path.join(paths.cwd,"test/test.js")])
|
||||||
/**
|
.pipe(plugins.g.babel({
|
||||||
*
|
presets: ['es2015']
|
||||||
* @returns {*}
|
}))
|
||||||
*/
|
.pipe(plugins.g.injectModules())
|
||||||
let mocha = function (configArg) {
|
.pipe(plugins.g.mocha())
|
||||||
let done = plugins.Q.defer();
|
.pipe(plugins.g.istanbul.writeReports())
|
||||||
npmtsOra.end(); // end npmtsOra for tests.
|
.pipe(plugins.g.gFunction(function(){
|
||||||
let stream = plugins.gulp.src(["./test/test.js"])
|
plugins.beautylog.ok("Tested!");
|
||||||
.pipe(plugins.g.mocha())
|
done.resolve(configArg);
|
||||||
.pipe(plugins.g.istanbul.writeReports()) // Creating the reports after tests ran
|
},"atEnd"));
|
||||||
.pipe(plugins.g.gFunction(function(){
|
});
|
||||||
plugins.beautylog.ok("Tests have passed!");
|
|
||||||
done.resolve(configArg);
|
|
||||||
},"atEnd"));
|
|
||||||
return done.promise;
|
return done.promise;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -62,22 +60,21 @@ let coverage = function(configArg){
|
|||||||
export let run = function(configArg) {
|
export let run = function(configArg) {
|
||||||
let done = plugins.Q.defer();
|
let done = plugins.Q.defer();
|
||||||
let config = configArg;
|
let config = configArg;
|
||||||
if(!config.notest){
|
if(config.notest != true){
|
||||||
|
npmtsOra.text("now starting tests");
|
||||||
|
plugins.beautylog.log(
|
||||||
|
"-------------------------------------------------------\n" +
|
||||||
|
"*************************** TESTS: ***************************\n" +
|
||||||
|
"--------------------------------------------------------------"
|
||||||
|
);
|
||||||
|
|
||||||
npmtsOra.text("now starting tests");
|
mocha(config)
|
||||||
plugins.beautylog.log(
|
.then(coverage)
|
||||||
"-------------------------------------------------------\n" +
|
.then(() => {
|
||||||
"*************************** TESTS: ***************************\n" +
|
done.resolve(config);
|
||||||
"--------------------------------------------------------------"
|
});
|
||||||
);
|
|
||||||
|
|
||||||
istanbul(config)
|
|
||||||
.then(mocha)
|
|
||||||
.then(coverage)
|
|
||||||
.then(() => {
|
|
||||||
done.resolve(config);
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
|
npmtsOra.end();
|
||||||
done.resolve(config);
|
done.resolve(config);
|
||||||
}
|
}
|
||||||
return done.promise;
|
return done.promise;
|
||||||
|
40
ts/npmts.typedoc.ts
Normal file
40
ts/npmts.typedoc.ts
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
import "typings-global";
|
||||||
|
import plugins = require("./npmts.plugins");
|
||||||
|
import paths = require("./npmts.paths");
|
||||||
|
import {npmtsOra} from "./npmts.promisechain";
|
||||||
|
|
||||||
|
let genTypeDoc = function(configArg){
|
||||||
|
let done = plugins.Q.defer();
|
||||||
|
npmtsOra.text("now generating " + "TypeDoc documentation".yellow);
|
||||||
|
plugins.beautylog.log("TypeDoc Output:");
|
||||||
|
plugins.gulp.src(plugins.path.join(paths.tsDir,"**/*.ts"))
|
||||||
|
.pipe(plugins.g.typedoc({
|
||||||
|
// TypeScript options (see typescript docs)
|
||||||
|
module: "commonjs",
|
||||||
|
target: "es6",
|
||||||
|
includeDeclarations: true,
|
||||||
|
|
||||||
|
// Output options (see typedoc docs)
|
||||||
|
out: paths.docsDir,
|
||||||
|
json: plugins.path.join(paths.docsDir,"file.json"),
|
||||||
|
|
||||||
|
// TypeDoc options (see typedoc docs)
|
||||||
|
name: "my-project",
|
||||||
|
|
||||||
|
//theme: "default",
|
||||||
|
ignoreCompilerErrors: true,
|
||||||
|
version: true,
|
||||||
|
}))
|
||||||
|
.pipe(plugins.g.gFunction(done.resolve,"atEnd"));
|
||||||
|
return done.promise;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
export let run = function(configArg){
|
||||||
|
let done = plugins.Q.defer();
|
||||||
|
genTypeDoc(configArg)
|
||||||
|
.then(() => {
|
||||||
|
done.resolve(configArg);
|
||||||
|
});
|
||||||
|
return done.promise;
|
||||||
|
};
|
@ -1,8 +0,0 @@
|
|||||||
{
|
|
||||||
"globalDependencies": {
|
|
||||||
"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"
|
|
||||||
}
|
|
||||||
}
|
|
8
tsconfig.json
Normal file
8
tsconfig.json
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"declaration": true,
|
||||||
|
"module": "commonjs",
|
||||||
|
"target": "ES5",
|
||||||
|
"outDir": "./dist/"
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user