fix(aidocs, config): migrate aidocs configuration handling from npmextra to smartconfig
This commit is contained in:
@@ -79,15 +79,15 @@ Don't wrap the JSON in \`\`\`json\`\`\` - just return the raw JSON object.
|
||||
const projectContext = new ProjectContext(this.projectDir);
|
||||
const files = await projectContext.gatherFiles();
|
||||
|
||||
// Update npmextra.json
|
||||
const npmextraJson = files.smartfilesNpmextraJSON;
|
||||
const npmextraJsonContent = JSON.parse(npmextraJson.contents.toString());
|
||||
// Update smartconfig.json
|
||||
const smartconfigJson = files.smartfilesNpmextraJSON;
|
||||
const smartconfigJsonContent = JSON.parse(smartconfigJson.contents.toString());
|
||||
|
||||
npmextraJsonContent['@git.zone/cli'].module.description = resultObject.description;
|
||||
npmextraJsonContent['@git.zone/cli'].module.keywords = resultObject.keywords;
|
||||
smartconfigJsonContent['@git.zone/cli'].module.description = resultObject.description;
|
||||
smartconfigJsonContent['@git.zone/cli'].module.keywords = resultObject.keywords;
|
||||
|
||||
npmextraJson.contents = Buffer.from(JSON.stringify(npmextraJsonContent, null, 2));
|
||||
await npmextraJson.write();
|
||||
smartconfigJson.contents = Buffer.from(JSON.stringify(smartconfigJsonContent, null, 2));
|
||||
await smartconfigJson.write();
|
||||
|
||||
// Update package.json
|
||||
const packageJson = files.smartfilePackageJSON;
|
||||
|
||||
@@ -27,7 +27,7 @@ export class ProjectContext {
|
||||
this.projectDir,
|
||||
);
|
||||
const smartfilesNpmextraJSON = await plugins.smartfileFactory.fromFilePath(
|
||||
plugins.path.join(this.projectDir, 'npmextra.json'),
|
||||
plugins.path.join(this.projectDir, 'smartconfig.json'),
|
||||
this.projectDir,
|
||||
);
|
||||
const smartfilesMod = await plugins.smartfileFactory.virtualDirectoryFromPath(
|
||||
|
||||
@@ -19,12 +19,12 @@ export class Readme {
|
||||
|
||||
// First check legal info before introducing any cost
|
||||
const projectContext = new ProjectContext(this.projectDir);
|
||||
const npmExtraJson = JSON.parse(
|
||||
const smartconfigJson = JSON.parse(
|
||||
(await projectContext.gatherFiles()).smartfilesNpmextraJSON.contents.toString()
|
||||
);
|
||||
const legalInfo = npmExtraJson?.['@git.zone/tsdoc']?.legal;
|
||||
const legalInfo = smartconfigJson?.['@git.zone/tsdoc']?.legal;
|
||||
if (!legalInfo) {
|
||||
const error = new Error(`No legal information found in npmextra.json`);
|
||||
const error = new Error(`No legal information found in smartconfig.json`);
|
||||
console.log(error);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user