fix(core): update
This commit is contained in:
parent
d66a88538a
commit
f05481a267
1731
package-lock.json
generated
1731
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -16,8 +16,8 @@
|
||||
"build": "(tsbuild --web --skiplibcheck --allowimplicitany)"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@gitzone/tsbuild": "^2.1.50",
|
||||
"@gitzone/tstest": "^1.0.67",
|
||||
"@gitzone/tsbuild": "^2.1.56",
|
||||
"@gitzone/tstest": "^1.0.69",
|
||||
"@pushrocks/tapbundle": "^5.0.2",
|
||||
"@types/node": "^17.0.21"
|
||||
},
|
||||
@ -30,8 +30,7 @@
|
||||
"@pushrocks/smartdelay": "^2.0.13",
|
||||
"@pushrocks/smartlog": "^2.0.44",
|
||||
"@pushrocks/smartlog-destination-local": "^8.0.8",
|
||||
"@pushrocks/smartparcel": "^1.0.13",
|
||||
"@pushrocks/smartserve": "^1.1.41",
|
||||
"@pushrocks/smartserve": "^2.0.0",
|
||||
"@pushrocks/smartshell": "^2.0.30",
|
||||
"@pushrocks/taskbuffer": "^2.1.17"
|
||||
},
|
||||
|
@ -41,12 +41,25 @@ export class TsWatch {
|
||||
console.log(
|
||||
'bundling TypeScript files to "dist_watch" Note: This is for development only!'
|
||||
);
|
||||
const parcel = new plugins.smartparcel.Parcel(
|
||||
const smartserve = new plugins.smartserve.SmartServe({
|
||||
injectReload: true,
|
||||
serveDir: plugins.path.join(paths.cwd, './ts_web/'),
|
||||
port: 3002,
|
||||
});
|
||||
this.watcherMap.add(
|
||||
new Watcher({
|
||||
filePathToWatch: plugins.path.join(paths.cwd, './ts_web/'),
|
||||
commandToExecute: 'npm run bundle',
|
||||
functionToCall: smartserve.reload,
|
||||
timeout: null,
|
||||
})
|
||||
);
|
||||
/* const parcel = new plugins.smartparcel.Parcel(
|
||||
plugins.path.join(process.cwd(), './html/index.html'),
|
||||
plugins.path.join(process.cwd(), './dist_watch'),
|
||||
'index.html'
|
||||
);
|
||||
await parcel.watchAndServe();
|
||||
await parcel.watchAndServe(); */
|
||||
break;
|
||||
case 'gitzone_website':
|
||||
this.watcherMap.add(
|
||||
@ -58,12 +71,12 @@ export class TsWatch {
|
||||
);
|
||||
|
||||
// client directory
|
||||
const parcelWebsite = new plugins.smartparcel.Parcel(
|
||||
/* const parcelWebsite = new plugins.smartparcel.Parcel(
|
||||
plugins.path.join(process.cwd(), './html/index.html'),
|
||||
plugins.path.join(process.cwd(), './dist_serve'),
|
||||
'bundle.js'
|
||||
);
|
||||
await parcelWebsite.watchAndServe();
|
||||
await parcelWebsite.watchAndServe(); */
|
||||
break;
|
||||
case 'gitzone_service':
|
||||
this.watcherMap.add(
|
||||
|
@ -1,11 +1,10 @@
|
||||
import * as plugins from './tswatch.plugins.js';
|
||||
import { logger } from './tswatch.logging.js';
|
||||
|
||||
export type TCommandFunction = () => Promise<void>;
|
||||
|
||||
export interface IWatcherConstructorOptions {
|
||||
filePathToWatch: string;
|
||||
commandToExecute: string | TCommandFunction;
|
||||
commandToExecute?: string;
|
||||
functionToCall?: () => Promise<any>;
|
||||
timeout?: number;
|
||||
}
|
||||
|
||||
@ -47,7 +46,7 @@ export class Watcher {
|
||||
* updates the current execution
|
||||
*/
|
||||
private async updateCurrentExecution() {
|
||||
if (typeof this.options.commandToExecute === 'string') {
|
||||
if (this.options.commandToExecute) {
|
||||
if (this.currentExecution) {
|
||||
logger.log('ok', `reexecuting ${this.options.commandToExecute}`);
|
||||
this.currentExecution.kill();
|
||||
@ -58,7 +57,12 @@ export class Watcher {
|
||||
this.options.commandToExecute
|
||||
);
|
||||
} else {
|
||||
console.log('cannot run execution task');
|
||||
console.log('no executionCommand set');
|
||||
}
|
||||
if (this.options.functionToCall) {
|
||||
this.options.functionToCall();
|
||||
} else {
|
||||
console.log('no functionToCall set.')
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user