fix(config): use .smartconfig.json consistently and pass asset copy paths explicitly

This commit is contained in:
2026-05-09 12:33:39 +00:00
parent 7a1dbbff21
commit f2e843b72e
10 changed files with 2416 additions and 1511 deletions
+1 -1
View File
@@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@git.zone/tswatch',
version: '3.3.3',
version: '3.3.4',
description: 'A development tool for automatically watching and re-compiling TypeScript projects upon detecting file changes, enhancing developer workflows.'
}
+2 -2
View File
@@ -136,7 +136,7 @@ export class ConfigHandler {
}
/**
* Load configuration from smartconfig.json
* Load configuration from .smartconfig.json
* If a preset is specified, merge preset defaults with user overrides
*/
public loadConfig(): interfaces.ITswatchConfig | null {
@@ -177,7 +177,7 @@ export class ConfigHandler {
}
/**
* Get the config key for smartconfig.json
* Get the config key for .smartconfig.json
*/
public getConfigKey(): string {
return CONFIG_KEY;
+6 -3
View File
@@ -9,7 +9,7 @@ import { logger } from './tswatch.logging.js';
/**
* TsWatch - Config-driven file watcher
*
* Reads configuration from smartconfig.json under the key '@git.zone/tswatch'
* Reads configuration from .smartconfig.json under the key '@git.zone/tswatch'
* and sets up watchers, bundles, and dev server accordingly.
*/
export class TsWatch {
@@ -27,7 +27,7 @@ export class TsWatch {
}
/**
* Create TsWatch from smartconfig.json configuration
* Create TsWatch from .smartconfig.json configuration
*/
public static fromConfig(cwdArg?: string): TsWatch | null {
const configHandler = new ConfigHandler(cwdArg);
@@ -136,7 +136,10 @@ export class TsWatch {
});
} else if (fromPath.endsWith('/') || !fromPath.includes('.')) {
// Assets directory copy
await this.assetsHandler.processAssets();
await this.assetsHandler.processAssets({
from: bundleConfig.from,
to: bundleConfig.to,
});
} else if (bundleConfig.outputMode && bundleConfig.outputMode !== 'bundle') {
// Non-default outputMode (e.g. base64ts) — use CustomBundleHandler
await this.customBundleHandler.processSingleBundle({
+2 -2
View File
@@ -18,7 +18,7 @@ tswatchCli.standardCommand().subscribe(async (argvArg) => {
// Config exists - run with it
const tsWatch = TsWatch.fromConfig();
if (tsWatch) {
logger.log('info', 'Starting tswatch with configuration from smartconfig.json');
logger.log('info', 'Starting tswatch with configuration from .smartconfig.json');
await tsWatch.start();
} else {
logger.log('error', 'Failed to load configuration');
@@ -26,7 +26,7 @@ tswatchCli.standardCommand().subscribe(async (argvArg) => {
}
} else {
// No config - launch wizard
logger.log('info', 'No tswatch configuration found in smartconfig.json');
logger.log('info', 'No tswatch configuration found in .smartconfig.json');
const config = await runInit();
if (config) {
// Run with the newly created config
+5 -5
View File
@@ -56,10 +56,10 @@ export class TswatchInit {
config = { ...preset, preset: template as interfaces.ITswatchConfig['preset'] };
}
// Save to smartconfig.json
// Save to .smartconfig.json
await this.saveConfig(config);
console.log('\nConfiguration saved to smartconfig.json');
console.log('\nConfiguration saved to .smartconfig.json');
console.log('Run "tswatch" to start watching.\n');
return config;
@@ -166,12 +166,12 @@ export class TswatchInit {
}
/**
* Save configuration to smartconfig.json
* Save configuration to .smartconfig.json
*/
private async saveConfig(config: interfaces.ITswatchConfig): Promise<void> {
const smartconfigPath = plugins.path.join(paths.cwd, 'smartconfig.json');
const smartconfigPath = plugins.path.join(paths.cwd, '.smartconfig.json');
// Read existing smartconfig.json if it exists
// Read existing .smartconfig.json if it exists
let existingConfig: Record<string, any> = {};
try {
const smartfsInstance = new plugins.smartfs.SmartFs(new plugins.smartfs.SmartFsProviderNode());