Closed etrepum closed 6 days ago
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 2:57pm |
lexical-playground | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | May 4, 2024 2:57pm |
@ivailop7 this one would be nice to have in the release as well, especially if there is some issue running extract-codes without it
@etrepum do you need to rebase this one before we merge?
@etrepum do you need to rebase this one before we merge?
I don't see any conflicts flagged by github here...
Description
Previously we had a rollup plugin and separate a babel plugin for managing error codes, which are a map of sequential integers to error message strings that are used in minified prod builds so that we are not shipping verbose error message strings.
Both plugins essentially did the same work, but the updating of the map was only done in the rollup plugin. This consolidates all of the functionality to the babel plugin which is now able to conditionally update the error map if the
--codes
argument was present.This PR also updates the postversion script to ensure that codes are generated before a release and ensures that the versions and package-lock.json are updated accordingly.
Code extraction is now integrated into
npm run build-release
(which is a dependency ofnpm run prepare-release
andnpm run release
) as a failsafe to ensure codes are updated before release.I chose not to update the filename for codes.json in this PR. I think we can do that separately in a follow-up to address the concern that the filename should let people know that it is generated. I think we should do a release with this first before changing too many more things.
Test plan
Before
npm run error-codes
was supposedly in a state where it no longer worked (re #5996)It was also easy to forget to do this before creating a release, which would leave error messages unextracted (larger prod build).
After
npm run increment-version
andnpm run build-release
(and anything downstream such asnpm run prepare-release
ornpm run release
) will generate the scripts/error-codes/codes.json file.The new unit tests should also pass!