mirror of
https://github.com/libgit2/libgit2.git
synced 2026-06-22 06:26:26 +00:00
Introduce a "validate only" mode for docs generation
The API documentation generation is useful (in `--strict` mode) to determine whether all our APIs have sufficient documentation. Add a `--validate-only` mode that will run the validation without emitting the API JSON. This is useful for ensuring that the documentation is complete.
This commit is contained in:
1
script/api-docs/.gitignore
vendored
Normal file
1
script/api-docs/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
node_modules/
|
||||
@@ -63,6 +63,7 @@ async function headerPaths(p) {
|
||||
paths.push(...(await fs.readdir(fullPath)).
|
||||
filter((filename) => filename.endsWith('.h')).
|
||||
filter((filename) => !fileIgnoreList.includes(filename)).
|
||||
filter((filename) => filename !== 'deprecated.h' || !options.deprecateHard).
|
||||
map((filename) => `${fullPath}/${filename}`));
|
||||
}
|
||||
|
||||
@@ -1494,6 +1495,7 @@ program.option('--output <filename>')
|
||||
.option('--include <filename>', undefined, joinArguments)
|
||||
.option('--no-includes')
|
||||
.option('--deprecate-hard')
|
||||
.option('--validate-only')
|
||||
.option('--strict');
|
||||
program.parse();
|
||||
|
||||
@@ -1535,7 +1537,9 @@ if (options['include'] && !options['includes']) {
|
||||
const simplified = simplify(results);
|
||||
simplified['info'] = metadata;
|
||||
|
||||
console.log(JSON.stringify(simplified, null, 2));
|
||||
if (!options.validateOnly) {
|
||||
console.log(JSON.stringify(simplified, null, 2));
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
process.exit(1);
|
||||
|
||||
2
script/api-docs/package-lock.json
generated
2
script/api-docs/package-lock.json
generated
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "_generator",
|
||||
"name": "api-docs",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
|
||||
Reference in New Issue
Block a user