2020-05-22 07:25:34 +00:00
|
|
|
"use strict";
|
2021-03-08 00:26:44 +00:00
|
|
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
|
|
}) : (function(o, m, k, k2) {
|
|
|
|
if (k2 === undefined) k2 = k;
|
|
|
|
o[k2] = m[k];
|
|
|
|
}));
|
|
|
|
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
|
|
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
|
|
}) : function(o, v) {
|
|
|
|
o["default"] = v;
|
|
|
|
});
|
2020-05-22 07:25:34 +00:00
|
|
|
var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
|
if (mod && mod.__esModule) return mod;
|
|
|
|
var result = {};
|
2021-08-18 16:55:43 +00:00
|
|
|
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
2021-03-08 00:26:44 +00:00
|
|
|
__setModuleDefault(result, mod);
|
2020-05-22 07:25:34 +00:00
|
|
|
return result;
|
|
|
|
};
|
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
2021-03-08 00:26:44 +00:00
|
|
|
exports.TsWatch = void 0;
|
2020-05-22 07:25:34 +00:00
|
|
|
const plugins = __importStar(require("./tswatch.plugins"));
|
|
|
|
const paths = __importStar(require("./tswatch.paths"));
|
|
|
|
const tswatch_classes_watcher_1 = require("./tswatch.classes.watcher");
|
|
|
|
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',
|
2021-03-08 00:26:44 +00:00
|
|
|
timeout: null,
|
2020-05-22 07:25:34 +00:00
|
|
|
}));
|
|
|
|
break;
|
|
|
|
case 'gitzone_npm':
|
|
|
|
this.watcherMap.add(new tswatch_classes_watcher_1.Watcher({
|
|
|
|
filePathToWatch: paths.cwd,
|
|
|
|
commandToExecute: 'npm run test',
|
2021-03-08 00:26:44 +00:00
|
|
|
timeout: null,
|
2020-05-22 07:25:34 +00:00
|
|
|
}));
|
|
|
|
break;
|
|
|
|
case 'gitzone_element':
|
|
|
|
// lets create a standard server
|
|
|
|
console.log('bundling TypeScript files to "dist_watch" Note: This is for development only!');
|
2021-03-08 00:26:44 +00:00
|
|
|
const parcel = new plugins.smartparcel.Parcel(plugins.path.join(process.cwd(), './html/index.html'), plugins.path.join(process.cwd(), './dist_watch'), 'index.html');
|
2020-05-22 07:25:34 +00:00
|
|
|
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',
|
2021-03-08 00:26:44 +00:00
|
|
|
timeout: null,
|
2020-05-22 07:25:34 +00:00
|
|
|
}));
|
|
|
|
// client directory
|
2021-03-08 00:26:44 +00:00
|
|
|
const parcelWebsite = new plugins.smartparcel.Parcel(plugins.path.join(process.cwd(), './ts_web/index.ts'), plugins.path.join(process.cwd(), './dist_serve'), 'bundle.js');
|
|
|
|
await parcelWebsite.start();
|
2020-05-22 07:25:34 +00:00
|
|
|
break;
|
|
|
|
case 'gitzone_service':
|
|
|
|
this.watcherMap.add(new tswatch_classes_watcher_1.Watcher({
|
|
|
|
filePathToWatch: plugins.path.join(paths.cwd, './ts/'),
|
|
|
|
commandToExecute: 'npm run startTs',
|
2021-03-08 00:26:44 +00:00
|
|
|
timeout: null,
|
2020-05-22 07:25:34 +00:00
|
|
|
}));
|
|
|
|
break;
|
|
|
|
case 'echoSomething':
|
|
|
|
const tsWatchInstanceEchoSomething = new tswatch_classes_watcher_1.Watcher({
|
|
|
|
filePathToWatch: plugins.path.join(paths.cwd, './ts'),
|
|
|
|
commandToExecute: 'npm -v',
|
2021-03-08 00:26:44 +00:00
|
|
|
timeout: null,
|
2020-05-22 07:25:34 +00:00
|
|
|
});
|
|
|
|
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;
|
2021-03-08 00:26:44 +00:00
|
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHN3YXRjaC5jbGFzc2VzLnRzd2F0Y2guanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy90c3dhdGNoLmNsYXNzZXMudHN3YXRjaC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBQUEsMkRBQTZDO0FBQzdDLHVEQUF5QztBQUd6Qyx1RUFBb0Q7QUFFcEQsTUFBYSxPQUFPO0lBS2xCLFlBQVksWUFBb0M7UUFIekMsZUFBVSxHQ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