mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-22 05:27:00 +02:00
refactor: fix more type-aware linting errors (#7479)
This commit is contained in:
parent
bf1513a3e3
commit
624735bd92
51 changed files with 192 additions and 189 deletions
packages/docusaurus-plugin-content-docs/src
|
@ -14,6 +14,7 @@ import {
|
|||
getVersionDocsDirPath,
|
||||
getVersionSidebarsPath,
|
||||
getDocsDirPathLocalized,
|
||||
readVersionsFile,
|
||||
} from './versions/files';
|
||||
import {validateVersionName} from './versions/validation';
|
||||
import {loadSidebarsFileUnsafe} from './sidebars';
|
||||
|
@ -69,12 +70,7 @@ export async function cliDocsVersionCommand(
|
|||
throw err;
|
||||
}
|
||||
|
||||
// Load existing versions.
|
||||
let versions: string[] = [];
|
||||
const versionsJSONFile = getVersionsFilePath(siteDir, pluginId);
|
||||
if (await fs.pathExists(versionsJSONFile)) {
|
||||
versions = await fs.readJSON(versionsJSONFile);
|
||||
}
|
||||
const versions = (await readVersionsFile(siteDir, pluginId)) ?? [];
|
||||
|
||||
// Check if version already exists.
|
||||
if (versions.includes(version)) {
|
||||
|
@ -137,7 +133,7 @@ export async function cliDocsVersionCommand(
|
|||
// Update versions.json file.
|
||||
versions.unshift(version);
|
||||
await fs.outputFile(
|
||||
versionsJSONFile,
|
||||
getVersionsFilePath(siteDir, pluginId),
|
||||
`${JSON.stringify(versions, null, 2)}\n`,
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue