mirror of
https://github.com/seerr-team/seerr.git
synced 2026-06-02 13:20:22 -04:00
Signed-off-by: Ludovic Ortega <ludovic.ortega@adminafk.fr> Co-authored-by: 0xsysr3ll <0xsysr3ll@pm.me> Co-authored-by: Gauthier <mail@gauthierth.fr>
32 lines
802 B
JavaScript
32 lines
802 B
JavaScript
#!/usr/bin/env node
|
|
|
|
const { mkdirSync, readFileSync, writeFileSync } = require('node:fs');
|
|
const { dirname, resolve } = require('node:path');
|
|
const { spawnSync } = require('node:child_process');
|
|
|
|
const args = process.argv.slice(2);
|
|
const categoryPath = resolve(__dirname, '../../docs/api/_category_.json');
|
|
let categoryContent;
|
|
|
|
try {
|
|
categoryContent = readFileSync(categoryPath, 'utf8');
|
|
} catch {
|
|
categoryContent = undefined;
|
|
}
|
|
|
|
const result = spawnSync('docusaurus', ['clean-api-docs', ...args], {
|
|
stdio: 'inherit',
|
|
shell: process.platform === 'win32',
|
|
});
|
|
|
|
if (result.error) {
|
|
throw result.error;
|
|
}
|
|
|
|
if (categoryContent !== undefined) {
|
|
mkdirSync(dirname(categoryPath), { recursive: true });
|
|
writeFileSync(categoryPath, categoryContent, 'utf8');
|
|
}
|
|
|
|
process.exit(result.status ?? 1);
|