fix(core): update

This commit is contained in:
Philipp Kunz 2022-03-18 07:13:20 +01:00
parent d66a88538a
commit f05481a267
4 changed files with 1293 additions and 480 deletions

1731
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -16,8 +16,8 @@
"build": "(tsbuild --web --skiplibcheck --allowimplicitany)" "build": "(tsbuild --web --skiplibcheck --allowimplicitany)"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.50", "@gitzone/tsbuild": "^2.1.56",
"@gitzone/tstest": "^1.0.67", "@gitzone/tstest": "^1.0.69",
"@pushrocks/tapbundle": "^5.0.2", "@pushrocks/tapbundle": "^5.0.2",
"@types/node": "^17.0.21" "@types/node": "^17.0.21"
}, },
@ -30,8 +30,7 @@
"@pushrocks/smartdelay": "^2.0.13", "@pushrocks/smartdelay": "^2.0.13",
"@pushrocks/smartlog": "^2.0.44", "@pushrocks/smartlog": "^2.0.44",
"@pushrocks/smartlog-destination-local": "^8.0.8", "@pushrocks/smartlog-destination-local": "^8.0.8",
"@pushrocks/smartparcel": "^1.0.13", "@pushrocks/smartserve": "^2.0.0",
"@pushrocks/smartserve": "^1.1.41",
"@pushrocks/smartshell": "^2.0.30", "@pushrocks/smartshell": "^2.0.30",
"@pushrocks/taskbuffer": "^2.1.17" "@pushrocks/taskbuffer": "^2.1.17"
}, },

View File

@ -41,12 +41,25 @@ export class TsWatch {
console.log( console.log(
'bundling TypeScript files to "dist_watch" Note: This is for development only!' '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(), './html/index.html'),
plugins.path.join(process.cwd(), './dist_watch'), plugins.path.join(process.cwd(), './dist_watch'),
'index.html' 'index.html'
); );
await parcel.watchAndServe(); await parcel.watchAndServe(); */
break; break;
case 'gitzone_website': case 'gitzone_website':
this.watcherMap.add( this.watcherMap.add(
@ -58,12 +71,12 @@ export class TsWatch {
); );
// client directory // 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(), './html/index.html'),
plugins.path.join(process.cwd(), './dist_serve'), plugins.path.join(process.cwd(), './dist_serve'),
'bundle.js' 'bundle.js'
); );
await parcelWebsite.watchAndServe(); await parcelWebsite.watchAndServe(); */
break; break;
case 'gitzone_service': case 'gitzone_service':
this.watcherMap.add( this.watcherMap.add(

View File

@ -1,11 +1,10 @@
import * as plugins from './tswatch.plugins.js'; import * as plugins from './tswatch.plugins.js';
import { logger } from './tswatch.logging.js'; import { logger } from './tswatch.logging.js';
export type TCommandFunction = () => Promise<void>;
export interface IWatcherConstructorOptions { export interface IWatcherConstructorOptions {
filePathToWatch: string; filePathToWatch: string;
commandToExecute: string | TCommandFunction; commandToExecute?: string;
functionToCall?: () => Promise<any>;
timeout?: number; timeout?: number;
} }
@ -47,7 +46,7 @@ export class Watcher {
* updates the current execution * updates the current execution
*/ */
private async updateCurrentExecution() { private async updateCurrentExecution() {
if (typeof this.options.commandToExecute === 'string') { if (this.options.commandToExecute) {
if (this.currentExecution) { if (this.currentExecution) {
logger.log('ok', `reexecuting ${this.options.commandToExecute}`); logger.log('ok', `reexecuting ${this.options.commandToExecute}`);
this.currentExecution.kill(); this.currentExecution.kill();
@ -58,7 +57,12 @@ export class Watcher {
this.options.commandToExecute this.options.commandToExecute
); );
} else { } 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.')
} }
} }