-
Notifications
You must be signed in to change notification settings - Fork 1.6k
LFX'25:Update the pipeline to achieve clean build without any errors #16574
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
base: master
Are you sure you want to change the base?
Conversation
Great initiative. Can you comment on (or show a diff of) the before/after of the generated JS? You're asking for approval to merge something that transpiles/touches the site JavaScript; there's no point in showing a video which scrolls a bunch of random pages, we would need to see the before/after for things that are executed by these scripts. (p.s. generating the site takes ~20 seconds on my laptop. Do I read right that yours takes 440 seconds - 20 times longer? We need to do something about that!) |
I found that this PR is causing the |
@craigbox The work is not completed yet I'll ping you when it does. @AritraDey-Dev Yeah I agree with you that the file structure is different but I have resolved this I will push the changes in the meantime. |
@craigbox This PR is up for review , after this PR is merged istio/tools PR .Hopefully the lint will pass here. |
istio/tools#3222 LGTM but I'm not in the reviewer set. Daniel is, so I think that will go through today his time. |
@dhawton Can you kindly also review this PR and share your comments?It would be really helpful. |
Co-authored-by: Craig Box <[email protected]> Co-authored-by: Daniel Hawton <[email protected]>
Thanks @dhawton and @craigbox for the detailed review I have done the necessary changes. @keithmattix Can you kindly also review this PR? just to ensure everything looks good. |
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.
While running make serve, if I don't delete the tmp/js folder and try to run make serve again, I encounter the following error:
src/ts/callToAction.ts:14:7 - error TS2451: Cannot redeclare block-scoped variable 'callToActionDelayMs'.
14 const callToActionDelayMs = 250;
~~~~~~~~~~~~~~~~~~~
tmp/js/callToAction.js:15:7
15 const callToActionDelayMs = 250;
~~~~~~~~~~~~~~~~~~~
'callToActionDelayMs' was also declared here.
src/ts/callToAction.ts:16:10 - error TS2393: Duplicate function implementation.
16 function handleCallToAction(): void {
~~~~~~~~~~~~~~~~~~
src/ts/kbdnav.ts:15:7 - error TS2300: Duplicate identifier 'KbdNav'.
15 class KbdNav {
~~~~~~
tmp/js/kbdnav.js:15:7
15 class KbdNav {
~~~~~~
'KbdNav' was also declared here.
Found 3 errors in 2 files.
Errors Files
2 src/ts/callToAction.ts:14
1 src/ts/kbdnav.ts:15
make[1]: *** [Makefile.core.mk:83: site] Error 2
make: *** [Makefile:44: serve] Error 2
this was not the case before
Although this is dev-specific and won't occur in prod
Nice catch! The error happened because of leftover compiled files from the previous build you won't get this error before because how babel handles files is different then how esbuild handles them. BTW this is a quick fix. |
I just gave an example that running Also, after you build it, you’ll see a bunch of red squiggly lines — this shouldn’t happen. |
I think it's reasonable for a build to clean up any temporary files after using them? However the
|
@AritraDey-Dev esbuild isn't a transpiler like babel it also does bundling of files so this has to happen anyways.Regarding the export and imports I already told Craig that the repo is using global legacy code and converting them to ES6 modules is a good idea.Legacy code was used before ES6 and it was a standard then. It is obvious to clean temporary files before each build so that isn't a major issue here. For ex:- Try to compile a .ts file with estarget set to es6 you will get errors. |
In this case the entrypoint file should be generated by the build process IMO. It's just a listing of all the files to compile. Better we don't use one at all? |
Yes you are correct these are for compilation but having an entrypoint.js file seems like a good idea as Daniel mentioned it would be convenient for future maintainers and contributors to look into this file and get the idea of how things are working. |
Description
This PR replaces Babel with esbuild as the build tool for this repository. The main goals of this is to improve build performance, reduce configuration complexity, modernize the toolchain, and generate cleaner builds.
Overview
Babel has served as a popular JavaScript transpiler for years, but it comes with some downsides in the context of modern library development:
esbuild, on the other hand, is designed for speed and simplicity, with modern JavaScript/TypeScript support and built-in minification and bundling.
Technical Changes
Removed
@babel/core
@babel/preset-env
Anyother babel related dependency
Added
esbuild
as a dev dependencyTesting
Result
Reviewers