Skip to content
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

[build] Chore: Upgrade rollup and vite to latest versions #6018

Merged
merged 16 commits into from
May 4, 2024

Conversation

etrepum
Copy link
Contributor

@etrepum etrepum commented May 3, 2024

Description

rollup and vite have not been upgraded in some time, it makes sense to keep them up to date

Packages upgraded:

  • rollup (and all plugins)
  • vite (and all plugins)
  • eslint (and all plugins) - but only up to 8
    • Switched from flowtype to ft-flow due to change in fb preset.
    • Switched from deprecated babel-eslint to @babel/eslint-parser
  • docusaurus

I also upgraded most of the workflow actions because I was getting a spurious cache failure. I did not update to actions/upload-artifact@v4 which seemed like it might need some other config changes https://github.com/actions/upload-artifact?tab=readme-ov-file#breaking-changes

Other changes:

  • Lint fixes for the new eslint-plugin-simple-import-sort heuristics
  • playground's setupEnv.ts was getting tree shaken in prod because it was only performing side-effects so I refactored it and the settings panel which didn't really work correctly previously
  • playground now loads the dev (vercel, most tests) or prod (specific e2e tests) version of lexical from built artifacts rather than directly compiling the typescript (except when in serve mode, e.g. npm run start, so you can use hmr while developing locally)

Closes: #6012

Test plan

Before

Builds work and pass all tests

After

Builds still work and still pass all the tests

Copy link

vercel bot commented May 3, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lexical ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 4, 2024 4:34am
lexical-playground ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 4, 2024 4:34am

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label May 3, 2024
@etrepum etrepum changed the title [build] Chore: Upgrade rollup and vite to latest versions [WIP] [build] Chore: Upgrade rollup and vite to latest versions May 3, 2024
@ivailop7
Copy link
Collaborator

ivailop7 commented May 3, 2024

Thank you for doing this!

@etrepum etrepum marked this pull request as ready for review May 4, 2024 05:30
@etrepum etrepum changed the title [WIP] [build] Chore: Upgrade rollup and vite to latest versions [build] Chore: Upgrade rollup and vite to latest versions May 4, 2024
Copy link
Contributor

@potatowagon potatowagon left a comment

Choose a reason for hiding this comment

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

great work thankyou for this upgrade!

@zurfyx
Copy link
Member

zurfyx commented May 4, 2024

@ivailop7 @zurfyx one thing I noticed is that we were not currently deploying the prod build to the playground (probably after the esm refactor), but I just restored that behavior here. We were using a module resolution strategy that pointed vite directly to the typescript source files instead of the build products in dist.

I think maybe we should consider using the dev build of lexical on vercel, since it's much friendlier (in particular with regard to the tree view command history and potential error messages) and leave the prod verification to CI tasks… what do you all think? (RE #2460)

Thank you for doing this Bob! I think that's reasonable, the point of the prod build since we first introduced in the CI has always been to have some degree of certainty on a build that is slightly different than dev. We had some issues in the past with the rollup bundling that we didn't catch until it broke in prod. Currently, I think that the CI step that runs all E2E on prod already gives us this confidence so we can move on with your proposal.

Copy link
Member

@zurfyx zurfyx left a comment

Choose a reason for hiding this comment

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

I noticed that the port is 5173 now, I wonder how hard it is to make port 3000 back, no strong opinions though. Merging now to avoid the rebase churn.

@@ -1,45 +0,0 @@
#!/usr/bin/env node
Copy link
Member

Choose a reason for hiding this comment

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

I assume this is an unrelated cleanup

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this was supposed to be deleted in #5876

@@ -207,7 +207,7 @@ describe('LexicalNodeHelpers tests', () => {
test('DFS of empty ParagraphNode returns only itself', async () => {
const editor: LexicalEditor = testEnv.editor;

let paragraphKey;
let paragraphKey: string;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
let paragraphKey: string;
let paragraphKey: NodeKey;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

honestly I only did it this way because there's a plethora of other tests that use string for keys, might be a good lint for us to find variables named /[Kk]ey$/ with a string type!

@@ -26,11 +36,9 @@ export const LEGACY_EVENTS = process.env.E2E_EVENTS_MODE === 'legacy-events';
export const SAMPLE_IMAGE_URL =
E2E_PORT === 3000
? '/src/images/yellow-flower.jpg'
: '/assets/yellow-flower.a2a7c7a2.jpg';
: findAsset('yellow-flower*.jpg');
Copy link
Member

Choose a reason for hiding this comment

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

So much better, finding the suffix was always time-consuming

@zurfyx zurfyx merged commit 3e117f8 into facebook:main May 4, 2024
46 checks passed
@etrepum etrepum deleted the chore-upgrade-rollup-vite branch May 4, 2024 14:58
etrepum added a commit to etrepum/lexical that referenced this pull request May 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants