Skip to content

Some build refactors/improvements #5440

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

Merged
merged 4 commits into from
Mar 11, 2024
Merged

Conversation

timmywil
Copy link
Member

@timmywil timmywil commented Mar 10, 2024

Summary

  • migrate more uses of fs.promises; use node: protocol. I had missed a lot because my vs code search index was off. I used git grep instead.
  • fix size comparison for slim files. I fixed this by preferring +slim. to + in the regex. It was only matching on the latter even for the slim file, which made it so comparisons between a dirty build and the saved branch were always off by 5-6 bytes.
  • make compare size cache readable for manual edits. This is in lieu of more complicated options added to the build command. It's not hard to just edit the JSON, but it might as well be readable.
  • Fix worker restarts for when a browser fails the acknowledgement test (I just broke this in Tests: add --hard-retries option to test runner #5438)

Checklist

Sorry, something went wrong.

@timmywil timmywil added the Build label Mar 10, 2024
@timmywil timmywil added this to the 4.0.0 milestone Mar 10, 2024
@timmywil timmywil requested a review from mgol March 10, 2024 16:30
@timmywil timmywil mentioned this pull request Mar 10, 2024
2 tasks
@@ -49,7 +49,7 @@ function makeReleaseCopies( Release ) {
].forEach( ( { filesMap, cdnFolder } ) => {
shell.mkdir( "-p", cdnFolder );

Object.keys( filesMap ).forEach( key => {
Object.keys( filesMap ).forEach( ( key ) => {
Copy link
Member Author

Choose a reason for hiding this comment

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

Ran prettier on this file

.readFileSync( builtFile, "utf8" )
.replace(
/"file":"([^"]+)"/,
"\"file\":\"" + unpathedFile.replace( /\.min\.map/, ".min.js\"" )
Copy link
Member

Choose a reason for hiding this comment

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

It'd probably be more readable as a template literal; quote escapes would also disappear:

Suggested change
"\"file\":\"" + unpathedFile.replace( /\.min\.map/, ".min.js\"" )
`"file":"${ unpathedFile.replace( /\.min\.map/, ".min.js\"" ) }`

I wonder, though - such replaces are risky, it's easy to match incorrectly and that can be hard to find. Why not parse this JSON, fix the fields and serialize again? We're doing something similar in SWC minify, although without the initial parsing as we already get an object.

Copy link
Member Author

@timmywil timmywil Mar 11, 2024

Choose a reason for hiding this comment

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

I'm fine making this a template literal, but I worry about changing the logic here as it would require testing releases. How about we change that with the release PR? I made a note of it.

Copy link
Member

Choose a reason for hiding this comment

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

Sure, that works!

@timmywil timmywil requested a review from mgol March 11, 2024 14:42
Copy link
Member

@mgol mgol left a comment

Choose a reason for hiding this comment

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

LGTM. The comment #5440 (comment) is yet to be addressed but that's going to happen in a separate release PR.

@timmywil timmywil merged commit fedffe7 into jquery:main Mar 11, 2024
@timmywil timmywil deleted the build-updates branch March 11, 2024 17:29
@jquery jquery deleted a comment from EricMujjona Sep 29, 2024
@jquery jquery deleted a comment from EricMujjona Sep 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

2 participants