tswatch/dist_ts/tswatch.classes.tswatch.js
2020-05-22 07:25:34 +00:00

95 lines
6.6 KiB
JavaScript

"use strict";
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const plugins = __importStar(require("./tswatch.plugins"));
const paths = __importStar(require("./tswatch.paths"));
const tswatch_classes_watcher_1 = require("./tswatch.classes.watcher");
const tswatch_classes_parcel_1 = require("./tswatch.classes.parcel");
class TsWatch {
constructor(watchmodeArg) {
this.watcherMap = new plugins.lik.ObjectMap();
this.watchmode = watchmodeArg;
}
/**
* starts the TsWatch instance
*/
async start() {
switch (this.watchmode) {
case 'test':
this.watcherMap.add(new tswatch_classes_watcher_1.Watcher({
filePathToWatch: paths.cwd,
commandToExecute: 'npm run test2',
timeout: null
}));
break;
case 'gitzone_npm':
this.watcherMap.add(new tswatch_classes_watcher_1.Watcher({
filePathToWatch: paths.cwd,
commandToExecute: 'npm run test',
timeout: null
}));
break;
case 'gitzone_element':
// lets create a standard server
console.log('bundling TypeScript files to "dist_watch" Note: This is for development only!');
const parcel = new tswatch_classes_parcel_1.Parcel();
await parcel.start();
break;
case 'gitzone_website':
this.watcherMap.add(new tswatch_classes_watcher_1.Watcher({
filePathToWatch: plugins.path.join(paths.cwd, './ts/'),
commandToExecute: 'npm run startTs',
timeout: null
}));
// client directory
this.watcherMap.add(new tswatch_classes_watcher_1.Watcher({
filePathToWatch: plugins.path.join(paths.cwd, './ts_web/'),
commandToExecute: 'npm run build',
timeout: null
}));
break;
case 'gitzone_service':
this.watcherMap.add(new tswatch_classes_watcher_1.Watcher({
filePathToWatch: plugins.path.join(paths.cwd, './ts/'),
commandToExecute: 'npm run startTs',
timeout: null
}));
break;
case 'echoSomething':
const tsWatchInstanceEchoSomething = new tswatch_classes_watcher_1.Watcher({
filePathToWatch: plugins.path.join(paths.cwd, './ts'),
commandToExecute: 'npm -v',
timeout: null
});
this.watcherMap.add(tsWatchInstanceEchoSomething);
break;
default:
break;
}
this.watcherMap.forEach(async (watcher) => {
await watcher.start();
});
if (this.smartserve) {
await this.smartserve.start();
}
}
/**
* stops the execution of any active Watchers
*/
async stop() {
if (this.smartserve) {
await this.smartserve.stop();
}
this.watcherMap.forEach(async (watcher) => {
await watcher.stop();
});
}
}
exports.TsWatch = TsWatch;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHN3YXRjaC5jbGFzc2VzLnRzd2F0Y2guanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy90c3dhdGNoLmNsYXNzZXMudHN3YXRjaC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7QUFBQSwyREFBNkM7QUFDN0MsdURBQXlDO0FBR3pDLHVFQUFvRDtBQUNwRCxxRUFBa0Q7QUFFbEQsTUFBYSxPQUFPO0lBS2xCLFlBQVksWUFBb0M7UUFIekMsZUFBVSxHQUFHLElBQUksT0FBTyxDQUFDLEdBQUcsQ0FBQyxTQUFTLEVBQVcsQ0FBQztRQUl2RCxJQUFJLENBQUMsU0FBUyxHQUFHLFlBQVksQ0FBQztJQUNoQyxDQUFDO0lBRUQ7O09BRUc7SUFDSSxLQUFLLENBQUMsS0FBSztRQUNoQixRQUFRLElBQUksQ0FBQyxTQUFTLEVBQUU7WUFDdEIsS0FBSyxNQUFNO2dCQUNULElBQUksQ0FBQyxVQUFVLENBQUMsR0FBRyxDQUNqQixJQUFJLGlDQUFPLENBQUM7b0JBQ1YsZUFBZSxFQUFFLEtBQUssQ0FBQyxHQUFHO29CQUMxQixnQkFBZ0IsRUFBRSxlQUFlO29CQUNqQyxPQUFPLEVBQUUsSUFBSTtpQkFDZCxDQUFDLENBQ0gsQ0FBQztnQkFDRixNQUFNO1lBQ1IsS0FBSyxhQUFhO2dCQUNoQixJ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