Skip to content

Conversation

Keyyard
Copy link

@Keyyard Keyyard commented Aug 22, 2025

this PR changed how copyFiles works by adding a filter for destination file size checking, by this when we compile it will save much more time of copying the same things again.

console.log(`Copying file ${inputPath} to ${fileDestinationPath}`);
try {
const destFileStats = FileSystem.getStatistics(fileDestinationPath);
if (destFileStats.size === pathStats.size) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I wonder if there is some more (cheap) scoping conditions we could use here, like one of the timestamp members just to make sure changes that result in the same file size are caught here.

Ideally we'd use something like a file hash but that's probably prohibitively expensive a lot of the time.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. The FileSystem.copyFiles API has an option for preserveTimestamps so that the destination aligns with the source location. That should make it so assuming you are caching builds locally, it'll only copy if the destination is older. https://github.com/microsoft/rushstack/blob/dac8e5ca3f474b6a2169a089f1b7e0e8a006237c/libraries/node-core-library/src/FileSystem.ts#L1156

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, I think I can make an update that:
If srcStats.size !== destStats.size -> copy.
Else if |srcStats.mtimeMs - destStats.mtimeMs| > MTIME_TOLERANCE_MS -> copy.
Else -> skip copy.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have just committed the latest change!

@JakeShirley
Copy link
Contributor

I will queue this up for some team discussions next week @Keyyard, thanks a ton for the PR :)

@Keyyard
Copy link
Author

Keyyard commented Aug 23, 2025

hey, i know this is kinda off topic, but i made a npm package to help developers get started with add-on creations within a minute. I wonder if i can show you here? I have made a website for it as well.

Let me just attach it here just in case, this is a big pleasure of mine to having you seen it!

Website Github NPM

@Keyyard Keyyard requested a review from JakeShirley August 27, 2025 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants