Compare commits

...

8 Commits

5 changed files with 30 additions and 6 deletions

View File

@@ -1,5 +1,27 @@
# Changelog # Changelog
## 2024-12-04 - 2.0.34 - fix(TsWatch)
Fix reloading issue for tsfolder changes in element mode.
- Adjusted the function call from 'this.typedserver.reload()' to 'bundleAndReloadElement()' to ensure proper bundle handling in 'element' mode.
## 2024-12-04 - 2.0.33 - fix(core)
Improve async handling in TsWatch class for element and website modes
- Ensured proper asynchronous execution for 'element' and 'website' watch modes.
- Replaced console log with logger for consistency.
## 2024-12-04 - 2.0.32 - fix(core)
Minor improvements and dependency updates
- Updated dependencies for improved performance
- Refined TypeScript project watching logic
## 2024-12-04 - 2.0.31 - fix(Watcher)
Add missing logger message in Watcher class for start method
- Added a log message when starting a watcher to track file path being watched
## 2024-12-04 - 2.0.30 - fix(cli) ## 2024-12-04 - 2.0.30 - fix(cli)
Fix incorrect watch mode and update npm test command. Fix incorrect watch mode and update npm test command.

View File

@@ -1,6 +1,6 @@
{ {
"name": "@git.zone/tswatch", "name": "@git.zone/tswatch",
"version": "2.0.30", "version": "2.0.34",
"private": false, "private": false,
"description": "watch typescript projects during development", "description": "watch typescript projects during development",
"main": "dist_ts/index.js", "main": "dist_ts/index.js",

View File

@@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@git.zone/tswatch', name: '@git.zone/tswatch',
version: '2.0.30', version: '2.0.34',
description: 'watch typescript projects during development' description: 'watch typescript projects during development'
} }

View File

@@ -43,12 +43,13 @@ export class TsWatch {
); );
break; break;
case 'element': case 'element':
(async () => { await (async () => {
/** /**
* this strategy runs a standard server and bundles the ts files to a dist_watch directory * this strategy runs a standard server and bundles the ts files to a dist_watch directory
*/ */
// lets create a standard server // lets create a standard server
console.log( logger.log(
'info',
'bundling TypeScript files to "dist_watch" Note: This is for development only!' 'bundling TypeScript files to "dist_watch" Note: This is for development only!'
); );
this.typedserver = new plugins.typedserver.TypedServer({ this.typedserver = new plugins.typedserver.TypedServer({
@@ -92,7 +93,7 @@ export class TsWatch {
functionToCall: async () => { functionToCall: async () => {
logger.log('info', `building ${tsfolder}`); logger.log('info', `building ${tsfolder}`);
await smartshellInstance.exec(`(cd ${paths.cwd} && npm run build)`); await smartshellInstance.exec(`(cd ${paths.cwd} && npm run build)`);
await this.typedserver.reload(); await bundleAndReloadElement();
}, },
timeout: null, timeout: null,
}) })
@@ -116,7 +117,7 @@ export class TsWatch {
})(); })();
break; break;
case 'website': case 'website':
(async () => { await (async () => {
const bundleAndReloadWebsite = async () => { const bundleAndReloadWebsite = async () => {
await tsbundle.build(paths.cwd, './ts_web/index.ts', './dist_serve/bundle.js', { await tsbundle.build(paths.cwd, './ts_web/index.ts', './dist_serve/bundle.js', {
bundler: 'esbuild', bundler: 'esbuild',

View File

@@ -31,6 +31,7 @@ export class Watcher {
* start the file * start the file
*/ */
public async start() { public async start() {
logger.log('info', `trying to start watcher for ${this.options.filePathToWatch}`);
await this.setupCleanup(); await this.setupCleanup();
console.log(`Looking at ${this.options.filePathToWatch} for changes`); console.log(`Looking at ${this.options.filePathToWatch} for changes`);
this.smartchokWatcher.add([this.options.filePathToWatch]); // __dirname refers to the directory of this very file this.smartchokWatcher.add([this.options.filePathToWatch]); // __dirname refers to the directory of this very file