Compare commits

...

8 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
e4278ed270 1.0.27 2019-10-12 17:43:44 +02:00
8ae0f960ac fix(core): update 2019-10-12 17:43:43 +02:00
c9a3b996cb 1.0.26 2019-10-12 17:34:05 +02:00
d81d19008a fix(core): update 2019-10-12 17:34:05 +02:00
6 changed files with 21 additions and 11 deletions

2
package-lock.json generated
View File

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

View File

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

View File

@@ -4,10 +4,6 @@ import * as tswatch from '../ts/index';
let testTsWatchInstance: tswatch.TsWatch;
if (process.env.CI) {
process.exit(0);
}
tap.test('should create a valid TsWatch instance', async () => {
testTsWatchInstance = new tswatch.TsWatch('echoSomething');
});

View File

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

View File

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

View File

@@ -26,4 +26,10 @@ tswatchCli.addCommand('element').subscribe(async argvArg => {
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();