Compare commits

...

8 Commits

Author SHA1 Message Date
5160aab180 3.0.1 2016-02-17 06:04:02 +01:00
e8806e548b fix coverage 2016-02-17 06:00:12 +01:00
fcdaad540e fix coverage 2016-02-17 05:59:29 +01:00
6f33b1f5ef 3.0.0 2016-02-17 05:51:55 +01:00
45418d6049 update test 2016-02-17 05:51:51 +01:00
4261ee3687 cleanup 2016-02-17 05:50:12 +01:00
9fc3606163 cleanup 2016-02-17 05:49:10 +01:00
2436b30605 update default behaviour 2016-02-17 05:45:42 +01:00
20 changed files with 34 additions and 38 deletions

4
.gitignore vendored
View File

@ -5,4 +5,6 @@ test/**/node_modules/
test/**/typings/ test/**/typings/
test/**/coverage/ test/**/coverage/
ts/*.js ts/*.js
ts/*.js.map ts/*.js.map
.DS_Store

View File

@ -43,8 +43,10 @@ Then use it in package.json's script section to trigger a build:
You can then reference the ./ts/typings/main.d.ts file in your TypeScript code. You can then reference the ./ts/typings/main.d.ts file in your TypeScript code.
#### TypeScript #### TypeScript
by default npmts looks for `./ts/index.ts` and `./ts/test.ts` that will compile to by default npmts looks for `./ts/*.ts` and `./test/test.ts` that will compile to
`./index.js` and `./test.js` `./dist/*.js` and `./test/test.js`
Use commonjs module system for wiring up files.
#### Declaration files #### Declaration files
**npmts** also creates an `index.d.ts` declaration file by default. **npmts** also creates an `index.d.ts` declaration file by default.

View File

@ -85,8 +85,8 @@ var NpmtsOptions;
"./ts/" "./ts/"
]; ];
config.ts = (_a = {}, config.ts = (_a = {},
_a["./ts/index.ts"] = "./index.js", _a["./ts/**/*.ts"] = "./dist/",
_a["./ts/test.ts"] = "./test/test.js", _a["./test/test.ts"] = "./test/",
_a _a
); );
config.test = ["./index.js"]; config.test = ["./index.js"];
@ -167,7 +167,7 @@ var NpmtsCompile;
return plugins.path.join(paths.cwd, config.ts[key]); return plugins.path.join(paths.cwd, config.ts[key]);
} }
})(); })();
var tsStream = plugins.gulp.src(plugins.path.join(paths.cwd, key)) var tsStream = plugins.gulp.src([plugins.path.join(paths.cwd, key), "!**/typings/**"])
.pipe(plugins.g.sourcemaps.init()) // This means sourcemaps will be generated .pipe(plugins.g.sourcemaps.init()) // This means sourcemaps will be generated
.pipe(plugins.g.typescript({ .pipe(plugins.g.typescript({
out: outputName, out: outputName,
@ -202,7 +202,7 @@ var NpmtsTests;
var done = plugins.q.defer(); var done = plugins.q.defer();
var config = configArg; var config = configArg;
var istanbul = function () { var istanbul = function () {
var stream = plugins.gulp.src([plugins.path.join(paths.cwd, "index.js")]) var stream = plugins.gulp.src([plugins.path.join(paths.cwd, "dist/index.js")])
.pipe(plugins.g.istanbul()) .pipe(plugins.g.istanbul())
.pipe(plugins.g.istanbul.hookRequire()); .pipe(plugins.g.istanbul.hookRequire());
return stream; return stream;

View File

@ -1,6 +1,6 @@
{ {
"name": "npmts", "name": "npmts",
"version": "2.4.1", "version": "3.0.1",
"description": "write npm modules with TypeScript", "description": "write npm modules with TypeScript",
"main": "index.js", "main": "index.js",
"typings": "./index.d.ts", "typings": "./index.d.ts",

View File

@ -1,4 +1,4 @@
/// <reference path="ts/typings/main.d.ts" /> /// <reference path="typings/main.d.ts" />
declare var testplugin: { declare var testplugin: {
logSomething: () => void; logSomething: () => void;
}; };

View File

@ -1,6 +1,6 @@
{ {
"name": "test", "name": "test",
"version": "1.0.0", "version": "2.0.0",
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
@ -8,6 +8,5 @@
}, },
"author": "", "author": "",
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {}
}
} }

BIN
test/assets/test/.DS_Store vendored Normal file

Binary file not shown.

View File

@ -1,2 +1,2 @@
/// <reference path="ts/typings/main.d.ts" /> /// <reference path="../ts/typings/main.d.ts" />
declare var testplugin: any; declare var testplugin: any;

View File

@ -1,8 +1,8 @@
#!/usr/bin/env node #!/usr/bin/env node
/// <reference path="./typings/main.d.ts" /> /// <reference path="../ts/typings/main.d.ts" />
console.log("**** starting test ****"); console.log("**** starting test ****");
var testplugin = require("../index.js"); var testplugin = require("../dist/index.js");
describe("testplugins", function () { describe("testplugins", function () {
describe(".logSomething", function () { describe(".logSomething", function () {
it("should log something", function () { it("should log something", function () {
@ -11,4 +11,4 @@ describe("testplugins", function () {
}); });
}); });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsNENBQTRDO0FBQzVDLE9BQU8sQ0FBQyxHQUFHLENBQUMseUJBQXlCLENBQUMsQ0FBQztBQUN2QyxJQUFJLFVBQVUsR0FBRyxPQUFPLENBQUMsYUFBYSxDQUFDLENBQUM7QUFDeEMsUUFBUSxDQUFDLGFBQWEsRUFBQztJQUNuQixRQUFRLENBQUMsZUFBZSxFQUFDO1FBQ3JCLEVBQUUsQ0FBQyxzQkFBc0IsRUFBQztZQUN0QixVQUFVLENBQUMsWUFBWSxFQUFFLENBQUE7UUFDN0IsQ0FBQyxDQUFDLENBQUM7SUFDUCxDQUFDLENBQUMsQ0FBQztBQUNQLENBQUMsQ0FBQyxDQUFDIiwiZmlsZSI6InRlc3QuanMiLCJzb3VyY2VzQ29udGVudCI6WyIvLy8gPHJlZmVyZW5jZSBwYXRoPVwiLi90eXBpbmdzL21haW4uZC50c1wiIC8+XG5jb25zb2xlLmxvZyhcIioqKiogc3RhcnRpbmcgdGVzdCAqKioqXCIpO1xudmFyIHRlc3RwbHVnaW4gPSByZXF1aXJlKFwiLi4vaW5kZXguanNcIik7XG5kZXNjcmliZShcInRlc3RwbHVnaW5zXCIsZnVuY3Rpb24oKXtcbiAgICBkZXNjcmliZShcIi5sb2dTb21ldGhpbmdcIixmdW5jdGlvbigpe1xuICAgICAgICBpdChcInNob3VsZCBsb2cgc29tZXRoaW5nXCIsZnVuY3Rpb24oKXtcbiAgICAgICAgICAgIHRlc3RwbHVnaW4ubG9nU29tZXRoaW5nKClcbiAgICAgICAgfSk7XG4gICAgfSk7XG59KTsiXSwic291cm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Root":"","sources":["test.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;AACvC,IAAI,UAAU,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAC7C,QAAQ,CAAC,aAAa,EAAC;IACnB,QAAQ,CAAC,eAAe,EAAC;QACrB,EAAE,CAAC,sBAAsB,EAAC;YACtB,UAAU,CAAC,YAAY,EAAE,CAAA;QAC7B,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}

View File

@ -1,6 +1,6 @@
/// <reference path="./typings/main.d.ts" /> /// <reference path="../ts/typings/main.d.ts" />
console.log("**** starting test ****"); console.log("**** starting test ****");
var testplugin = require("../index.js"); var testplugin = require("../dist/index.js");
describe("testplugins",function(){ describe("testplugins",function(){
describe(".logSomething",function(){ describe(".logSomething",function(){
it("should log something",function(){ it("should log something",function(){

View File

@ -0,0 +1,8 @@
{
"ambientDependencies": {
"node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts#78d36dd49b6b55b9fdfe61776a12bf05c8b07777",
"colors": "github:DefinitelyTyped/DefinitelyTyped/colors/colors.d.ts#09e37435ffb2c56a6f908081194a74756f24f99d",
"vinyl": "github:DefinitelyTyped/DefinitelyTyped/vinyl/vinyl.d.ts#78d36dd49b6b55b9fdfe61776a12bf05c8b07777"
}
}

View File

@ -1,11 +0,0 @@
/// <reference path="./typings/main.d.ts" />
console.log("**** starting test ****");
var testplugin = require("../index.js");
describe("testplugins", function () {
describe(".logSomething", function () {
it("should log something", function () {
testplugin.logSomething();
});
});
});
//# sourceMappingURL=test.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;AACvC,IAAI,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AACxC,QAAQ,CAAC,aAAa,EAAC;IACnB,QAAQ,CAAC,eAAe,EAAC;QACrB,EAAE,CAAC,sBAAsB,EAAC;YACtB,UAAU,CAAC,YAAY,EAAE,CAAA;QAC7B,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}

View File

@ -1 +0,0 @@
declare var something: string;

View File

@ -1,3 +0,0 @@
#!/usr/bin/env node
var something = "something";

View File

@ -67,7 +67,7 @@ module NpmtsCompile {
} }
})(); })();
var tsStream = plugins.gulp.src(plugins.path.join(paths.cwd,key)) var tsStream = plugins.gulp.src([plugins.path.join(paths.cwd,key),"!**/typings/**"])
.pipe(plugins.g.sourcemaps.init()) // This means sourcemaps will be generated .pipe(plugins.g.sourcemaps.init()) // This means sourcemaps will be generated
.pipe(plugins.g.typescript({ .pipe(plugins.g.typescript({
out: outputName, out: outputName,

View File

@ -11,8 +11,8 @@ module NpmtsOptions {
"./ts/" "./ts/"
]; ];
config.ts = { config.ts = {
["./ts/index.ts"]: "./index.js", ["./ts/**/*.ts"]: "./dist/",
["./ts/test.ts"]: "./test/test.js" ["./test/test.ts"]: "./test/"
}; };
config.test = ["./index.js"]; config.test = ["./index.js"];
done.resolve(config); done.resolve(config);

View File

@ -4,7 +4,7 @@ module NpmtsTests {
var done = plugins.q.defer(); var done = plugins.q.defer();
var config = configArg; var config = configArg;
var istanbul = function () { var istanbul = function () {
var stream = plugins.gulp.src([plugins.path.join(paths.cwd,"index.js")]) var stream = plugins.gulp.src([plugins.path.join(paths.cwd,"dist/*.js")])
// Covering files // Covering files
.pipe(plugins.g.istanbul()) .pipe(plugins.g.istanbul())
// Force `require` to return covered files // Force `require` to return covered files