liferay / liferay-frontend-projects

A monorepo containing assorted Frontend Infrastructure Team projects
Other
66 stars 67 forks source link

fix(npm-scripts): glob pattern isn't greedy enough if there are other patterns that want to look deeper in the directory #1139

Closed bryceosterhaus closed 1 year ago

bryceosterhaus commented 1 year ago

This issue originally appeared here, https://liferay.slack.com/archives/C03CAD9EF/p1684869953566979?thread_ts=1684869909.630399&cid=C03CAD9EF

Essentially the issue we are running into is that our expandGlobs function is returning too soon and not looking deep enough into a directory. For example, in portal we have the globs of ['/apps/*/*', '/apps/*/*/*']. This means we want to check for directories in both the 2nd and 3rd level deep from "apps". An example of this is that we would want to match both apps/frontend-js/frontend-js-web and additionally match apps/headless/headless-builder/headless-builder-web.

This doesn't actually work as we expected though because expandGlobs gets a postive hit for apps/headless/headless-builder and then doesn't look any deeper. The change I am making here ensures that we continue to look deeper in the file structure in case another matcher returns a hit.

The first commit is my fix

The second commit is an improvement because I noticed we were at times globbing way more files than we wanted.

izaera commented 1 year ago

LGTM

bryceosterhaus commented 1 year ago

Created this for the future https://issues.liferay.com/browse/LPS-185590