now creating declaration files
This commit is contained in:
parent
d18dc73522
commit
bea8a50f0b
@ -19,13 +19,15 @@ Then use it in package.json's script section to trigger a build:
|
||||
```
|
||||
|
||||
### Default behaviour
|
||||
by default npmts looks for an `./ts/index.ts` and a `./ts/test.ts` that will compile to
|
||||
by default npmts looks for `./ts/index.ts` and `./ts/test.ts` that will compile to
|
||||
`./index.js` and `./test.js`
|
||||
|
||||
#### Declaration files
|
||||
|
||||
### 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 if are looking to improve or build upon this package.
|
||||
This is only of interest for you when looking to contribute to, improve or build upon this package.
|
@ -1,25 +1,35 @@
|
||||
// import gulp
|
||||
var gulp = require("gulp");
|
||||
var gulpTypescript = require("gulp-typescript");
|
||||
var gulpInsert = require("gulp-insert");
|
||||
var plugins = {
|
||||
beautylog: require("beautylog")
|
||||
beautylog: require("beautylog"),
|
||||
gulp: require("gulp"),
|
||||
g:{
|
||||
typescript: require("gulp-typescript"),
|
||||
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(gulpInsert.prepend('#!/usr/bin/env node\n\n'))
|
||||
.pipe(gulp.dest("../"));
|
||||
return stream;
|
||||
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']);
|
32
index.d.ts
vendored
Normal file
32
index.d.ts
vendored
Normal file
@ -0,0 +1,32 @@
|
||||
/// <reference path="../ts/typings/tsd.d.ts" />
|
||||
declare module NpmtsPlugins {
|
||||
var init: () => {
|
||||
beautylog: any;
|
||||
gulp: any;
|
||||
g: {
|
||||
typescript: any;
|
||||
insert: any;
|
||||
};
|
||||
mergeStream: any;
|
||||
path: any;
|
||||
smartcli: any;
|
||||
};
|
||||
}
|
||||
declare module NpmtsPaths {
|
||||
var init: () => any;
|
||||
}
|
||||
declare module NpmtsDefault {
|
||||
var init: () => void;
|
||||
}
|
||||
declare var plugins: {
|
||||
beautylog: any;
|
||||
gulp: any;
|
||||
g: {
|
||||
typescript: any;
|
||||
insert: any;
|
||||
};
|
||||
mergeStream: any;
|
||||
path: any;
|
||||
smartcli: any;
|
||||
};
|
||||
declare var paths: any;
|
24
index.js
24
index.js
@ -7,7 +7,11 @@ var NpmtsPlugins;
|
||||
var plugins = {
|
||||
beautylog: require("beautylog"),
|
||||
gulp: require("gulp"),
|
||||
gulpTypeScript: require("gulp-typescript"),
|
||||
g: {
|
||||
typescript: require("gulp-typescript"),
|
||||
insert: require("gulp-insert")
|
||||
},
|
||||
mergeStream: require("merge2"),
|
||||
path: require("path"),
|
||||
smartcli: require("smartcli")
|
||||
};
|
||||
@ -32,15 +36,21 @@ var NpmtsDefault;
|
||||
(function (NpmtsDefault) {
|
||||
NpmtsDefault.init = function () {
|
||||
plugins.gulp.task("indexTS", function () {
|
||||
plugins.gulp.src(paths.indexTS)
|
||||
.pipe(plugins.gulpTypeScript({
|
||||
out: "index.js"
|
||||
}))
|
||||
.pipe(plugins.gulp.dest(paths.cwd));
|
||||
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("testTS", function () {
|
||||
plugins.gulp.src(paths.testTS)
|
||||
.pipe(plugins.gulpTypeScript({
|
||||
.pipe(plugins.g.typescript({
|
||||
out: "test.js"
|
||||
}))
|
||||
.pipe(plugins.gulp.dest(paths.cwd));
|
||||
|
@ -26,10 +26,11 @@
|
||||
},
|
||||
"homepage": "https://github.com/pushrocks/npmts#readme",
|
||||
"dependencies": {
|
||||
"beautylog": "^2.0.2",
|
||||
"gulp": "^3.9.0",
|
||||
"gulp-insert": "^0.5.0",
|
||||
"gulp-typescript": "^2.10.0",
|
||||
"beautylog": "2.0.2",
|
||||
"gulp": "3.9.0",
|
||||
"gulp-insert": "0.5.0",
|
||||
"gulp-typescript": "2.10.0",
|
||||
"merge2": "0.3.6",
|
||||
"smartcli": "0.0.11"
|
||||
}
|
||||
}
|
||||
|
@ -3,15 +3,21 @@ var NpmtsDefault;
|
||||
(function (NpmtsDefault) {
|
||||
NpmtsDefault.init = function () {
|
||||
plugins.gulp.task("indexTS", function () {
|
||||
plugins.gulp.src(paths.indexTS)
|
||||
.pipe(plugins.gulpTypeScript({
|
||||
out: "index.js"
|
||||
}))
|
||||
.pipe(plugins.gulp.dest(paths.cwd));
|
||||
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("testTS", function () {
|
||||
plugins.gulp.src(paths.testTS)
|
||||
.pipe(plugins.gulpTypeScript({
|
||||
.pipe(plugins.g.typescript({
|
||||
out: "test.js"
|
||||
}))
|
||||
.pipe(plugins.gulp.dest(paths.cwd));
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"npmts.default.js","sourceRoot":"","sources":["npmts.default.ts"],"names":["NpmtsDefault"],"mappings":"AAAA,mCAAmC;AAEnC,IAAO,YAAY,CAwBlB;AAxBD,WAAO,YAAY,EAAC,CAAC;IACNA,iBAAIA,GAAGA;QACd,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACzB,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC;iBAC1B,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC;gBACzB,GAAG,EAAE,UAAU;aAClB,CAAC,CAAC;iBACF,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAA;QAC3C,CAAC,CAAC,CAAC;QAEH,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;YACxB,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC;iBACzB,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC;gBACzB,GAAG,EAAE,SAAS;aACjB,CAAC,CAAC;iBACF,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAA;QAC3C,CAAC,CAAC,CAAC;QAEH,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAC,CAAC,SAAS,EAAC,QAAQ,CA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BACzB,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC;gBACvB,GAAG,EAAE,SAAS;aACjB,CAAC,CAAC;iBACF,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAA;QAC3C,CAAC,CAAC,CAAC;QAEH,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAC,CAAC,SAAS,EAAC,QAAQ,CAAC,EAAC;YAC7C,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,uDAAuD,CAAC,CAAC;QACvF,CAAC,CAAC,CAAC;QAEH,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IACxD,CAAC,CAAAA;AACLA,CAACA,EA/BM,YAAY,KAAZ,YAAY,QA+BlB"}
|
@ -3,16 +3,23 @@
|
||||
module NpmtsDefault {
|
||||
export var init = function() {
|
||||
plugins.gulp.task("indexTS", function(){
|
||||
plugins.gulp.src(paths.indexTS)
|
||||
.pipe(plugins.gulpTypeScript({
|
||||
out: "index.js"
|
||||
}))
|
||||
.pipe(plugins.gulp.dest(paths.cwd))
|
||||
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("testTS", function(){
|
||||
plugins.gulp.src(paths.testTS)
|
||||
.pipe(plugins.gulpTypeScript({
|
||||
.pipe(plugins.g.typescript({
|
||||
out: "test.js"
|
||||
}))
|
||||
.pipe(plugins.gulp.dest(paths.cwd))
|
||||
|
@ -5,7 +5,11 @@ var NpmtsPlugins;
|
||||
var plugins = {
|
||||
beautylog: require("beautylog"),
|
||||
gulp: require("gulp"),
|
||||
gulpTypeScript: require("gulp-typescript"),
|
||||
g: {
|
||||
typescript: require("gulp-typescript"),
|
||||
insert: require("gulp-insert")
|
||||
},
|
||||
mergeStream: require("merge2"),
|
||||
path: require("path"),
|
||||
smartcli: require("smartcli")
|
||||
};
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"npmts.plugins.js","sourceRoot":"","sources":["npmts.plugins.ts"],"names":["NpmtsPlugins"],"mappings":"AAAA,mCAAmC;AACnC,IAAO,YAAY,CAWlB;AAXD,WAAO,YAAY,EAAC,CAAC;IACNA,iBAAIA,GAAGA;QACd,IAAI,OAAO,GAAG;YACV,SAAS,EAAE,OAAO,CAAC,WAAW,CAAC;YAC/B,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC;YACrB,cAAc,EAAE,OAAO,CAAC,iBAAiB,CAAC;YAC1C,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC;YACrB,QAAQ,EAAE,OAAO,CAAC,UAAU,CAAC;SAChC,CAAC;QACF,MAAM,CAAC,OAAO,CAAC;IACnB,CAAC,CAAAA;AACLA,CAACA,EAXM,YAAY,KAAZ,YAAY,QAWlB"}
|
||||
{"version":3,"file":"npmts.plugins.js","sourceRoot":"","sources":["npmts.plugins.ts"],"names":["NpmtsPlugins"],"mappings":"AAAA,mCAAmC;AACnC,IAAO,YAAY,CAelB;AAfD,WAAO,YAAY,EAAC,CAAC;IACNA,iBAAIA,GAAGA;QACd,IAAI,OAAO,GAAG;YACV,SAAS,EAAE,OAAO,CAAC,WAAW,CAAC;YAC/B,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC;YACrB,CAAC,EAAE;gBACC,UAAU,EAAE,OAAO,CAAC,iBAAiB,CAAC;gBACtC,MAAM,EAAE,OAAO,CAAC,aAAa,CAAC;aACjC;YACD,WAAW,EAAE,OAAO,CAAC,QAAQ,CAAC;YAC9B,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC;YACrB,QAAQ,EAAE,OAAO,CAAC,UAAU,CAAC;SAChC,CAAC;QACF,MAAM,CAAC,OAAO,CAAC;IACnB,CAAC,CAAAA;AACLA,CAACA,EAfM,YAAY,KAAZ,YAAY,QAelB"}
|
@ -4,7 +4,11 @@ module NpmtsPlugins {
|
||||
var plugins = {
|
||||
beautylog: require("beautylog"),
|
||||
gulp: require("gulp"),
|
||||
gulpTypeScript: require("gulp-typescript"),
|
||||
g: {
|
||||
typescript: require("gulp-typescript"),
|
||||
insert: require("gulp-insert")
|
||||
},
|
||||
mergeStream: require("merge2"),
|
||||
path: require("path"),
|
||||
smartcli: require("smartcli")
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user