now compiling Tests seperately
This commit is contained in:
parent
3070584642
commit
48fa9d205a
10
dist/npmts.compile.helpers.js
vendored
10
dist/npmts.compile.helpers.js
vendored
@ -1,12 +1,12 @@
|
||||
"use strict";
|
||||
var plugins = require("./npmts.plugins");
|
||||
var paths = require("./npmts.paths");
|
||||
var outputPathIsDir = function (configArg, keyArg) {
|
||||
return plugins.smartpath.check.isDir(plugins.path.join(paths.cwd, configArg.ts[keyArg]));
|
||||
var outputPathIsDir = function (tsArrayArg, keyArg) {
|
||||
return plugins.smartpath.check.isDir(plugins.path.join(paths.cwd, tsArrayArg[keyArg]));
|
||||
};
|
||||
exports.checkOutputPath = function (configArg, keyArg) {
|
||||
if (!outputPathIsDir(configArg, keyArg)) {
|
||||
plugins.beautylog.warn("Skipping " + keyArg + " because " + configArg.ts[keyArg] + " it is no directory!");
|
||||
exports.checkOutputPath = function (tsArrayArg, keyArg) {
|
||||
if (!outputPathIsDir(tsArrayArg, keyArg)) {
|
||||
plugins.beautylog.warn("Skipping " + keyArg + " because " + tsArrayArg[keyArg] + " it is no directory!");
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
|
44
dist/npmts.compile.js
vendored
44
dist/npmts.compile.js
vendored
@ -12,7 +12,7 @@ var definitionHandler = function (configArg) {
|
||||
var done = plugins.Q.defer();
|
||||
var configTsLenght = Object.keys(configArg.ts).length;
|
||||
if (configTsLenght == 0) {
|
||||
plugins.beautylog.warn("No declaration files found... Are you sure you don't want them?");
|
||||
plugins.beautylog.warn("No TS file and thus no definitions found!");
|
||||
done.resolve(configArg); //if there are no definition files, resolve...
|
||||
}
|
||||
var localCounter = 0;
|
||||
@ -32,14 +32,10 @@ var definitionHandler = function (configArg) {
|
||||
}
|
||||
return done.promise;
|
||||
};
|
||||
exports.run = function (configArg) {
|
||||
var compileTs = function (tsFileArrayArg, tsOptionsArg) {
|
||||
if (tsOptionsArg === void 0) { tsOptionsArg = {}; }
|
||||
var done = plugins.Q.defer();
|
||||
var config = configArg;
|
||||
npmts_promisechain_1.npmtsOra.text("now compiling " + "TypeScript".yellow);
|
||||
var moduleStream = plugins.merge2({ end: false });
|
||||
/* -------------------------------------------------
|
||||
* ----------- compile TypeScript --------------------------
|
||||
* ----------------------------------------------- */
|
||||
var tsOptionsDefault = {
|
||||
declaration: true,
|
||||
target: "ES5",
|
||||
@ -49,30 +45,40 @@ exports.run = function (configArg) {
|
||||
* merges default ts options with those found in npmts.json
|
||||
*/
|
||||
var tsOptions = function (keyArg) {
|
||||
return plugins.lodashObject.assign(tsOptionsDefault, config.tsOptions);
|
||||
return plugins.lodashObject.assign(tsOptionsDefault, tsOptionsArg);
|
||||
};
|
||||
for (var keyArg in config.ts) {
|
||||
if (helpers.checkOutputPath(config, keyArg)) {
|
||||
for (var keyArg in tsFileArrayArg) {
|
||||
if (helpers.checkOutputPath(tsFileArrayArg, keyArg)) {
|
||||
var tsStream = plugins.gulp.src([plugins.path.join(paths.cwd, keyArg), "!**/typings/**"])
|
||||
.pipe(plugins.g.sourcemaps.init()) // This means sourcemaps will be generated
|
||||
.pipe(plugins.g.typescript(tsOptions(keyArg)));
|
||||
var jsStream = tsStream.js
|
||||
.pipe(plugins.g.sourcemaps.write()) // Now the sourcemaps are added to the .js file
|
||||
.pipe(plugins.gulp.dest(config.ts[keyArg]));
|
||||
.pipe(plugins.gulp.dest(tsFileArrayArg[keyArg]));
|
||||
var declarationStream = tsStream.dts
|
||||
.pipe(plugins.gulp.dest(config.ts[keyArg]));
|
||||
.pipe(plugins.gulp.dest(tsFileArrayArg[keyArg]));
|
||||
moduleStream.add(tsStream, jsStream, declarationStream);
|
||||
}
|
||||
}
|
||||
moduleStream.on("queueDrain", function () {
|
||||
moduleStream.on("finish", function () {
|
||||
plugins.beautylog.ok("compiled TypeScript!");
|
||||
definitionHandler(config)
|
||||
.then(function () {
|
||||
done.resolve(config);
|
||||
});
|
||||
done.resolve();
|
||||
});
|
||||
return done.promise;
|
||||
};
|
||||
exports.run = function (configArg) {
|
||||
var done = plugins.Q.defer();
|
||||
var config = configArg;
|
||||
npmts_promisechain_1.npmtsOra.text("now compiling " + "TypeScript".yellow);
|
||||
compileTs(config.ts, config.tsOptions)
|
||||
.then(function () {
|
||||
compileTs(config.tsTest);
|
||||
})
|
||||
.then(function () {
|
||||
plugins.beautylog.ok("compiled TypeScript!");
|
||||
definitionHandler(config)
|
||||
.then(function () {
|
||||
done.resolve(config);
|
||||
});
|
||||
moduleStream.end();
|
||||
});
|
||||
/*==================== END TS Compilation =====================*/
|
||||
return done.promise;
|
||||
|
7
dist/npmts.options.js
vendored
7
dist/npmts.options.js
vendored
@ -29,9 +29,12 @@ exports.run = function (configArg) {
|
||||
];
|
||||
config.ts = (_a = {},
|
||||
_a["./ts/**/*.ts"] = "./dist/",
|
||||
_a["./test/test.ts"] = "./test/",
|
||||
_a
|
||||
);
|
||||
config.testTs = (_b = {},
|
||||
_b["./test/test.ts"] = "./test/",
|
||||
_b
|
||||
);
|
||||
config.test = ["./index.js"];
|
||||
}
|
||||
//check if config.tsOptions is available
|
||||
@ -49,5 +52,5 @@ exports.run = function (configArg) {
|
||||
plugins.beautylog.ok("build options are ready!");
|
||||
done.resolve(config);
|
||||
return done.promise;
|
||||
var _a;
|
||||
var _a, _b;
|
||||
};
|
||||
|
2
test/assets/dist/index.js
vendored
2
test/assets/dist/index.js
vendored
@ -6,4 +6,4 @@ var testplugin = {
|
||||
};
|
||||
module.exports = testplugin;
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLDZDQUE2QztBQUM3QyxJQUFJLFVBQVUsR0FBRztJQUNiLFlBQVksRUFBRTtRQUNWLE9BQU8sQ0FBQyxHQUFHLENBQUMsd0JBQXdCLENBQUMsQ0FBQztJQUMxQyxDQUFDO0NBQ0osQ0FBQztBQUNGLE1BQU0sQ0FBQyxPQUFPLEdBQUcsVUFBVSxDQUFDIiwiZmlsZSI6ImluZGV4LmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8vIDxyZWZlcmVuY2UgcGF0aD1cIi4vdHlwaW5ncy9pbmRleC5kLnRzXCIgLz5cclxubGV0IHRlc3RwbHVnaW4gPSB7XHJcbiAgICBsb2dTb21ldGhpbmc6IGZ1bmN0aW9uKCl7XHJcbiAgICAgICAgY29uc29sZS5sb2coXCJvbmx5IGZ1bmN0aW9uIGV4ZWN1dGVkXCIpO1xyXG4gICAgfVxyXG59O1xyXG5tb2R1bGUuZXhwb3J0cyA9IHRlc3RwbHVnaW47Il19
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLDZDQUE2QztBQUM3QyxJQUFJLFVBQVUsR0FBRztJQUNiLFlBQVksRUFBRTtRQUNWLE9BQU8sQ0FBQyxHQUFHLENBQUMsd0JBQXdCLENBQUMsQ0FBQztJQUMxQyxDQUFDO0NBQ0osQ0FBQztBQUNGLE1BQU0sQ0FBQyxPQUFPLEdBQUcsVUFBVSxDQUFDIiwiZmlsZSI6ImluZGV4LmpzIiwic291cmNlc0NvbnRlbnQiOlsiLy8vIDxyZWZlcmVuY2UgcGF0aD1cIi4vdHlwaW5ncy9pbmRleC5kLnRzXCIgLz5cbmxldCB0ZXN0cGx1Z2luID0ge1xuICAgIGxvZ1NvbWV0aGluZzogZnVuY3Rpb24oKXtcbiAgICAgICAgY29uc29sZS5sb2coXCJvbmx5IGZ1bmN0aW9uIGV4ZWN1dGVkXCIpO1xuICAgIH1cbn07XG5tb2R1bGUuZXhwb3J0cyA9IHRlc3RwbHVnaW47Il19
|
||||
|
@ -1,13 +1,13 @@
|
||||
import plugins = require("./npmts.plugins");
|
||||
import paths = require("./npmts.paths");
|
||||
|
||||
let outputPathIsDir = function (configArg,keyArg) {
|
||||
return plugins.smartpath.check.isDir(plugins.path.join(paths.cwd, configArg.ts[keyArg]));
|
||||
let outputPathIsDir = function (tsArrayArg,keyArg) {
|
||||
return plugins.smartpath.check.isDir(plugins.path.join(paths.cwd, tsArrayArg[keyArg]));
|
||||
};
|
||||
|
||||
export let checkOutputPath = function(configArg,keyArg){
|
||||
if(!outputPathIsDir(configArg,keyArg)) {
|
||||
plugins.beautylog.warn("Skipping " + keyArg + " because " + configArg.ts[keyArg] + " it is no directory!")
|
||||
export let checkOutputPath = function(tsArrayArg,keyArg){
|
||||
if(!outputPathIsDir(tsArrayArg,keyArg)) {
|
||||
plugins.beautylog.warn("Skipping " + keyArg + " because " + tsArrayArg[keyArg] + " it is no directory!")
|
||||
return false
|
||||
} else {
|
||||
return true;
|
||||
|
@ -12,7 +12,7 @@ let definitionHandler = function(configArg){
|
||||
let done = plugins.Q.defer();
|
||||
let configTsLenght = Object.keys(configArg.ts).length;
|
||||
if(configTsLenght == 0) {
|
||||
plugins.beautylog.warn("No declaration files found... Are you sure you don't want them?");
|
||||
plugins.beautylog.warn("No TS file and thus no definitions found!");
|
||||
done.resolve(configArg); //if there are no definition files, resolve...
|
||||
}
|
||||
let localCounter = 0;
|
||||
@ -33,17 +33,10 @@ let definitionHandler = function(configArg){
|
||||
return done.promise;
|
||||
}
|
||||
|
||||
|
||||
export let run = function (configArg) {
|
||||
let compileTs = (tsFileArrayArg,tsOptionsArg = {}) => {
|
||||
let done = plugins.Q.defer();
|
||||
let config = configArg;
|
||||
npmtsOra.text("now compiling " + "TypeScript".yellow);
|
||||
let moduleStream = plugins.merge2({ end: false });
|
||||
|
||||
/* -------------------------------------------------
|
||||
* ----------- compile TypeScript --------------------------
|
||||
* ----------------------------------------------- */
|
||||
|
||||
let tsOptionsDefault = {
|
||||
declaration: true,
|
||||
target: "ES5",
|
||||
@ -54,34 +47,45 @@ export let run = function (configArg) {
|
||||
* merges default ts options with those found in npmts.json
|
||||
*/
|
||||
let tsOptions = function (keyArg:string) {
|
||||
return plugins.lodashObject.assign(tsOptionsDefault, config.tsOptions)
|
||||
return plugins.lodashObject.assign(tsOptionsDefault, tsOptionsArg)
|
||||
};
|
||||
|
||||
for (let keyArg in config.ts) {
|
||||
if (helpers.checkOutputPath(config,keyArg)) {
|
||||
for (let keyArg in tsFileArrayArg) {
|
||||
if (helpers.checkOutputPath(tsFileArrayArg,keyArg)) {
|
||||
let tsStream = plugins.gulp.src([plugins.path.join(paths.cwd, keyArg), "!**/typings/**"])
|
||||
.pipe(plugins.g.sourcemaps.init()) // This means sourcemaps will be generated
|
||||
.pipe(plugins.g.typescript(tsOptions(keyArg)));
|
||||
|
||||
let jsStream = tsStream.js
|
||||
.pipe(plugins.g.sourcemaps.write()) // Now the sourcemaps are added to the .js file
|
||||
.pipe(plugins.gulp.dest(config.ts[keyArg]));
|
||||
.pipe(plugins.gulp.dest(tsFileArrayArg[keyArg]));
|
||||
let declarationStream = tsStream.dts
|
||||
.pipe(plugins.gulp.dest(config.ts[keyArg]));
|
||||
.pipe(plugins.gulp.dest(tsFileArrayArg[keyArg]));
|
||||
moduleStream.add(tsStream,jsStream,declarationStream);
|
||||
}
|
||||
}
|
||||
moduleStream.on("queueDrain",() => {
|
||||
done.resolve();
|
||||
})
|
||||
return done.promise;
|
||||
}
|
||||
|
||||
moduleStream.on("queueDrain", function () {
|
||||
moduleStream.on("finish", function () {
|
||||
|
||||
export let run = function (configArg) {
|
||||
let done = plugins.Q.defer();
|
||||
let config = configArg;
|
||||
npmtsOra.text("now compiling " + "TypeScript".yellow);
|
||||
|
||||
compileTs(config.ts,config.tsOptions)
|
||||
.then(() => {
|
||||
compileTs(config.tsTest);
|
||||
})
|
||||
.then(function () {
|
||||
plugins.beautylog.ok("compiled TypeScript!");
|
||||
definitionHandler(config)
|
||||
.then(function(){
|
||||
done.resolve(config);
|
||||
});
|
||||
.then(function(){
|
||||
done.resolve(config);
|
||||
});
|
||||
});
|
||||
moduleStream.end();
|
||||
});
|
||||
/*==================== END TS Compilation =====================*/
|
||||
|
||||
|
||||
|
@ -33,7 +33,9 @@ export var run = function(configArg){
|
||||
"./ts/typings.json"
|
||||
];
|
||||
config.ts = {
|
||||
["./ts/**/*.ts"]: "./dist/",
|
||||
["./ts/**/*.ts"]: "./dist/"
|
||||
};
|
||||
config.testTs = {
|
||||
["./test/test.ts"]: "./test/"
|
||||
};
|
||||
config.test = ["./index.js"];
|
||||
|
Loading…
Reference in New Issue
Block a user