This commit is contained in:
Philipp Kunz 2016-01-14 19:25:36 +01:00
parent 661dd71025
commit 47b8f6e876
12 changed files with 192 additions and 5 deletions

3
.gitignore vendored
View File

@ -1,2 +1,3 @@
.idea/ .idea/
.c9/ .c9/
node_modules/

5
.npmignore Normal file
View File

@ -0,0 +1,5 @@
support
compile
test
examples
.gitignore

23
compile/compile.js Normal file
View File

@ -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']);

26
index.js Normal file
View File

@ -0,0 +1,26 @@
/// <reference path="./typings/tsd.d.ts" />
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));
});

View File

@ -3,8 +3,11 @@
"version": "0.0.0", "version": "0.0.0",
"description": "write npm modules with TypeScript", "description": "write npm modules with TypeScript",
"main": "index.js", "main": "index.js",
"bin": {
"npmts": "index.js"
},
"scripts": { "scripts": {
"test": "npmts" "test": "(cd compile && node compile.js)"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -19,5 +22,11 @@
"bugs": { "bugs": {
"url": "https://github.com/pushrocks/npmts/issues" "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"
}
} }

21
test/node_modules/npmts/LICENSE generated vendored Normal file
View File

@ -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.

31
test/node_modules/npmts/package.json generated vendored Normal file
View File

@ -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"
}

14
test/package.json Normal file
View File

@ -0,0 +1,14 @@
{
"name": "test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "(npmts)"
},
"author": "",
"license": "ISC",
"dependencies": {
"npmts": "*"
}
}

3
test/ts/index.ts Normal file
View File

@ -0,0 +1,3 @@
(function(){
console.log("test")
}());

27
ts/index.js Normal file
View File

@ -0,0 +1,27 @@
/// <reference path="./typings/tsd.d.ts" />
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

1
ts/index.js.map Normal file
View File

@ -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"}

View File

@ -1,3 +1,29 @@
/// <reference path="./typings/tsd.d.ts" />
var plugins = { var plugins = {
beautylog: require("beautylog") 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))
});