mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 11:03:30 +01:00
docs: split docs.api.json into multiple json files
This commit is contained in:
2
packages/scripts/bin/generateSplitDocumentation.js
Executable file
2
packages/scripts/bin/generateSplitDocumentation.js
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env node
|
||||
require('../dist/bin/generateSplitDocumentation.js');
|
||||
31
packages/scripts/bin/generateSplitDocumentation.ts
Normal file
31
packages/scripts/bin/generateSplitDocumentation.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env node
|
||||
/* eslint-disable n/shebang */
|
||||
import { readFile } from 'node:fs/promises';
|
||||
import process from 'node:process';
|
||||
import { createCommand } from 'commander';
|
||||
import packageFile from '../package.json';
|
||||
import { generateSplitDocumentation } from '../src/index.js';
|
||||
|
||||
export interface CLIOptions {
|
||||
custom: string;
|
||||
input: string[];
|
||||
newOutput: string;
|
||||
output: string;
|
||||
root: string;
|
||||
typescript: boolean;
|
||||
}
|
||||
|
||||
const command = createCommand().version(packageFile.version);
|
||||
|
||||
const program = command.parse(process.argv);
|
||||
program.opts<CLIOptions>();
|
||||
|
||||
console.log('Generating split documentation...');
|
||||
void generateSplitDocumentation({
|
||||
fetchPackageVersions: async (_) => {
|
||||
return ['main'];
|
||||
},
|
||||
fetchPackageVersionDocs: async (_, __) => {
|
||||
return JSON.parse(await readFile(`${process.cwd()}/docs/docs.api.json`, 'utf8'));
|
||||
},
|
||||
}).then(() => console.log('Generated split documentation.'));
|
||||
Reference in New Issue
Block a user