Compare commits

..

4 Commits

Author SHA1 Message Date
79940cec3f 1.0.29 2019-10-14 14:53:56 +02:00
e20508ffbc fix(core): update 2019-10-14 14:53:55 +02:00
21b962b9a8 1.0.28 2019-10-12 18:09:42 +02:00
f673e8577b fix(core): update 2019-10-12 18:09:41 +02:00
5 changed files with 19 additions and 6 deletions

2
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{ {
"name": "@gitzone/tswatch", "name": "@gitzone/tswatch",
"version": "1.0.27", "version": "1.0.29",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@@ -1,6 +1,6 @@
{ {
"name": "@gitzone/tswatch", "name": "@gitzone/tswatch",
"version": "1.0.27", "version": "1.0.29",
"private": false, "private": false,
"description": "watch typescript projects during development", "description": "watch typescript projects during development",
"main": "dist/index.js", "main": "dist/index.js",

View File

@@ -7,6 +7,7 @@ import { Watcher } from './tswatch.classes.watcher';
export class TsWatch { export class TsWatch {
public watchmode: interfaces.TWatchModes; public watchmode: interfaces.TWatchModes;
public watcherMap = new plugins.lik.Objectmap<Watcher>(); public watcherMap = new plugins.lik.Objectmap<Watcher>();
public smartserve: plugins.smartserve.SmartServe;
constructor(watchmodeArg: interfaces.TWatchModes) { constructor(watchmodeArg: interfaces.TWatchModes) {
this.watchmode = watchmodeArg; this.watchmode = watchmodeArg;
@@ -36,12 +37,12 @@ export class TsWatch {
); );
break; break;
case 'gitzone_element': case 'gitzone_element':
const smartserve = new plugins.smartserve.SmartServe({ // lets create a standard server
this.smartserve = new plugins.smartserve.SmartServe({
port: 3001, port: 3001,
injectReload: true, injectReload: true,
serveDir: './dist_web/' serveDir: plugins.path.join(paths.cwd, './dist_web/')
}); });
await smartserve.start();
this.watcherMap.add( this.watcherMap.add(
new Watcher({ new Watcher({
filePathToWatch: plugins.path.join(paths.cwd, './ts_web/'), filePathToWatch: plugins.path.join(paths.cwd, './ts_web/'),
@@ -87,12 +88,18 @@ export class TsWatch {
this.watcherMap.forEach(async watcher => { this.watcherMap.forEach(async watcher => {
await watcher.start(); await watcher.start();
}); });
if (this.smartserve) {
await this.smartserve.start();
}
} }
/** /**
* stops the execution of any active Watchers * stops the execution of any active Watchers
*/ */
public async stop() { public async stop() {
if (this.smartserve) {
await this.smartserve.stop();
}
this.watcherMap.forEach(async watcher => { this.watcherMap.forEach(async watcher => {
await watcher.stop(); await watcher.stop();
}); });

View File

@@ -55,7 +55,7 @@ export class Watcher {
changeObservable.subscribe(() => { changeObservable.subscribe(() => {
this.updateCurrentExecution(); this.updateCurrentExecution();
}); });
this.updateCurrentExecution(); await this.updateCurrentExecution();
} }
/** /**

View File

@@ -26,4 +26,10 @@ tswatchCli.addCommand('element').subscribe(async argvArg => {
await tsWatch.start(); await tsWatch.start();
}); });
tswatchCli.addCommand('npm').subscribe(async argvArg => {
logger.log('info', `running watch task for a gitzone element project`);
const tsWatch = new TsWatch('gitzone_npm');
await tsWatch.start();
});
tswatchCli.startParse(); tswatchCli.startParse();