diff --git a/compile/compile.js b/compile/compile.js index 05c1491..cad03bf 100644 --- a/compile/compile.js +++ b/compile/compile.js @@ -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; }); diff --git a/index.js b/index.js index a4c0bdb..d3c3f5f 100644 --- a/index.js +++ b/index.js @@ -1,3 +1,5 @@ +#!/usr/bin/env node + /// var plugins = { beautylog: require("beautylog"), diff --git a/package.json b/package.json index 669b3dd..21327e6 100644 --- a/package.json +++ b/package.json @@ -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" } diff --git a/test/node_modules/npmts/package.json b/test/node_modules/npmts/package.json index bcfa195..def7be2 100644 --- a/test/node_modules/npmts/package.json +++ b/test/node_modules/npmts/package.json @@ -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" } diff --git a/test/ts/index.js b/test/ts/index.js new file mode 100644 index 0000000..f3511ee --- /dev/null +++ b/test/ts/index.js @@ -0,0 +1,4 @@ +(function () { + console.log("test"); +}()); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/test/ts/index.js.map b/test/ts/index.js.map new file mode 100644 index 0000000..10a8e38 --- /dev/null +++ b/test/ts/index.js.map @@ -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"} \ No newline at end of file