Compare commits

...

12 Commits

Author SHA1 Message Date
85f72feeb9 1.0.30 2019-10-14 14:57:43 +02:00
bd4ccbd215 fix(core): update 2019-10-14 14:57:43 +02:00
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
e4ef6bad8f 1.0.25 2019-10-12 17:31:26 +02:00
2873314742 fix(core): update 2019-10-12 17:31:25 +02:00
6 changed files with 43 additions and 18 deletions

2
package-lock.json generated
View File

@@ -1,6 +1,6 @@
{ {
"name": "@gitzone/tswatch", "name": "@gitzone/tswatch",
"version": "1.0.24", "version": "1.0.30",
"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.24", "version": "1.0.30",
"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

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

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,18 +37,19 @@ 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,
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/'),
commandToExecute: async () => { commandToExecute: async () => {
const tsbundle = new plugins.tsbundle.TsBundle(); const tsbundle = new plugins.tsbundle.TsBundle();
const htmlHandler = new plugins.tsbundle.HtmlHandler(); const htmlHandler = new plugins.tsbundle.HtmlHandler();
await tsbundle.buildProduction('./ts_web', './dist_web'); await tsbundle.buildProduction('./ts_web/index.ts', './dist_web/bundle.js');
await htmlHandler.copyHtml(); await htmlHandler.copyHtml();
}, },
timeout: null timeout: null
@@ -72,9 +74,18 @@ export class TsWatch {
}) })
); );
break; break;
case 'gitzone_service':
this.watcherMap.add(
new Watcher({
filePathToWatch: plugins.path.join(paths.cwd, './ts/'),
commandToExecute: 'npm run startTs',
timeout: null
})
);
break;
case 'echoSomething': case 'echoSomething':
const tsWatchInstanceEchoSomething = new Watcher({ const tsWatchInstanceEchoSomething = new Watcher({
filePathToWatch: paths.cwd, filePathToWatch: plugins.path.join(paths.cwd, './ts'),
commandToExecute: 'npm -v', commandToExecute: 'npm -v',
timeout: null timeout: null
}); });
@@ -86,12 +97,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

@@ -8,6 +8,24 @@ const tswatchCli = new plugins.smartcli.Smartcli();
// standard behaviour will assume gitzone setup // standard behaviour will assume gitzone setup
tswatchCli.addCommand('element').subscribe(async argvArg => {
logger.log('info', `running watch task for a gitzone element project`);
const tsWatch = new TsWatch('gitzone_element');
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.addCommand('service').subscribe(async argvArg => {
logger.log('info', `running test task`);
const tsWatch = new TsWatch('gitzone_service');
await tsWatch.start();
});
tswatchCli.addCommand('test').subscribe(async argvArg => { tswatchCli.addCommand('test').subscribe(async argvArg => {
logger.log('info', `running test task`); logger.log('info', `running test task`);
const tsWatch = new TsWatch('test'); const tsWatch = new TsWatch('test');
@@ -20,10 +38,4 @@ tswatchCli.addCommand('website').subscribe(async argvArg => {
await tsWatch.start(); await tsWatch.start();
}); });
tswatchCli.addCommand('element').subscribe(async argvArg => {
logger.log('info', `running watch task for a gitzone element project`);
const tsWatch = new TsWatch('gitzone_element');
await tsWatch.start();
});
tswatchCli.startParse(); tswatchCli.startParse();