Compare commits
15 Commits
Author | SHA1 | Date | |
---|---|---|---|
79940cec3f | |||
e20508ffbc | |||
21b962b9a8 | |||
f673e8577b | |||
e4278ed270 | |||
8ae0f960ac | |||
c9a3b996cb | |||
d81d19008a | |||
e4ef6bad8f | |||
2873314742 | |||
e26fa92744 | |||
995f296319 | |||
e7866dadb7 | |||
9302e78f86 | |||
0a302bee95 |
2
package-lock.json
generated
2
package-lock.json
generated
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@gitzone/tswatch",
|
||||
"version": "1.0.21",
|
||||
"version": "1.0.29",
|
||||
"lockfileVersion": 1,
|
||||
"requires": true,
|
||||
"dependencies": {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@gitzone/tswatch",
|
||||
"version": "1.0.21",
|
||||
"version": "1.0.29",
|
||||
"private": false,
|
||||
"description": "watch typescript projects during development",
|
||||
"main": "dist/index.js",
|
||||
|
@@ -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,13 +37,19 @@ export class TsWatch {
|
||||
);
|
||||
break;
|
||||
case 'gitzone_element':
|
||||
// lets create a standard server
|
||||
this.smartserve = new plugins.smartserve.SmartServe({
|
||||
port: 3001,
|
||||
injectReload: true,
|
||||
serveDir: plugins.path.join(paths.cwd, './dist_web/')
|
||||
});
|
||||
this.watcherMap.add(
|
||||
new Watcher({
|
||||
filePathToWatch: plugins.path.join(paths.cwd, './ts_web/'),
|
||||
commandToExecute: async () => {
|
||||
const tsbundle = new plugins.tsbundle.TsBundle();
|
||||
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();
|
||||
},
|
||||
timeout: null
|
||||
@@ -69,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
|
||||
});
|
||||
@@ -81,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();
|
||||
});
|
||||
|
@@ -55,7 +55,7 @@ export class Watcher {
|
||||
changeObservable.subscribe(() => {
|
||||
this.updateCurrentExecution();
|
||||
});
|
||||
this.updateCurrentExecution();
|
||||
await this.updateCurrentExecution();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -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();
|
||||
|
@@ -15,7 +15,8 @@ import * as smartcli from '@pushrocks/smartcli';
|
||||
import * as smartdelay from '@pushrocks/smartdelay';
|
||||
import * as smartlog from '@pushrocks/smartlog';
|
||||
import * as smartlogDestinationLocal from '@pushrocks/smartlog-destination-local';
|
||||
import * as smartserve from '@pushrocks/smartserve';
|
||||
import * as smartshell from '@pushrocks/smartshell';
|
||||
import * as taskbuffer from '@pushrocks/taskbuffer';
|
||||
|
||||
export { lik, smartchok, smartcli, smartdelay, smartlog, smartlogDestinationLocal, smartshell, taskbuffer };
|
||||
export { lik, smartchok, smartcli, smartdelay, smartlog, smartlogDestinationLocal, smartserve, smartshell, taskbuffer };
|
||||
|
Reference in New Issue
Block a user