-
Notifications
You must be signed in to change notification settings - Fork 602
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
[heft] Introduce initial implementation of 'copyFiles' action #2333
Conversation
common/changes/@rushstack/heft/danade-copy-plugin_2020-11-02-23-47.json
Outdated
Show resolved
Hide resolved
const pattern: string = `**/*+(${escapedExtensions.join('|')})`; | ||
sourceFileRelativePaths = await this._expandGlobPatternAsync( | ||
resolvedSourceFolderPath, | ||
pattern, | ||
copyConfiguration.excludeGlobs | ||
); |
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 wonder if this would be faster if we crawled the filesystem explicitly and looked for files matching one of the extensions instead of constructing and evaluating a glob.
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.
Switched to fast-glob. We talked offline, but under the covers this uses micromatch
which is what I was planning on using anyway, alongside a manual crawl of the directory. We're also able to do a single call with multiple different glob patterns in one go, avoiding enumerating the filesystem multiple times when running patterns in the same folder. Ideally this should have the same perf as a custom solution, save for the additional calls we would have to make when targeting other sourceFolder
s
Another thought here would be that we could combine all globs across all copy configurations, while appending the individual sourceFolder
path to the glob, though I'm unsure if this would cause a perf hit, ie:
{
"sourceFolder": "src/subfolder",
"includeGlobs": [ "**/*.json", "**/*.md" ] // -> "includeGlobs": [ "src/subfolder/**/*.json", "src/subfolder/**/*.md" ]
...
}
common/changes/@rushstack/heft/danade-copy-plugin_2020-11-02-23-47.json
Outdated
Show resolved
Hide resolved
686db1e
to
b2396cf
Compare
982a1d6
to
bd17301
Compare
I've approved this PR. I don't want to block it. But I'm still not 100% sure about the perf implications of our design. Ideally the config file should encourage developers NOT to write globs that do an The idea I originally advocated seems to end up like this, which is complicated and awkward:
Maybe a simpler idea would be:
In other words, what if our engine detected inefficient globs (e.g. The Just something to think about... again, I don't want to hold up this PR. |
…lder not found issue.
The JSON schema changes from this PR have been published. |
Adds a new default Heft action named
copyFiles
. This action can run in all build events except clean, as there should be no need to copy any files on a clean.An example implementation of the schema to add the event is here:
Some use cases for this plugin could include:
src
directory, asCopyStaticAssetsPlugin
is used forReasons for glob (which has perf implications) instead of a more targeted folder/file copy design:
heft.json
updates in order to keep up-to-date with which files need copying