Skip to content

Commit

Permalink
[ML] Adjust globby to consider x-pack. Adds support for array based a…
Browse files Browse the repository at this point in the history
…uthor fields in manifests.
  • Loading branch information
walterra committed Jun 24, 2022
1 parent 0cc0cb5 commit aa7f90c
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions packages/kbn-docs-utils/src/api_docs/find_plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export function findPlugins(): PluginOrPackage[] {
*/
export function findPackages(): PluginOrPackage[] {
const packagePaths = globby
.sync(Path.resolve(REPO_ROOT, 'packages/**/package.json'), { absolute: true })
.sync(Path.resolve(REPO_ROOT, '{x-pack/,}packages/**/package.json'), { absolute: true })
.map((path) =>
// absolute paths returned from globby are using normalize or
// something so the path separators are `/` even on windows,
Expand All @@ -59,15 +59,22 @@ export function findPackages(): PluginOrPackage[] {
scope = ApiScope.CLIENT;
}

let ownerName = '[Owner missing]';
// Some of these author fields have "<[email protected]>" in the name which mdx chokes on. Removing the < and > seems to work.
if (Array.isArray(manifest.author)) {
ownerName = manifest.author.map((d) => d.replace(/[<>]/gi, '')).join(', ');
} else if (typeof manifest.author === 'string') {
ownerName = manifest.author.replace(/[<>]/gi, '');
}

acc.push({
directory: Path.dirname(path),
manifestPath: path,
manifest: {
...manifest,
id: manifest.name,
serviceFolders: [],
// Some of these author fields have "<[email protected]>" in the name which mdx chokes on. Removing the < and > seems to work.
owner: { name: manifest.author?.replace(/[<>]/gi, '') || '[Owner missing]' },
owner: { name: ownerName },
},
isPlugin: false,
scope,
Expand Down

0 comments on commit aa7f90c

Please sign in to comment.