Skip to content

Commit ce7fdee

Browse files
committed
Add --filter option to API docs script
1 parent eacdbcd commit ce7fdee

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

src/dev/run_check_published_api_changes.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ interface Options {
163163
accept: boolean;
164164
docs: boolean;
165165
help: boolean;
166+
filter: string;
166167
}
167168

168169
async function run(
@@ -205,6 +206,7 @@ async function run(
205206
const extraFlags: string[] = [];
206207
const opts = (getopts(process.argv.slice(2), {
207208
boolean: ['accept', 'docs', 'help'],
209+
string: ['filter'],
208210
default: {
209211
project: undefined,
210212
},
@@ -222,6 +224,8 @@ async function run(
222224
opts.help = true;
223225
}
224226

227+
const folders = ['core/public', 'core/server', 'plugins/data/server', 'plugins/data/public'];
228+
225229
if (opts.help) {
226230
process.stdout.write(
227231
dedent(chalk`
@@ -240,9 +244,13 @@ async function run(
240244
{dim # Checks for and automatically accepts and updates documentation for any changes to the Kibana Core API}
241245
{dim $} node scripts/check_published_api_changes --accept
242246
247+
{dim # Only checks the core/public directory}
248+
{dim $} node scripts/check_published_api_changes --filter=core/public
249+
243250
Options:
244251
--accept {dim Accepts all changes by updating the API Review files and documentation}
245252
--docs {dim Updates the Core API documentation}
253+
--only {dim RegExp that folder names must match, folders: [${folders.join(', ')}]}
246254
--help {dim Show this message}
247255
`)
248256
);
@@ -258,9 +266,11 @@ async function run(
258266
return false;
259267
}
260268

261-
const folders = ['core/public', 'core/server', 'plugins/data/server', 'plugins/data/public'];
262-
263-
const results = await Promise.all(folders.map(folder => run(folder, { log, opts })));
269+
const results = await Promise.all(
270+
folders
271+
.filter(folder => (opts.filter.length ? folder.match(opts.filter) : true))
272+
.map(folder => run(folder, { log, opts }))
273+
);
264274

265275
if (results.find(r => r === false) !== undefined) {
266276
process.exitCode = 1;

0 commit comments

Comments
 (0)