Compare commits

..

5 Commits

Author SHA1 Message Date
4cf71d2edc 1.0.64 2022-03-18 13:18:15 +01:00
0eec0c04e8 fix(core): update 2022-03-18 13:18:15 +01:00
ef5d4d2a9c 1.0.63 2022-03-18 07:13:20 +01:00
f05481a267 fix(core): update 2022-03-18 07:13:20 +01:00
d66a88538a 1.0.62 2022-03-14 22:16:23 +01:00
5 changed files with 837 additions and 873 deletions

1642
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
{
"name": "@gitzone/tswatch",
"version": "1.0.61",
"version": "1.0.64",
"private": false,
"description": "watch typescript projects during development",
"main": "dist_ts/index.js",
@@ -16,12 +16,13 @@
"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"
},
"dependencies": {
"@gitzone/tsbundle": "^1.0.99",
"@gitzone/tsrun": "^1.2.31",
"@pushrocks/early": "^3.0.3",
"@pushrocks/lik": "^5.0.4",
@@ -30,8 +31,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"
},

View File

@@ -41,12 +41,34 @@ 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, './dist_watch/'),
port: 3002,
});
const tsbundle = new plugins.tsbundle.TsBundle();
const bundleAndReload = async () => {
await tsbundle.build(paths.cwd, './ts_web/index.ts', './dist_watch/bundle.js', {
bundler: 'esbuild'
});
await smartserve.reload();
}
this.watcherMap.add(
new Watcher({
filePathToWatch: plugins.path.join(paths.cwd, './ts_web/'),
functionToCall: async () => {
await bundleAndReload();
},
timeout: null,
})
);
await smartserve.start();
/* 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(
@@ -56,14 +78,21 @@ export class TsWatch {
timeout: null,
})
);
this.watcherMap.add(
new Watcher({
filePathToWatch: plugins.path.join(paths.cwd, './ts_web/'),
commandToExecute: 'npm run bundle',
timeout: null,
})
);
// 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(

View File

@@ -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.')
}
}

View File

@@ -1,6 +1,13 @@
// node native scope
import * as path from 'path';
export { path };
// @gitzone scope
import * as tsbundle from '@gitzone/tsbundle';
export {
tsbundle
}
// @pushrocks scope
import * as lik from '@pushrocks/lik';
import * as smartchok from '@pushrocks/smartchok';