-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ML] Adjust globby to consider x-pack. Adds support for array based a…
…uthor fields in manifests.
- Loading branch information
Showing
1 changed file
with
10 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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, | ||
|
@@ -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, | ||
|