mirror of
https://github.com/libgit2/libgit2.git
synced 2026-01-25 02:56:17 +00:00
Documentation: clean up old documentation
Clean up the outdated documentation folder before re-generating it in place. This accomodates a deleted API.
This commit is contained in:
@@ -1084,6 +1084,19 @@ async function produceDocumentationMetadata(version, apiData) {
|
||||
await fs.writeFile(filename, JSON.stringify(apiData.info, null, 2) + "\n");
|
||||
}
|
||||
|
||||
async function cleanupOldDocumentation(version) {
|
||||
const versionDir = `${outputPath}/${version}`;
|
||||
|
||||
for (const fn of await fs.readdir(versionDir)) {
|
||||
if (fn === '.metadata') {
|
||||
continue;
|
||||
}
|
||||
|
||||
const path = `${versionDir}/${fn}`;
|
||||
await fs.rm(path, { recursive: true });
|
||||
}
|
||||
}
|
||||
|
||||
async function produceDocumentationForVersion(version, apiData) {
|
||||
if (!options.force && await documentationIsUpToDateForVersion(version, apiData)) {
|
||||
if (options.verbose) {
|
||||
@@ -1097,6 +1110,8 @@ async function produceDocumentationForVersion(version, apiData) {
|
||||
console.log(`Producing documentation for ${version}...`);
|
||||
}
|
||||
|
||||
await cleanupOldDocumentation(version);
|
||||
|
||||
await produceDocumentationForApis(version, apiData);
|
||||
|
||||
for (const group in apiData['groups']) {
|
||||
|
||||
Reference in New Issue
Block a user