mirror of
https://github.com/libgit2/libgit2.git
synced 2026-06-22 06:26:26 +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");
|
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) {
|
async function produceDocumentationForVersion(version, apiData) {
|
||||||
if (!options.force && await documentationIsUpToDateForVersion(version, apiData)) {
|
if (!options.force && await documentationIsUpToDateForVersion(version, apiData)) {
|
||||||
if (options.verbose) {
|
if (options.verbose) {
|
||||||
@@ -1097,6 +1110,8 @@ async function produceDocumentationForVersion(version, apiData) {
|
|||||||
console.log(`Producing documentation for ${version}...`);
|
console.log(`Producing documentation for ${version}...`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await cleanupOldDocumentation(version);
|
||||||
|
|
||||||
await produceDocumentationForApis(version, apiData);
|
await produceDocumentationForApis(version, apiData);
|
||||||
|
|
||||||
for (const group in apiData['groups']) {
|
for (const group in apiData['groups']) {
|
||||||
|
|||||||
Reference in New Issue
Block a user