fix(core): update
This commit is contained in:
@ -1 +1,7 @@
|
||||
export type TWatchModes = 'test' | 'gitzone_npm' | 'gitzone_service' | 'gitzone_website' | 'echoSomething';
|
||||
export type TWatchModes =
|
||||
| 'test'
|
||||
| 'gitzone_npm'
|
||||
| 'gitzone_service'
|
||||
| 'gitzone_element'
|
||||
| 'gitzone_website'
|
||||
| 'echoSomething';
|
||||
|
@ -18,35 +18,49 @@ export class TsWatch {
|
||||
public async start() {
|
||||
switch (this.watchmode) {
|
||||
case 'test':
|
||||
this.watcherMap.add(new Watcher({
|
||||
filePathToWatch: paths.cwd,
|
||||
commandToExecute: 'npm run test2',
|
||||
timeout: null
|
||||
}));
|
||||
break;
|
||||
case 'gitzone_npm':
|
||||
this.watcherMap.add(new Watcher({
|
||||
filePathToWatch: paths.cwd,
|
||||
commandToExecute: 'npm run test',
|
||||
timeout: null
|
||||
}));
|
||||
break;
|
||||
case 'gitzone_website':
|
||||
// server directory
|
||||
this.watcherMap.add(
|
||||
new Watcher({
|
||||
filePathToWatch: plugins.path.join(paths.cwd, './ts/'),
|
||||
commandToExecute: 'npm run start',
|
||||
filePathToWatch: paths.cwd,
|
||||
commandToExecute: 'npm run test2',
|
||||
timeout: null
|
||||
})
|
||||
);
|
||||
|
||||
break;
|
||||
case 'gitzone_npm':
|
||||
this.watcherMap.add(
|
||||
new Watcher({
|
||||
filePathToWatch: paths.cwd,
|
||||
commandToExecute: 'npm run test',
|
||||
timeout: null
|
||||
})
|
||||
);
|
||||
break;
|
||||
case 'gitzone_element':
|
||||
this.watcherMap.add(
|
||||
new Watcher({
|
||||
filePathToWatch: plugins.path.join(paths.cwd, 'ts_web'),
|
||||
commandToExecute: 'npm run build',
|
||||
timeout: null
|
||||
})
|
||||
);
|
||||
break;
|
||||
case 'gitzone_website':
|
||||
this.watcherMap.add(
|
||||
new Watcher({
|
||||
filePathToWatch: plugins.path.join(paths.cwd, './ts/'),
|
||||
commandToExecute: 'npm run startTs',
|
||||
timeout: null
|
||||
})
|
||||
);
|
||||
|
||||
// client directory
|
||||
this.watcherMap.add(new Watcher({
|
||||
filePathToWatch: plugins.path.join(paths.cwd, './ts_web/'),
|
||||
commandToExecute: 'npm run build',
|
||||
timeout: null
|
||||
}));
|
||||
this.watcherMap.add(
|
||||
new Watcher({
|
||||
filePathToWatch: plugins.path.join(paths.cwd, './ts_web/'),
|
||||
commandToExecute: 'npm run build',
|
||||
timeout: null
|
||||
})
|
||||
);
|
||||
break;
|
||||
case 'echoSomething':
|
||||
const tsWatchInstanceEchoSomething = new Watcher({
|
||||
|
@ -26,7 +26,7 @@ export class Watcher {
|
||||
* start the file
|
||||
*/
|
||||
public async start() {
|
||||
this.setupCleanup();
|
||||
await this.setupCleanup();
|
||||
console.log(`Looking at ${this.options.filePathToWatch} for changes`);
|
||||
this.smartchokWatcher.add([this.options.filePathToWatch]); // __dirname refers to the directory of this very file
|
||||
await this.smartchokWatcher.start();
|
||||
@ -84,7 +84,7 @@ export class Watcher {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* stops the watcher
|
||||
*/
|
||||
|
@ -20,4 +20,10 @@ tswatchCli.addCommand('website').subscribe(async argvArg => {
|
||||
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();
|
||||
|
Reference in New Issue
Block a user