fix(npmextra): update to new format

This commit is contained in:
2025-12-13 11:42:39 +00:00
parent f8d0895aab
commit 3b1c84d7e8
18 changed files with 1951 additions and 1801 deletions

View File

@@ -122,7 +122,7 @@ export class ConfigManager {
const npmextraJsonPath = plugins.path.join(this.projectDir, 'npmextra.json');
// Check if file exists
const fileExists = await plugins.smartfile.fs.fileExists(npmextraJsonPath);
const fileExists = await plugins.fsInstance.file(npmextraJsonPath).exists();
if (!fileExists) {
return;
}
@@ -138,13 +138,13 @@ export class ConfigManager {
}
// Read the npmextra.json file
const npmextraJsonFile = await plugins.smartfile.SmartFile.fromFilePath(npmextraJsonPath);
const npmextraJsonFile = await plugins.smartfileFactory.fromFilePath(npmextraJsonPath);
const npmextraContent = JSON.parse(npmextraJsonFile.contents.toString());
// Check for tsdoc context configuration
if (npmextraContent?.tsdoc?.context) {
if (npmextraContent?.['@git.zone/tsdoc']?.context) {
// Merge with default config
this.config = this.mergeConfigs(this.config, npmextraContent.tsdoc.context);
this.config = this.mergeConfigs(this.config, npmextraContent['@git.zone/tsdoc'].context);
}
// Cache the config
@@ -292,8 +292,8 @@ export class ConfigManager {
const npmextraJsonPath = plugins.path.join(this.projectDir, 'npmextra.json');
let npmextraContent = {};
if (await plugins.smartfile.fs.fileExists(npmextraJsonPath)) {
const npmextraJsonFile = await plugins.smartfile.SmartFile.fromFilePath(npmextraJsonPath);
if (await plugins.fsInstance.file(npmextraJsonPath).exists()) {
const npmextraJsonFile = await plugins.smartfileFactory.fromFilePath(npmextraJsonPath);
npmextraContent = JSON.parse(npmextraJsonFile.contents.toString()) || {};
}
@@ -304,7 +304,7 @@ export class ConfigManager {
// Write back to npmextra.json
const updatedContent = JSON.stringify(npmextraContent, null, 2);
await plugins.smartfile.memory.toFs(updatedContent, npmextraJsonPath);
await plugins.fsInstance.file(npmextraJsonPath).encoding('utf8').write(updatedContent);
} catch (error) {
console.error('Error updating context configuration:', error);
}