Compare commits

...

2 Commits

Author SHA1 Message Date
5128802ecf v3.3.1
Some checks failed
Default (tags) / security (push) Failing after 0s
Default (tags) / test (push) Failing after 0s
Default (tags) / release (push) Has been skipped
Default (tags) / metadata (push) Has been skipped
2026-03-24 15:09:42 +00:00
37da233ddf fix(config): switch configuration loading and saving from npmextra.json to smartconfig.json 2026-03-24 15:09:42 +00:00
9 changed files with 51 additions and 25 deletions

View File

@@ -1,5 +1,11 @@
# Changelog # Changelog
## 2026-03-24 - 3.3.1 - fix(config)
switch configuration loading and saving from npmextra.json to smartconfig.json
- replace the @push.rocks/npmextra dependency with @push.rocks/smartconfig
- update config handling, CLI messaging, and init flow to use smartconfig.json consistently
## 2026-03-10 - 3.3.0 - feat(server) ## 2026-03-10 - 3.3.0 - feat(server)
use UtilityWebsiteServer for dev server, add domain option, update docs, and bump dependencies use UtilityWebsiteServer for dev server, add domain option, update docs, and bump dependencies

View File

@@ -1,6 +1,6 @@
{ {
"name": "@git.zone/tswatch", "name": "@git.zone/tswatch",
"version": "3.3.0", "version": "3.3.1",
"private": false, "private": false,
"description": "A development tool for automatically watching and re-compiling TypeScript projects upon detecting file changes, enhancing developer workflows.", "description": "A development tool for automatically watching and re-compiling TypeScript projects upon detecting file changes, enhancing developer workflows.",
"exports": { "exports": {
@@ -28,7 +28,7 @@
"@git.zone/tsrun": "^2.0.1", "@git.zone/tsrun": "^2.0.1",
"@push.rocks/early": "^4.0.4", "@push.rocks/early": "^4.0.4",
"@push.rocks/lik": "^6.3.1", "@push.rocks/lik": "^6.3.1",
"@push.rocks/npmextra": "^5.3.3", "@push.rocks/smartconfig": "^6.0.0",
"@push.rocks/smartcli": "^4.0.20", "@push.rocks/smartcli": "^4.0.20",
"@push.rocks/smartdelay": "^3.0.5", "@push.rocks/smartdelay": "^3.0.5",
"@push.rocks/smartexit": "^2.0.3", "@push.rocks/smartexit": "^2.0.3",

26
pnpm-lock.yaml generated
View File

@@ -23,12 +23,12 @@ importers:
'@push.rocks/lik': '@push.rocks/lik':
specifier: ^6.3.1 specifier: ^6.3.1
version: 6.3.1 version: 6.3.1
'@push.rocks/npmextra':
specifier: ^5.3.3
version: 5.3.3
'@push.rocks/smartcli': '@push.rocks/smartcli':
specifier: ^4.0.20 specifier: ^4.0.20
version: 4.0.20 version: 4.0.20
'@push.rocks/smartconfig':
specifier: ^6.0.0
version: 6.0.0
'@push.rocks/smartdelay': '@push.rocks/smartdelay':
specifier: ^3.0.5 specifier: ^3.0.5
version: 3.0.5 version: 3.0.5
@@ -1114,6 +1114,9 @@ packages:
'@push.rocks/smartclickhouse@2.2.0': '@push.rocks/smartclickhouse@2.2.0':
resolution: {integrity: sha512-eTzKiREIPSzL1kPkVyD6vEbn+WV/DvQqDjP67VlhNlQGbRcemnJG/eLrUUR1ytmdIqnsZGEK6UYBgyj5nhzLNQ==} resolution: {integrity: sha512-eTzKiREIPSzL1kPkVyD6vEbn+WV/DvQqDjP67VlhNlQGbRcemnJG/eLrUUR1ytmdIqnsZGEK6UYBgyj5nhzLNQ==}
'@push.rocks/smartconfig@6.0.0':
resolution: {integrity: sha512-ohXwJdbDXV2budErnZKWBOz01YkjP6gJsZ7QM9+6Wsh+r7O1CVT3JpV+mD8xJWy5tZRHI+3B9L8z0+WkIDtKzw==}
'@push.rocks/smartcrypto@2.0.4': '@push.rocks/smartcrypto@2.0.4':
resolution: {integrity: sha512-1+/5bsjyataf5uUkUNnnVXGRAt+gHVk1KDzozjTqgqJxHvQk1d9fVDohL6CxUhUucTPtu5VR5xNBiV8YCDuGyw==} resolution: {integrity: sha512-1+/5bsjyataf5uUkUNnnVXGRAt+gHVk1KDzozjTqgqJxHvQk1d9fVDohL6CxUhUucTPtu5VR5xNBiV8YCDuGyw==}
@@ -6028,6 +6031,23 @@ snapshots:
'@push.rocks/smarturl': 3.1.0 '@push.rocks/smarturl': 3.1.0
'@push.rocks/webrequest': 4.0.5 '@push.rocks/webrequest': 4.0.5
'@push.rocks/smartconfig@6.0.0':
dependencies:
'@push.rocks/qenv': 6.1.3
'@push.rocks/smartfile': 11.2.7
'@push.rocks/smartjson': 5.2.0
'@push.rocks/smartlog': 3.2.1
'@push.rocks/smartpath': 6.0.0
'@push.rocks/smartpromise': 4.2.3
'@push.rocks/smartrx': 3.0.10
'@push.rocks/taskbuffer': 3.5.0
'@tsclass/tsclass': 9.3.0
transitivePeerDependencies:
- '@nuxt/kit'
- react
- supports-color
- vue
'@push.rocks/smartcrypto@2.0.4': '@push.rocks/smartcrypto@2.0.4':
dependencies: dependencies:
'@push.rocks/smartpromise': 4.2.3 '@push.rocks/smartpromise': 4.2.3

View File

@@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@git.zone/tswatch', name: '@git.zone/tswatch',
version: '3.3.0', version: '3.3.1',
description: 'A development tool for automatically watching and re-compiling TypeScript projects upon detecting file changes, enhancing developer workflows.' description: 'A development tool for automatically watching and re-compiling TypeScript projects upon detecting file changes, enhancing developer workflows.'
} }

View File

@@ -119,28 +119,28 @@ const presets: Record<string, interfaces.ITswatchConfig> = {
* Handles loading and managing tswatch configuration * Handles loading and managing tswatch configuration
*/ */
export class ConfigHandler { export class ConfigHandler {
private npmextra: plugins.npmextra.Npmextra; private smartconfig: plugins.smartconfig.Smartconfig;
private cwd: string; private cwd: string;
constructor(cwdArg?: string) { constructor(cwdArg?: string) {
this.cwd = cwdArg || paths.cwd; this.cwd = cwdArg || paths.cwd;
this.npmextra = new plugins.npmextra.Npmextra(this.cwd); this.smartconfig = new plugins.smartconfig.Smartconfig(this.cwd);
} }
/** /**
* Check if a tswatch configuration exists * Check if a tswatch configuration exists
*/ */
public hasConfig(): boolean { public hasConfig(): boolean {
const config = this.npmextra.dataFor<interfaces.ITswatchConfig>(CONFIG_KEY, null); const config = this.smartconfig.dataFor<interfaces.ITswatchConfig>(CONFIG_KEY, null);
return config !== null; return config !== null;
} }
/** /**
* Load configuration from npmextra.json * Load configuration from smartconfig.json
* If a preset is specified, merge preset defaults with user overrides * If a preset is specified, merge preset defaults with user overrides
*/ */
public loadConfig(): interfaces.ITswatchConfig | null { public loadConfig(): interfaces.ITswatchConfig | null {
const config = this.npmextra.dataFor<interfaces.ITswatchConfig>(CONFIG_KEY, null); const config = this.smartconfig.dataFor<interfaces.ITswatchConfig>(CONFIG_KEY, null);
if (!config) { if (!config) {
return null; return null;
@@ -177,7 +177,7 @@ export class ConfigHandler {
} }
/** /**
* Get the config key for npmextra.json * Get the config key for smartconfig.json
*/ */
public getConfigKey(): string { public getConfigKey(): string {
return CONFIG_KEY; return CONFIG_KEY;

View File

@@ -9,7 +9,7 @@ import { logger } from './tswatch.logging.js';
/** /**
* TsWatch - Config-driven file watcher * TsWatch - Config-driven file watcher
* *
* Reads configuration from npmextra.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. * and sets up watchers, bundles, and dev server accordingly.
*/ */
export class TsWatch { export class TsWatch {
@@ -27,7 +27,7 @@ export class TsWatch {
} }
/** /**
* Create TsWatch from npmextra.json configuration * Create TsWatch from smartconfig.json configuration
*/ */
public static fromConfig(cwdArg?: string): TsWatch | null { public static fromConfig(cwdArg?: string): TsWatch | null {
const configHandler = new ConfigHandler(cwdArg); const configHandler = new ConfigHandler(cwdArg);

View File

@@ -18,7 +18,7 @@ tswatchCli.standardCommand().subscribe(async (argvArg) => {
// Config exists - run with it // Config exists - run with it
const tsWatch = TsWatch.fromConfig(); const tsWatch = TsWatch.fromConfig();
if (tsWatch) { if (tsWatch) {
logger.log('info', 'Starting tswatch with configuration from npmextra.json'); logger.log('info', 'Starting tswatch with configuration from smartconfig.json');
await tsWatch.start(); await tsWatch.start();
} else { } else {
logger.log('error', 'Failed to load configuration'); logger.log('error', 'Failed to load configuration');
@@ -26,7 +26,7 @@ tswatchCli.standardCommand().subscribe(async (argvArg) => {
} }
} else { } else {
// No config - launch wizard // No config - launch wizard
logger.log('info', 'No tswatch configuration found in npmextra.json'); logger.log('info', 'No tswatch configuration found in smartconfig.json');
const config = await runInit(); const config = await runInit();
if (config) { if (config) {
// Run with the newly created config // Run with the newly created config

View File

@@ -56,10 +56,10 @@ export class TswatchInit {
config = { ...preset, preset: template as interfaces.ITswatchConfig['preset'] }; config = { ...preset, preset: template as interfaces.ITswatchConfig['preset'] };
} }
// Save to npmextra.json // Save to smartconfig.json
await this.saveConfig(config); await this.saveConfig(config);
console.log('\nConfiguration saved to npmextra.json'); console.log('\nConfiguration saved to smartconfig.json');
console.log('Run "tswatch" to start watching.\n'); console.log('Run "tswatch" to start watching.\n');
return config; return config;
@@ -166,16 +166,16 @@ export class TswatchInit {
} }
/** /**
* Save configuration to npmextra.json * Save configuration to smartconfig.json
*/ */
private async saveConfig(config: interfaces.ITswatchConfig): Promise<void> { private async saveConfig(config: interfaces.ITswatchConfig): Promise<void> {
const npmextraPath = plugins.path.join(paths.cwd, 'npmextra.json'); const smartconfigPath = plugins.path.join(paths.cwd, 'smartconfig.json');
// Read existing npmextra.json if it exists // Read existing smartconfig.json if it exists
let existingConfig: Record<string, any> = {}; let existingConfig: Record<string, any> = {};
try { try {
const smartfsInstance = new plugins.smartfs.SmartFs(new plugins.smartfs.SmartFsProviderNode()); const smartfsInstance = new plugins.smartfs.SmartFs(new plugins.smartfs.SmartFsProviderNode());
const content = await smartfsInstance.file(npmextraPath).encoding('utf8').read() as string; const content = await smartfsInstance.file(smartconfigPath).encoding('utf8').read() as string;
existingConfig = JSON.parse(content); existingConfig = JSON.parse(content);
} catch { } catch {
// File doesn't exist or is invalid, start fresh // File doesn't exist or is invalid, start fresh
@@ -186,7 +186,7 @@ export class TswatchInit {
// Write back // Write back
const smartfsInstance = new plugins.smartfs.SmartFs(new plugins.smartfs.SmartFsProviderNode()); const smartfsInstance = new plugins.smartfs.SmartFs(new plugins.smartfs.SmartFsProviderNode());
await smartfsInstance.file(npmextraPath).encoding('utf8').write(JSON.stringify(existingConfig, null, 2)); await smartfsInstance.file(smartconfigPath).encoding('utf8').write(JSON.stringify(existingConfig, null, 2));
} }
} }

View File

@@ -13,7 +13,7 @@ export { typedserver };
// @push.rocks scope // @push.rocks scope
import * as lik from '@push.rocks/lik'; import * as lik from '@push.rocks/lik';
import * as npmextra from '@push.rocks/npmextra'; import * as smartconfig from '@push.rocks/smartconfig';
import * as smartcli from '@push.rocks/smartcli'; import * as smartcli from '@push.rocks/smartcli';
import * as smartdelay from '@push.rocks/smartdelay'; import * as smartdelay from '@push.rocks/smartdelay';
import * as smartexit from '@push.rocks/smartexit'; import * as smartexit from '@push.rocks/smartexit';
@@ -26,7 +26,7 @@ import * as smartwatch from '@push.rocks/smartwatch';
export { export {
lik, lik,
npmextra, smartconfig,
smartcli, smartcli,
smartdelay, smartdelay,
smartexit, smartexit,