-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(devkit): add method for tree-aware glob search #19128
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
b859794
to
288c1d9
Compare
288c1d9
to
f2474e9
Compare
* @param patterns A list of glob patterns | ||
* @returns Normalized paths in the workspace that match the provided glob patterns. | ||
*/ | ||
export async function glob(patterns: string[]): Promise<string[]>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm uneasy about exposing this version of it. Why use this instead of fast-glob
or some minimal wrapper of globset
? Anyways, I'd say we shouldn't do this until someone asks for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'd use this over fast-glob
or globset
when the intention is to be consistent with how globs run for the rest of Nx, I think its pretty valuable and I'd likely use it for nx-dotnet.
f2474e9
to
66a43f1
Compare
4f0600d
to
6cef621
Compare
8399ab3
to
1cea653
Compare
… point s.t. they do not get included in published code chore(core): move nx/internal-testing-utils -> nx/src/internal-testing-utils
1cea653
to
430ede0
Compare
|
||
const matches = new Set(globWithWorkspaceContext(root, patterns)); | ||
|
||
if ('root' in treeOrPatterns) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove the non-tree version.
430ede0
to
7bf5f48
Compare
This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request. |
Current Behavior
There is not an easy way to perform a glob search during a generator, as new files on the Tree will not show up, and files deleted on the Tree will still be visible.
Expected Behavior
There is a method exported from
@nx/devkit
to perform glob searches. Allowing it to be passed a Tree or just a list of patterns allows folks to take advantage of the glob search in generators, executors, or random scripts easily. This is important, as the glob search provided will also adhere to the way we do glob searches, and can help plugins become more uniform in how patterns are evaluated.Newly created files on the tree show up if it is provided, and deleted files are hidden.
Related Issue(s)
Fixes #