update default behaviour
This commit is contained in:
parent
9ad59704be
commit
2436b30605
@ -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.
|
||||||
|
6
index.js
6
index.js
@ -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,
|
||||||
|
BIN
test/.DS_Store
vendored
Normal file
BIN
test/.DS_Store
vendored
Normal file
Binary file not shown.
BIN
test/assets/.DS_Store
vendored
Normal file
BIN
test/assets/.DS_Store
vendored
Normal file
Binary file not shown.
@ -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;
|
||||||
};
|
};
|
BIN
test/assets/test/.DS_Store
vendored
Normal file
BIN
test/assets/test/.DS_Store
vendored
Normal file
Binary file not shown.
2
test/assets/test/test.d.ts
vendored
2
test/assets/test/test.d.ts
vendored
@ -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;
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
#!/usr/bin/env node
|
/// <reference path="../ts/typings/main.d.ts" />
|
||||||
|
|
||||||
/// <reference path="./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 () {
|
||||||
@ -10,5 +8,4 @@ describe("testplugins", function () {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
//# sourceMappingURL=test.js.map
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsNENBQTRDO0FBQzVDLE9BQU8sQ0FBQyxHQUFHLENBQUMseUJBQXlCLENBQUMsQ0FBQztBQUN2QyxJQUFJLFVBQVUsR0FBRyxPQUFPLENBQUMsYUFBYSxDQUFDLENBQUM7QUFDeEMsUUFBUSxDQUFDLGFBQWEsRUFBQztJQUNuQixRQUFRLENBQUMsZUFBZSxFQUFDO1FBQ3JCLEVBQUUsQ0FBQyxzQkFBc0IsRUFBQztZQUN0QixVQUFVLENBQUMsWUFBWSxFQUFFLENBQUE7UUFDN0IsQ0FBQyxDQUFDLENBQUM7SUFDUCxDQUFDLENBQUMsQ0FBQztBQUNQLENBQUMsQ0FBQyxDQUFDIiwiZmlsZSI6InRlc3QuanMiLCJzb3VyY2VzQ29udGVudCI6WyIvLy8gPHJlZmVyZW5jZSBwYXRoPVwiLi90eXBpbmdzL21haW4uZC50c1wiIC8+XG5jb25zb2xlLmxvZyhcIioqKiogc3RhcnRpbmcgdGVzdCAqKioqXCIpO1xudmFyIHRlc3RwbHVnaW4gPSByZXF1aXJlKFwiLi4vaW5kZXguanNcIik7XG5kZXNjcmliZShcInRlc3RwbHVnaW5zXCIsZnVuY3Rpb24oKXtcbiAgICBkZXNjcmliZShcIi5sb2dTb21ldGhpbmdcIixmdW5jdGlvbigpe1xuICAgICAgICBpdChcInNob3VsZCBsb2cgc29tZXRoaW5nXCIsZnVuY3Rpb24oKXtcbiAgICAgICAgICAgIHRlc3RwbHVnaW4ubG9nU29tZXRoaW5nKClcbiAgICAgICAgfSk7XG4gICAgfSk7XG59KTsiXSwic291cmNlUm9vdCI6Ii9zb3VyY2UvIn0=
|
|
1
test/assets/test/test.js.map
Normal file
1
test/assets/test/test.js.map
Normal file
@ -0,0 +1 @@
|
|||||||
|
{"version":3,"file":"test.js","sourceRoot":"","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"}
|
@ -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(){
|
8
test/assets/test/typings.json
Normal file
8
test/assets/test/typings.json
Normal 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"
|
||||||
|
}
|
||||||
|
}
|
@ -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
|
|
@ -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"}
|
|
1
test/assets/tsfile1.d.ts
vendored
1
test/assets/tsfile1.d.ts
vendored
@ -1 +0,0 @@
|
|||||||
declare var something: string;
|
|
@ -1,3 +0,0 @@
|
|||||||
#!/usr/bin/env node
|
|
||||||
|
|
||||||
var something = "something";
|
|
@ -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,
|
||||||
|
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user