Compare commits
46 Commits
Author | SHA1 | Date | |
---|---|---|---|
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 | |||
71f8d14ee9 | |||
d539aef414 | |||
a1146e4c79 | |||
6e053fc4c6 | |||
2dffae4872 |
6
.gitignore
vendored
6
.gitignore
vendored
@ -1,3 +1,7 @@
|
||||
.idea/
|
||||
.c9/
|
||||
node_modules/
|
||||
node_modules/
|
||||
test/**/node_modules/
|
||||
test/**/typings/
|
||||
ts/*.js
|
||||
ts/*.js.map
|
@ -1,5 +1,6 @@
|
||||
.idea/
|
||||
support
|
||||
compile
|
||||
test
|
||||
test/
|
||||
examples
|
||||
.gitignore
|
11
.travis.yml
Normal file
11
.travis.yml
Normal file
@ -0,0 +1,11 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "4.2.4"
|
||||
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
|
1
README-dev.md
Normal file
1
README-dev.md
Normal file
@ -0,0 +1 @@
|
||||
# README-dev
|
45
README.md
Normal file
45
README.md
Normal file
@ -0,0 +1,45 @@
|
||||
# npmts
|
||||
Write npm modules with TypeScript without hassle.
|
||||
|
||||
## How to use npmts
|
||||
|
||||
### 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 behaviour
|
||||
by default npmts looks for `./ts/index.ts` and `./ts/test.ts` that will compile to
|
||||
`./index.js` and `./test.js`
|
||||
|
||||
#### Declaration files
|
||||
**npmts** also creates an `index.d.ts` declaration file by default.
|
||||
You can reference it in your package.json like this:
|
||||
|
||||
```json
|
||||
"main": "index.js",
|
||||
"typings": "./index.d.ts",
|
||||
```
|
||||
|
||||
When requiring the module from other TypeScript files,
|
||||
the TypeScript Compiler will use the declaration file to resolve typings.
|
||||
|
||||
|
||||
|
||||
### Custom behaviour
|
||||
We are currently building support for custom behaviour with a super simple config file.
|
||||
Check back soon.
|
||||
|
||||
## Readme for Devs
|
||||
There is a [README-dev.md](README-dev.md) in the repo.
|
||||
This is only of interest for you when looking to contribute to, improve or build upon this package.
|
@ -1,23 +1,35 @@
|
||||
// import gulp
|
||||
var gulp = require("gulp");
|
||||
var gulpTypescript = require("gulp-typescript");
|
||||
var plugins = {
|
||||
beautylog: require("beautylog")
|
||||
beautylog: require("beautylog"),
|
||||
gulp: require("gulp"),
|
||||
g:{
|
||||
typescript: require("gulp-typescript"),
|
||||
insert: require("gulp-insert")
|
||||
},
|
||||
mergeStream: require("merge2")
|
||||
|
||||
};
|
||||
|
||||
plugins.beautylog.log('now compiling the mojo.io gulp tasks');
|
||||
|
||||
gulp.task('indexTS', function() {
|
||||
var stream = gulp.src('../ts/index.ts')
|
||||
.pipe(gulpTypescript({
|
||||
out: "index.js"
|
||||
}))
|
||||
.pipe(gulp.dest("../"));
|
||||
return stream;
|
||||
plugins.beautylog.log('now compiling NPMTS');
|
||||
|
||||
plugins.gulp.task('indexTS', function() {
|
||||
var tsResult = plugins.gulp.src('../ts/index.ts')
|
||||
.pipe(plugins.g.typescript({
|
||||
out:"index.js",
|
||||
declaration:true
|
||||
}));
|
||||
|
||||
return plugins.mergeStream([
|
||||
tsResult.dts.pipe(plugins.gulp.dest('../')),
|
||||
tsResult.js
|
||||
.pipe(plugins.g.insert.prepend('#!/usr/bin/env node\n\n'))
|
||||
.pipe(plugins.gulp.dest('../'))
|
||||
]);
|
||||
});
|
||||
|
||||
gulp.task('default',['indexTS'], function() {
|
||||
plugins.gulp.task('default',['indexTS'], function() {
|
||||
plugins.beautylog.success('Typescript compiled');
|
||||
});
|
||||
|
||||
gulp.start.apply(gulp, ['default']);
|
||||
plugins.gulp.start.apply(plugins.gulp, ['default']);
|
55
index.d.ts
vendored
Normal file
55
index.d.ts
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
/// <reference path="../ts/typings/main.d.ts" />
|
||||
declare module NpmtsPlugins {
|
||||
var init: () => {
|
||||
beautylog: any;
|
||||
fs: any;
|
||||
gulp: any;
|
||||
g: {
|
||||
insert: any;
|
||||
sequence: any;
|
||||
typescript: any;
|
||||
};
|
||||
mergeStream: any;
|
||||
mocha: any;
|
||||
path: any;
|
||||
q: any;
|
||||
smartcli: any;
|
||||
typings: any;
|
||||
};
|
||||
}
|
||||
declare module NpmtsPaths {
|
||||
var init: () => any;
|
||||
}
|
||||
declare module NpmtsOptions {
|
||||
var run: () => any;
|
||||
}
|
||||
declare module NpmtsTypings {
|
||||
var run: () => any;
|
||||
}
|
||||
declare module NpmtsDefault {
|
||||
var run: () => any;
|
||||
}
|
||||
declare module NpmtsTests {
|
||||
var run: () => any;
|
||||
}
|
||||
declare module NpmtsPromisechain {
|
||||
var init: () => any;
|
||||
}
|
||||
declare var plugins: {
|
||||
beautylog: any;
|
||||
fs: any;
|
||||
gulp: any;
|
||||
g: {
|
||||
insert: any;
|
||||
sequence: any;
|
||||
typescript: any;
|
||||
};
|
||||
mergeStream: any;
|
||||
mocha: any;
|
||||
path: any;
|
||||
q: any;
|
||||
smartcli: any;
|
||||
typings: any;
|
||||
};
|
||||
declare var paths: any;
|
||||
declare var promisechain: any;
|
171
index.js
171
index.js
@ -1,26 +1,145 @@
|
||||
/// <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;
|
||||
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));
|
||||
});
|
||||
#!/usr/bin/env node
|
||||
|
||||
/// <reference path="./index.ts" />
|
||||
var NpmtsPlugins;
|
||||
(function (NpmtsPlugins) {
|
||||
NpmtsPlugins.init = function () {
|
||||
var plugins = {
|
||||
beautylog: require("beautylog"),
|
||||
fs: require("fs-extra"),
|
||||
gulp: require("gulp"),
|
||||
g: {
|
||||
insert: require("gulp-insert"),
|
||||
sequence: require("gulp-sequence"),
|
||||
typescript: require("gulp-typescript")
|
||||
},
|
||||
mergeStream: require("merge2"),
|
||||
mocha: require("mocha"),
|
||||
path: require("path"),
|
||||
q: require("q"),
|
||||
smartcli: require("smartcli"),
|
||||
typings: require("typings")
|
||||
};
|
||||
return plugins;
|
||||
};
|
||||
})(NpmtsPlugins || (NpmtsPlugins = {}));
|
||||
/// <reference path="./index.ts" />
|
||||
/// <reference path="./index.ts" />
|
||||
var NpmtsPaths;
|
||||
(function (NpmtsPaths) {
|
||||
NpmtsPaths.init = function () {
|
||||
var paths = {};
|
||||
paths.cwd = plugins.smartcli.get.cwd().path;
|
||||
paths.tsDir = plugins.path.join(paths.cwd, "ts/");
|
||||
paths.indexTS = plugins.path.join(paths.cwd, "ts/index.ts");
|
||||
paths.testTS = plugins.path.join(paths.cwd, "ts/test.ts");
|
||||
paths.testDir = plugins.path.join(paths.cwd, "test/");
|
||||
return paths;
|
||||
};
|
||||
})(NpmtsPaths || (NpmtsPaths = {}));
|
||||
/// <reference path="./index.ts" />
|
||||
var NpmtsOptions;
|
||||
(function (NpmtsOptions) {
|
||||
NpmtsOptions.run = function () {
|
||||
var done = plugins.q.defer();
|
||||
done.resolve(); //TODO: check for options
|
||||
return done.promise;
|
||||
};
|
||||
})(NpmtsOptions || (NpmtsOptions = {}));
|
||||
/// <reference path="./index.ts" />
|
||||
var NpmtsTypings;
|
||||
(function (NpmtsTypings) {
|
||||
NpmtsTypings.run = function () {
|
||||
var done = plugins.q.defer();
|
||||
plugins.beautylog.log("now installing typings");
|
||||
plugins.typings.install({ production: false, cwd: paths.tsDir })
|
||||
.then(function () {
|
||||
done.resolve();
|
||||
});
|
||||
return done.promise;
|
||||
};
|
||||
})(NpmtsTypings || (NpmtsTypings = {}));
|
||||
/// <reference path="./index.ts" />
|
||||
/// <reference path="./index.ts" />
|
||||
var NpmtsDefault;
|
||||
(function (NpmtsDefault) {
|
||||
NpmtsDefault.run = function () {
|
||||
var done = plugins.q.defer();
|
||||
plugins.gulp.task("defaultIndexTS", function () {
|
||||
plugins.beautylog.log("now compiling" + " ts/index.ts".blue);
|
||||
var tsResult = plugins.gulp.src(paths.indexTS)
|
||||
.pipe(plugins.g.typescript({
|
||||
out: "index.js",
|
||||
declaration: true
|
||||
}));
|
||||
return plugins.mergeStream([
|
||||
tsResult.dts.pipe(plugins.gulp.dest(paths.cwd)),
|
||||
tsResult.js
|
||||
.pipe(plugins.g.insert.prepend('#!/usr/bin/env node\n\n'))
|
||||
.pipe(plugins.gulp.dest(paths.cwd))
|
||||
]);
|
||||
});
|
||||
plugins.gulp.task("defaultTestTS", function () {
|
||||
plugins.beautylog.log("now compiling" + " ts/test.ts".blue);
|
||||
var stream = plugins.gulp.src(paths.testTS)
|
||||
.pipe(plugins.g.typescript({
|
||||
out: "test.js"
|
||||
}))
|
||||
.pipe(plugins.gulp.dest(paths.testDir));
|
||||
return stream;
|
||||
});
|
||||
plugins.gulp.task("defaultCleanup", function (cb) {
|
||||
plugins.beautylog.success("TypeScript for this module compiled successfully.");
|
||||
done.resolve();
|
||||
cb();
|
||||
});
|
||||
plugins.gulp.task("default", function (cb) {
|
||||
plugins.g.sequence("defaultIndexTS", "defaultTestTS", "defaultCleanup", cb);
|
||||
});
|
||||
plugins.gulp.start.apply(plugins.gulp, ['default']);
|
||||
return done.promise;
|
||||
};
|
||||
})(NpmtsDefault || (NpmtsDefault = {}));
|
||||
/// <reference path="./index.ts" />
|
||||
var NpmtsTests;
|
||||
(function (NpmtsTests) {
|
||||
NpmtsTests.run = function () {
|
||||
var done = plugins.q.defer();
|
||||
plugins.fs.ensureDirSync(paths.testDir); //make sure that mocha has a directory to look for tests
|
||||
plugins.beautylog.info("Now running mocha tests");
|
||||
var mocha = new plugins.mocha(); // Instantiate a Mocha instance.
|
||||
mocha.addFile(plugins.path.join(paths.testDir, "test.js"));
|
||||
mocha.run(function (failures) {
|
||||
process.on('exit', function () {
|
||||
process.exit(failures);
|
||||
});
|
||||
});
|
||||
return done.promise;
|
||||
};
|
||||
})(NpmtsTests || (NpmtsTests = {}));
|
||||
/// <reference path="./index.ts" />
|
||||
var NpmtsPromisechain;
|
||||
(function (NpmtsPromisechain) {
|
||||
NpmtsPromisechain.init = function () {
|
||||
var promisechain;
|
||||
NpmtsOptions.run()
|
||||
.then(NpmtsTypings.run)
|
||||
.then(NpmtsDefault.run)
|
||||
.then(NpmtsTests.run);
|
||||
return promisechain;
|
||||
};
|
||||
})(NpmtsPromisechain || (NpmtsPromisechain = {}));
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
/// <reference path="./npmts.plugins.ts" />
|
||||
/// <reference path="./npmts.cli.ts" />
|
||||
/// <reference path="./npmts.paths.ts" />
|
||||
/// <reference path="./npmts.options.ts" />
|
||||
/// <reference path="./npmts.typings.ts" />
|
||||
/// <reference path="./npmts.custom.ts" />
|
||||
/// <reference path="./npmts.default.ts" />
|
||||
/// <reference path="./npmts.tests.ts" />
|
||||
/// <reference path="./npmts.promisechain.ts" />
|
||||
console.log("**** starting NPMTS ****");
|
||||
var plugins = NpmtsPlugins.init();
|
||||
var paths = NpmtsPaths.init();
|
||||
var promisechain = NpmtsPromisechain.init();
|
||||
|
25
package.json
25
package.json
@ -1,13 +1,16 @@
|
||||
{
|
||||
"name": "npmts",
|
||||
"version": "0.0.1",
|
||||
"version": "2.0.2",
|
||||
"description": "write npm modules with TypeScript",
|
||||
"main": "index.js",
|
||||
"typings": "./index.d.ts",
|
||||
"bin": {
|
||||
"npmts": "index.js"
|
||||
"npmts": "./index.js"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "(cd compile && node compile.js)"
|
||||
"test": "(cd compile && node compile.js)",
|
||||
"testm": "(npm test) && (cd test/assets && node ../../index.js)",
|
||||
"release": "(git add -A && git commit -m 'update' && git push origin master && npm version patch && npm publish)"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -24,9 +27,17 @@
|
||||
},
|
||||
"homepage": "https://github.com/pushrocks/npmts#readme",
|
||||
"dependencies": {
|
||||
"beautylog": "^2.0.2",
|
||||
"gulp": "^3.9.0",
|
||||
"gulp-typescript": "^2.10.0",
|
||||
"smartcli": "0.0.11"
|
||||
"beautylog": "2.0.2",
|
||||
"fs-extra": "^0.26.5",
|
||||
"gulp": "3.9.0",
|
||||
"gulp-insert": "0.5.0",
|
||||
"gulp-sequence": "^0.4.4",
|
||||
"gulp-typescript": "2.10.0",
|
||||
"gulp-typings": "0.0.0",
|
||||
"merge2": "0.3.6",
|
||||
"mocha": "^2.4.5",
|
||||
"q": "^1.4.1",
|
||||
"smartcli": "0.0.11",
|
||||
"typings": "^0.6.3"
|
||||
}
|
||||
}
|
||||
|
0
test/assets/index.d.ts
vendored
Normal file
0
test/assets/index.d.ts
vendored
Normal file
5
test/assets/index.js
Normal file
5
test/assets/index.js
Normal file
@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
(function () {
|
||||
console.log("test");
|
||||
}());
|
@ -9,6 +9,5 @@
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"npmts": "*"
|
||||
}
|
||||
}
|
1
test/assets/test/test.js
Normal file
1
test/assets/test/test.js
Normal file
@ -0,0 +1 @@
|
||||
console.log("**** starting test ****");
|
4
test/assets/ts/index.js
Normal file
4
test/assets/ts/index.js
Normal file
@ -0,0 +1,4 @@
|
||||
(function () {
|
||||
console.log("test");
|
||||
}());
|
||||
//# 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,CAAC;IACG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;AACvB,CAAC,EAAE,CAAC,CAAC"}
|
2
test/assets/ts/test.js
Normal file
2
test/assets/ts/test.js
Normal file
@ -0,0 +1,2 @@
|
||||
console.log("**** starting test ****");
|
||||
//# sourceMappingURL=test.js.map
|
1
test/assets/ts/test.js.map
Normal file
1
test/assets/ts/test.js.map
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC"}
|
1
test/assets/ts/test.ts
Normal file
1
test/assets/ts/test.ts
Normal file
@ -0,0 +1 @@
|
||||
console.log("**** starting test ****");
|
7
test/assets/ts/typings.json
Normal file
7
test/assets/ts/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"
|
||||
}
|
||||
}
|
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.
|
31
test/node_modules/npmts/package.json
generated
vendored
31
test/node_modules/npmts/package.json
generated
vendored
@ -1,31 +0,0 @@
|
||||
{
|
||||
"name": "npmts",
|
||||
"version": "0.0.0",
|
||||
"description": "write npm modules with TypeScript",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "npmts"
|
||||
},
|
||||
"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",
|
||||
"gitHead": "1699d259b46348a712c638a4fc76a2579e0ecfd9",
|
||||
"readme": "ERROR: No README data found!",
|
||||
"_id": "npmts@0.0.0",
|
||||
"_shasum": "9baf3fb8c432625908c5f6a545e93e95ea0bd2c4",
|
||||
"_from": "npmts@latest"
|
||||
}
|
27
ts/index.js
27
ts/index.js
@ -1,27 +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;
|
||||
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,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"}
|
43
ts/index.ts
43
ts/index.ts
@ -1,29 +1,14 @@
|
||||
/// <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:any = {};
|
||||
paths.cwd = plugins.smartcli.get.cwd().path;
|
||||
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))
|
||||
});
|
||||
/// <reference path="./typings/main.d.ts" />
|
||||
/// <reference path="./npmts.plugins.ts" />
|
||||
/// <reference path="./npmts.cli.ts" />
|
||||
/// <reference path="./npmts.paths.ts" />
|
||||
/// <reference path="./npmts.options.ts" />
|
||||
/// <reference path="./npmts.typings.ts" />
|
||||
/// <reference path="./npmts.custom.ts" />
|
||||
/// <reference path="./npmts.default.ts" />
|
||||
/// <reference path="./npmts.tests.ts" />
|
||||
/// <reference path="./npmts.promisechain.ts" />
|
||||
console.log("**** starting NPMTS ****")
|
||||
var plugins = NpmtsPlugins.init();
|
||||
var paths = NpmtsPaths.init();
|
||||
var promisechain = NpmtsPromisechain.init();
|
||||
|
1
ts/npmts.cli.ts
Normal file
1
ts/npmts.cli.ts
Normal file
@ -0,0 +1 @@
|
||||
/// <reference path="./index.ts" />
|
1
ts/npmts.custom.ts
Normal file
1
ts/npmts.custom.ts
Normal file
@ -0,0 +1 @@
|
||||
/// <reference path="./index.ts" />
|
47
ts/npmts.default.ts
Normal file
47
ts/npmts.default.ts
Normal file
@ -0,0 +1,47 @@
|
||||
/// <reference path="./index.ts" />
|
||||
|
||||
module NpmtsDefault {
|
||||
export var run = function() {
|
||||
var done = plugins.q.defer();
|
||||
|
||||
|
||||
plugins.gulp.task("defaultIndexTS", function(){
|
||||
plugins.beautylog.log("now compiling" + " ts/index.ts".blue);
|
||||
var tsResult = plugins.gulp.src(paths.indexTS)
|
||||
.pipe(plugins.g.typescript({
|
||||
out:"index.js",
|
||||
declaration:true
|
||||
}));
|
||||
|
||||
return plugins.mergeStream([
|
||||
tsResult.dts.pipe(plugins.gulp.dest(paths.cwd)),
|
||||
tsResult.js
|
||||
.pipe(plugins.g.insert.prepend('#!/usr/bin/env node\n\n'))
|
||||
.pipe(plugins.gulp.dest(paths.cwd))
|
||||
]);
|
||||
});
|
||||
|
||||
plugins.gulp.task("defaultTestTS", function(){
|
||||
plugins.beautylog.log("now compiling" + " ts/test.ts".blue);
|
||||
var stream = plugins.gulp.src(paths.testTS)
|
||||
.pipe(plugins.g.typescript({
|
||||
out: "test.js"
|
||||
}))
|
||||
.pipe(plugins.gulp.dest(paths.testDir));
|
||||
return stream;
|
||||
});
|
||||
|
||||
plugins.gulp.task("defaultCleanup",function(cb){
|
||||
plugins.beautylog.success("TypeScript for this module compiled successfully.");
|
||||
done.resolve();
|
||||
cb();
|
||||
});
|
||||
|
||||
plugins.gulp.task("default",function(cb){
|
||||
plugins.g.sequence("defaultIndexTS","defaultTestTS","defaultCleanup",cb);
|
||||
});
|
||||
|
||||
plugins.gulp.start.apply(plugins.gulp, ['default']);
|
||||
return done.promise;
|
||||
}
|
||||
}
|
8
ts/npmts.options.ts
Normal file
8
ts/npmts.options.ts
Normal file
@ -0,0 +1,8 @@
|
||||
/// <reference path="./index.ts" />
|
||||
module NpmtsOptions {
|
||||
export var run = function(){
|
||||
var done = plugins.q.defer();
|
||||
done.resolve(); //TODO: check for options
|
||||
return done.promise;
|
||||
}
|
||||
}
|
12
ts/npmts.paths.ts
Normal file
12
ts/npmts.paths.ts
Normal file
@ -0,0 +1,12 @@
|
||||
/// <reference path="./index.ts" />
|
||||
module NpmtsPaths {
|
||||
export var init = function() {
|
||||
var paths:any = {};
|
||||
paths.cwd = plugins.smartcli.get.cwd().path;
|
||||
paths.tsDir = plugins.path.join(paths.cwd,"ts/");
|
||||
paths.indexTS = plugins.path.join(paths.cwd,"ts/index.ts");
|
||||
paths.testTS = plugins.path.join(paths.cwd,"ts/test.ts");
|
||||
paths.testDir = plugins.path.join(paths.cwd,"test/");
|
||||
return paths;
|
||||
}
|
||||
}
|
23
ts/npmts.plugins.ts
Normal file
23
ts/npmts.plugins.ts
Normal file
@ -0,0 +1,23 @@
|
||||
/// <reference path="./index.ts" />
|
||||
module NpmtsPlugins {
|
||||
export var init = function() {
|
||||
var plugins = {
|
||||
beautylog: require("beautylog"),
|
||||
fs: require("fs-extra"),
|
||||
gulp: require("gulp"),
|
||||
g: {
|
||||
insert: require("gulp-insert"),
|
||||
sequence: require("gulp-sequence"),
|
||||
typescript: require("gulp-typescript")
|
||||
|
||||
},
|
||||
mergeStream: require("merge2"),
|
||||
mocha: require("mocha"),
|
||||
path: require("path"),
|
||||
q:require("q"),
|
||||
smartcli: require("smartcli"),
|
||||
typings: require("typings")
|
||||
};
|
||||
return plugins;
|
||||
}
|
||||
}
|
11
ts/npmts.promisechain.ts
Normal file
11
ts/npmts.promisechain.ts
Normal file
@ -0,0 +1,11 @@
|
||||
/// <reference path="./index.ts" />
|
||||
module NpmtsPromisechain {
|
||||
export var init = function(){
|
||||
var promisechain;
|
||||
NpmtsOptions.run()
|
||||
.then(NpmtsTypings.run)
|
||||
.then(NpmtsDefault.run)
|
||||
.then(NpmtsTests.run);
|
||||
return promisechain;
|
||||
}
|
||||
}
|
19
ts/npmts.tests.ts
Normal file
19
ts/npmts.tests.ts
Normal file
@ -0,0 +1,19 @@
|
||||
/// <reference path="./index.ts" />
|
||||
module NpmtsTests {
|
||||
export var run = function() {
|
||||
var done = plugins.q.defer();
|
||||
plugins.fs.ensureDirSync(paths.testDir); //make sure that mocha has a directory to look for tests
|
||||
plugins.beautylog.info("Now running mocha tests");
|
||||
|
||||
var mocha = new plugins.mocha(); // Instantiate a Mocha instance.
|
||||
mocha.addFile(
|
||||
plugins.path.join(paths.testDir, "test.js")
|
||||
);
|
||||
mocha.run(function(failures){
|
||||
process.on('exit', function () {
|
||||
process.exit(failures);
|
||||
});
|
||||
});
|
||||
return done.promise;
|
||||
}
|
||||
}
|
12
ts/npmts.typings.ts
Normal file
12
ts/npmts.typings.ts
Normal file
@ -0,0 +1,12 @@
|
||||
/// <reference path="./index.ts" />
|
||||
module NpmtsTypings {
|
||||
export var run = function(){
|
||||
var done = plugins.q.defer();
|
||||
plugins.beautylog.log("now installing typings");
|
||||
plugins.typings.install({production: false, cwd: paths.tsDir})
|
||||
.then(function(){
|
||||
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"
|
||||
}
|
||||
}
|
||||
}
|
7
ts/typings.json
Normal file
7
ts/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
ts/typings/browser.d.ts
vendored
Normal file
3
ts/typings/browser.d.ts
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
/// <reference path="browser/ambient/colors/colors.d.ts" />
|
||||
/// <reference path="browser/ambient/node/node.d.ts" />
|
||||
/// <reference path="browser/ambient/vinyl/vinyl.d.ts" />
|
@ -1,3 +1,5 @@
|
||||
// Compiled using typings@0.6.3
|
||||
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/09e37435ffb2c56a6f908081194a74756f24f99d/colors/colors.d.ts
|
||||
// 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>
|
||||
@ -120,4 +122,4 @@ interface String {
|
||||
america: string;
|
||||
trap: string;
|
||||
random: string;
|
||||
}
|
||||
}
|
@ -1,3 +1,5 @@
|
||||
// Compiled using typings@0.6.3
|
||||
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/78d36dd49b6b55b9fdfe61776a12bf05c8b07777/node/node.d.ts
|
||||
// Type definitions for Node.js v4.x
|
||||
// Project: http://nodejs.org/
|
||||
// Definitions by: Microsoft TypeScript <http://typescriptlang.org>, DefinitelyTyped <https://github.com/borisyankov/DefinitelyTyped>
|
||||
@ -2087,4 +2089,4 @@ declare module "constants" {
|
||||
export var W_OK: number;
|
||||
export var X_OK: number;
|
||||
export var UV_UDP_REUSEADDR: number;
|
||||
}
|
||||
}
|
@ -1,9 +1,10 @@
|
||||
// Compiled using typings@0.6.3
|
||||
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/78d36dd49b6b55b9fdfe61776a12bf05c8b07777/vinyl/vinyl.d.ts
|
||||
// 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' {
|
||||
|
||||
@ -106,4 +107,4 @@ declare module 'vinyl' {
|
||||
|
||||
export = File;
|
||||
|
||||
}
|
||||
}
|
3
ts/typings/main.d.ts
vendored
Normal file
3
ts/typings/main.d.ts
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
/// <reference path="main/ambient/colors/colors.d.ts" />
|
||||
/// <reference path="main/ambient/node/node.d.ts" />
|
||||
/// <reference path="main/ambient/vinyl/vinyl.d.ts" />
|
125
ts/typings/main/ambient/colors/colors.d.ts
vendored
Normal file
125
ts/typings/main/ambient/colors/colors.d.ts
vendored
Normal file
@ -0,0 +1,125 @@
|
||||
// Compiled using typings@0.6.3
|
||||
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/09e37435ffb2c56a6f908081194a74756f24f99d/colors/colors.d.ts
|
||||
// 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;
|
||||
}
|
2092
ts/typings/main/ambient/node/node.d.ts
vendored
Normal file
2092
ts/typings/main/ambient/node/node.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
110
ts/typings/main/ambient/vinyl/vinyl.d.ts
vendored
Normal file
110
ts/typings/main/ambient/vinyl/vinyl.d.ts
vendored
Normal file
@ -0,0 +1,110 @@
|
||||
// Compiled using typings@0.6.3
|
||||
// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/78d36dd49b6b55b9fdfe61776a12bf05c8b07777/vinyl/vinyl.d.ts
|
||||
// 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
|
||||
|
||||
|
||||
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;
|
||||
|
||||
}
|
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" />
|
Reference in New Issue
Block a user