diff --git a/.gitignore b/.gitignore index 91f6c98..c67a7d8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .idea/ -.c9/ \ No newline at end of file +.c9/ +node_modules/ \ No newline at end of file diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..8fb2985 --- /dev/null +++ b/.npmignore @@ -0,0 +1,5 @@ +support +compile +test +examples +.gitignore \ No newline at end of file diff --git a/compile/compile.js b/compile/compile.js new file mode 100644 index 0000000..05c1491 --- /dev/null +++ b/compile/compile.js @@ -0,0 +1,23 @@ +// import gulp +var gulp = require("gulp"); +var gulpTypescript = require("gulp-typescript"); +var plugins = { + beautylog: require("beautylog") +}; + +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; +}); + +gulp.task('default',['indexTS'], function() { + plugins.beautylog.success('Typescript compiled'); +}); + +gulp.start.apply(gulp, ['default']); \ No newline at end of file diff --git a/index.js b/index.js new file mode 100644 index 0000000..a4c0bdb --- /dev/null +++ b/index.js @@ -0,0 +1,26 @@ +/// +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)); +}); diff --git a/package.json b/package.json index 18ee617..12d2c46 100644 --- a/package.json +++ b/package.json @@ -3,8 +3,11 @@ "version": "0.0.0", "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", @@ -19,5 +22,11 @@ "bugs": { "url": "https://github.com/pushrocks/npmts/issues" }, - "homepage": "https://github.com/pushrocks/npmts#readme" + "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" + } } diff --git a/test/node_modules/npmts/LICENSE b/test/node_modules/npmts/LICENSE new file mode 100644 index 0000000..b249dfc --- /dev/null +++ b/test/node_modules/npmts/LICENSE @@ -0,0 +1,21 @@ +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. diff --git a/test/node_modules/npmts/package.json b/test/node_modules/npmts/package.json new file mode 100644 index 0000000..bcfa195 --- /dev/null +++ b/test/node_modules/npmts/package.json @@ -0,0 +1,31 @@ +{ + "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" +} diff --git a/test/package.json b/test/package.json new file mode 100644 index 0000000..2b7f147 --- /dev/null +++ b/test/package.json @@ -0,0 +1,14 @@ +{ + "name": "test", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "test": "(npmts)" + }, + "author": "", + "license": "ISC", + "dependencies": { + "npmts": "*" + } +} diff --git a/test/ts/index.ts b/test/ts/index.ts new file mode 100644 index 0000000..82f74ec --- /dev/null +++ b/test/ts/index.ts @@ -0,0 +1,3 @@ +(function(){ + console.log("test") +}()); \ No newline at end of file diff --git a/ts/index.js b/ts/index.js new file mode 100644 index 0000000..03ed970 --- /dev/null +++ b/ts/index.js @@ -0,0 +1,27 @@ +/// +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 \ No newline at end of file diff --git a/ts/index.js.map b/ts/index.js.map new file mode 100644 index 0000000..a6f8532 --- /dev/null +++ b/ts/index.js.map @@ -0,0 +1 @@ +{"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"} \ No newline at end of file diff --git a/ts/index.ts b/ts/index.ts index 0c3e329..f8dc32c 100644 --- a/ts/index.ts +++ b/ts/index.ts @@ -1,3 +1,29 @@ +/// var plugins = { - beautylog: require("beautylog") -}; \ No newline at end of file + 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)) +}); \ No newline at end of file