Skip to content

Commit

Permalink
chore: improved checks in scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
onmax committed Apr 25, 2024
1 parent 5ded30e commit b09cf14
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions .vitepress/scripts/rpc-docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,16 @@ export async function generateRpcDocs() {
const buildFolder = join(__dirname, '../../build/rpc-docs')
// Read package version of generated docs, if already built
const versionFile = join(buildFolder, '/.version')
const methodsFile = join(buildFolder, '/methods.md')

if (existsSync(versionFile)) {
const generatedVersion = readFileSync(versionFile, 'utf-8')
if (specVersion === generatedVersion) {
consola.info(`RPC docs ${specVersion} already generated`)
return { specUrl, specVersion }
if(existsSync(methodsFile)) {
consola.info(`RPC docs ${specVersion} already generated`)
return { specUrl, specVersion }
} else
consola.warn(`RPC docs ${specVersion} already generated, but methods.md is missing. Rebuilding...`)
}
}

Expand Down

0 comments on commit b09cf14

Please sign in to comment.