updated bin handling

This commit is contained in:
Philipp Kunz 2016-01-14 19:31:53 +01:00
parent 7410d22fc4
commit 2dffae4872
6 changed files with 31 additions and 11 deletions

View File

@ -1,6 +1,7 @@
// import gulp
var gulp = require("gulp");
var gulpTypescript = require("gulp-typescript");
var gulpInsert = require("gulp-insert");
var plugins = {
beautylog: require("beautylog")
};
@ -9,10 +10,11 @@ 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("../"));
.pipe(gulpTypescript({
out: "index.js"
}))
.pipe(gulpInsert.prepend('#!/usr/bin/env node\n\n'))
.pipe(gulp.dest("../"));
return stream;
});

View File

@ -1,3 +1,5 @@
#!/usr/bin/env node
/// <reference path="./typings/tsd.d.ts" />
var plugins = {
beautylog: require("beautylog"),

View File

@ -7,7 +7,8 @@
"npmts": "index.js"
},
"scripts": {
"test": "(cd compile && node compile.js)"
"test": "(cd compile && node compile.js)",
"testm": "(cd test/ && npm update && npm test)"
},
"repository": {
"type": "git",
@ -26,6 +27,7 @@
"dependencies": {
"beautylog": "^2.0.2",
"gulp": "^3.9.0",
"gulp-insert": "^0.5.0",
"gulp-typescript": "^2.10.0",
"smartcli": "0.0.11"
}

21
test/node_modules/npmts/package.json generated vendored
View File

@ -1,10 +1,13 @@
{
"name": "npmts",
"version": "0.0.0",
"version": "0.0.1",
"description": "write npm modules with TypeScript",
"main": "index.js",
"bin": {
"npmts": "index.js"
},
"scripts": {
"test": "npmts"
"test": "(cd compile && node compile.js)"
},
"repository": {
"type": "git",
@ -23,9 +26,15 @@
"url": "https://github.com/pushrocks/npmts/issues"
},
"homepage": "https://github.com/pushrocks/npmts#readme",
"gitHead": "1699d259b46348a712c638a4fc76a2579e0ecfd9",
"dependencies": {
"beautylog": "^2.0.2",
"gulp": "^3.9.0",
"gulp-typescript": "^2.10.0",
"smartcli": "0.0.11"
},
"gitHead": "7410d22fc4ed6f9756c2b5e1e883f1d06765258e",
"readme": "ERROR: No README data found!",
"_id": "npmts@0.0.0",
"_shasum": "9baf3fb8c432625908c5f6a545e93e95ea0bd2c4",
"_from": "npmts@latest"
"_id": "npmts@0.0.1",
"_shasum": "e2b1edfcf5093f9f3ded25cd5430732e4a128221",
"_from": "npmts@0.0.1"
}

4
test/ts/index.js Normal file
View File

@ -0,0 +1,4 @@
(function () {
console.log("test");
}());
//# sourceMappingURL=index.js.map

1
test/ts/index.js.map Normal file
View 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"}