add tsd handling
This commit is contained in:
parent
2a4811ccb0
commit
d12a09d3d8
2
.gitignore
vendored
2
.gitignore
vendored
@ -2,3 +2,5 @@
|
||||
.c9/
|
||||
node_modules/
|
||||
test/node_modules
|
||||
ts/*.js
|
||||
ts/*.js.map
|
@ -10,7 +10,7 @@
|
||||
"scripts": {
|
||||
"test": "(cd compile && node compile.js)",
|
||||
"release": "(git add -A && git commit -m 'update' && git push origin master && npm version patch && npm publish)",
|
||||
"testm": "(cd test/ && npm update && npm test)"
|
||||
"testm": "(cd test/ && node ../index.js)"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -30,6 +30,8 @@
|
||||
"beautylog": "2.0.2",
|
||||
"gulp": "3.9.0",
|
||||
"gulp-insert": "0.5.0",
|
||||
"gulp-sequence": "^0.4.4",
|
||||
"gulp-tsd": "^0.1.0",
|
||||
"gulp-typescript": "2.10.0",
|
||||
"merge2": "0.3.6",
|
||||
"smartcli": "0.0.11"
|
||||
|
0
test/index.d.ts
vendored
0
test/index.d.ts
vendored
@ -1,5 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
(function () {
|
||||
console.log("test");
|
||||
}());
|
10
ts/index.js
10
ts/index.js
@ -1,10 +0,0 @@
|
||||
/// <reference path="./typings/tsd.d.ts" />
|
||||
/// <reference path="./npmts.plugins.ts" />
|
||||
/// <reference path="./npmts.cli.ts" />
|
||||
/// <reference path="./npmts.paths.ts" />
|
||||
/// <reference path="./npmts.custom.ts" />
|
||||
/// <reference path="./npmts.default.ts" />
|
||||
var plugins = NpmtsPlugins.init();
|
||||
var paths = NpmtsPaths.init();
|
||||
NpmtsDefault.init();
|
||||
//# sourceMappingURL=index.js.map
|
@ -1 +0,0 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,2CAA2C;AAC3C,2CAA2C;AAC3C,uCAAuC;AACvC,yCAAyC;AACzC,0CAA0C;AAC1C,2CAA2C;AAE3C,IAAI,OAAO,GAAG,YAAY,CAAC,IAAI,EAAE,CAAC;AAClC,IAAI,KAAK,GAAG,UAAU,CAAC,IAAI,EAAE,CAAC;AAC9B,YAAY,CAAC,IAAI,EAAE,CAAC"}
|
@ -1,2 +0,0 @@
|
||||
/// <reference path="./index.ts" />
|
||||
//# sourceMappingURL=npmts.cli.js.map
|
@ -1 +0,0 @@
|
||||
{"version":3,"file":"npmts.cli.js","sourceRoot":"","sources":["npmts.cli.ts"],"names":[],"mappings":"AAAA,mCAAmC"}
|
@ -1,2 +0,0 @@
|
||||
/// <reference path="./index.ts" />
|
||||
//# sourceMappingURL=npmts.custom.js.map
|
@ -1 +0,0 @@
|
||||
{"version":3,"file":"npmts.custom.js","sourceRoot":"","sources":["npmts.custom.ts"],"names":[],"mappings":"AAAA,mCAAmC"}
|
@ -1,31 +0,0 @@
|
||||
/// <reference path="./index.ts" />
|
||||
var NpmtsDefault;
|
||||
(function (NpmtsDefault) {
|
||||
NpmtsDefault.init = function () {
|
||||
plugins.gulp.task("indexTS", function () {
|
||||
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.g.typescript({
|
||||
out: "test.js"
|
||||
}))
|
||||
.pipe(plugins.gulp.dest(paths.cwd));
|
||||
});
|
||||
plugins.gulp.task("default", ["indexTS", "testTS"], function () {
|
||||
plugins.beautylog.success("TypeScript for this module was compiled successfully.");
|
||||
});
|
||||
plugins.gulp.start.apply(plugins.gulp, ['default']);
|
||||
};
|
||||
})(NpmtsDefault || (NpmtsDefault = {}));
|
||||
//# sourceMappingURL=npmts.default.js.map
|
@ -1 +0,0 @@
|
||||
{"version":3,"file":"npmts.default.js","sourceRoot":"","sources":["npmts.default.ts"],"names":["NpmtsDefault"],"mappings":"AAAA,mCAAmC;AAEnC,IAAO,YAAY,CA+BlB;AA/BD,WAAO,YAAY,EAAC,CAAC;IACNA,iBAAIA,GAAGA;QACd,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACzB,IAAI,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC;iBACzC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC;gBACvB,GAAG,EAAC,UAAU;gBACd,WAAW,EAAC,IAAI;aACnB,CAAC,CAAC,CAAC;YAER,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC;gBACvB,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBAC/C,QAAQ,CAAC,EAAE;qBACN,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,yBAAyB,CAAC,CAAC;qBACzD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;aAC1C,CAAC,CAAC;QACP,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,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"}
|
@ -2,7 +2,15 @@
|
||||
|
||||
module NpmtsDefault {
|
||||
export var init = function() {
|
||||
plugins.gulp.task("indexTS", function(){
|
||||
plugins.gulp.task("defaultTsd",function(cb){
|
||||
plugins.g.tsd({
|
||||
command: 'reinstall',
|
||||
config: paths.tsd
|
||||
}, cb);
|
||||
});
|
||||
|
||||
|
||||
plugins.gulp.task("defaultIndexTS", function(){
|
||||
var tsResult = plugins.gulp.src(paths.indexTS)
|
||||
.pipe(plugins.g.typescript({
|
||||
out:"index.js",
|
||||
@ -17,7 +25,7 @@ module NpmtsDefault {
|
||||
]);
|
||||
});
|
||||
|
||||
plugins.gulp.task("testTS", function(){
|
||||
plugins.gulp.task("defaultTestTS", function(){
|
||||
plugins.gulp.src(paths.testTS)
|
||||
.pipe(plugins.g.typescript({
|
||||
out: "test.js"
|
||||
@ -25,7 +33,8 @@ module NpmtsDefault {
|
||||
.pipe(plugins.gulp.dest(paths.cwd))
|
||||
});
|
||||
|
||||
plugins.gulp.task("default",["indexTS","testTS"],function(){
|
||||
plugins.gulp.task("default",function(cb){
|
||||
plugins.g.sequence("defaultTsd","defaultIndexTS","defaultTestTS");
|
||||
plugins.beautylog.success("TypeScript for this module was compiled successfully.");
|
||||
});
|
||||
|
||||
|
@ -1,12 +0,0 @@
|
||||
/// <reference path="./index.ts" />
|
||||
var NpmtsPaths;
|
||||
(function (NpmtsPaths) {
|
||||
NpmtsPaths.init = function () {
|
||||
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");
|
||||
return paths;
|
||||
};
|
||||
})(NpmtsPaths || (NpmtsPaths = {}));
|
||||
//# sourceMappingURL=npmts.paths.js.map
|
@ -1 +0,0 @@
|
||||
{"version":3,"file":"npmts.paths.js","sourceRoot":"","sources":["npmts.paths.ts"],"names":["NpmtsPaths"],"mappings":"AAAA,mCAAmC;AACnC,IAAO,UAAU,CAQhB;AARD,WAAO,UAAU,EAAC,CAAC;IACJA,eAAIA,GAAGA;QACd,IAAI,KAAK,GAAO,EAAE,CAAC;QACnB,KAAK,CAAC,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC;QAC5C,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,EAAC,aAAa,CAAC,CAAC;QAC3D,KAAK,CAAC,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,EAAC,YAAY,CAAC,CAAC;QACzD,MAAM,CAAC,KAAK,CAAC;IACjB,CAAC,CAAAA;AACLA,CAACA,EARM,UAAU,KAAV,UAAU,QAQhB"}
|
@ -1,19 +0,0 @@
|
||||
/// <reference path="./index.ts" />
|
||||
var NpmtsPlugins;
|
||||
(function (NpmtsPlugins) {
|
||||
NpmtsPlugins.init = function () {
|
||||
var plugins = {
|
||||
beautylog: require("beautylog"),
|
||||
gulp: require("gulp"),
|
||||
g: {
|
||||
typescript: require("gulp-typescript"),
|
||||
insert: require("gulp-insert")
|
||||
},
|
||||
mergeStream: require("merge2"),
|
||||
path: require("path"),
|
||||
smartcli: require("smartcli")
|
||||
};
|
||||
return plugins;
|
||||
};
|
||||
})(NpmtsPlugins || (NpmtsPlugins = {}));
|
||||
//# sourceMappingURL=npmts.plugins.js.map
|
@ -1 +0,0 @@
|
||||
{"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"}
|
@ -5,8 +5,11 @@ module NpmtsPlugins {
|
||||
beautylog: require("beautylog"),
|
||||
gulp: require("gulp"),
|
||||
g: {
|
||||
typescript: require("gulp-typescript"),
|
||||
insert: require("gulp-insert")
|
||||
insert: require("gulp-insert"),
|
||||
sequence: require("gulp-sequence"),
|
||||
tsd: require("gulp-tsd"),
|
||||
typescript: require("gulp-typescript")
|
||||
|
||||
},
|
||||
mergeStream: require("merge2"),
|
||||
path: require("path"),
|
||||
|
Loading…
Reference in New Issue
Block a user