fix(core): update

This commit is contained in:
2019-05-08 11:14:57 +02:00
parent 483aafd371
commit d425e290dd
7 changed files with 396 additions and 37 deletions

View File

@ -1,3 +1,5 @@
import * as early from '@pushrocks/early';
early.start('tswatch');
export * from './tswatch.classes.tswatch';
import './tswatch.cli';
import './tswatch.cli';
early.stop();

View File

@ -14,7 +14,7 @@ export class TsWatch {
executor: 'bash'
});
private currentExecution: plugins.smartshell.IExecResultStreaming;
private watcher;
private watcher = new plugins.smartchok.Smartchok([], {});
private options: ITsWatchConstructorOptions;
constructor(optionsArg: ITsWatchConstructorOptions) {
@ -27,14 +27,11 @@ export class TsWatch {
public async start() {
this.setupCleanup();
console.log(`Looking at ${this.options.filePathToWatch} for changes`);
this.watcher.add(this.options.filePathToWatch); // __dirname refers to the directory of this very file
this.watcher.on('change', async (file, stat) => {
console.log('Noticed change!');
if (!stat) {
console.log('deleted');
}
this.watcher.add([this.options.filePathToWatch]); // __dirname refers to the directory of this very file
const changeObservable = await this.watcher.getObservableFor('change');
changeObservable.subscribe(() => {
this.updateCurrentExecution();
});
})
this.updateCurrentExecution();
}

View File

@ -1,11 +1,15 @@
import * as plugins from './tswatch.plugins';
import * as paths from './tswatch.paths';
import { logger } from './tswatch.logging';
import { TsWatch } from './tswatch.classes.tswatch';
const tswatchCli = new plugins.smartcli.Smartcli();
// standard behaviour will assume gitzone setup
tswatchCli.addCommand('test').subscribe(argvArg => {
logger.log('info', `running test task`);
const tsWatch = new TsWatch({
filePathToWatch: paths.cwd,
commandToExecute: 'npm run test2',

15
ts/tswatch.logging.ts Normal file
View File

@ -0,0 +1,15 @@
import * as plugins from './tswatch.plugins';
export const logger = new plugins.smartlog.Smartlog({
logContext: {
company: 'Some Company',
companyunit: 'Some CompanyUnit',
containerName: 'Some Containername',
environment: "local",
runtime: 'node',
zone: 'gitzone'
},
minimumLogLevel: 'silly'
});
logger.addLogDestination(new plugins.smartlogDestinationLocal.DestinationLocal());

View File

@ -2,13 +2,11 @@ import * as path from 'path';
export { path };
// @pushrocks scope
import * as smartchok from '@pushrocks/smartchok';
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 smartshell from '@pushrocks/smartshell';
export { smartdelay, smartshell, smartcli };
// Third Pary
import * as fileWatcher from 'filewatcher';
export { fileWatcher };
export { smartchok, smartcli, smartdelay, smartlog, smartlogDestinationLocal, smartshell, };