Repository navigation
fix: keep test themes out of the published uniwind.css - #718
dlebedynskyi wants to merge 1 commit into
Conversation
Since 1.8.0 the uniwind.css in the npm package has ended with the theme
block that tests/test.css generates:
@theme {
--color-background: unset;
--app-foreground: unset;
}
The native test setup generated the package-root artifact, the file the
`style` export and `@import "uniwind"` resolve to, from tests/test.css.
The release workflow runs the tests and then publishes from the same
checkout, and the root postinstall marks the file assume-unchanged, so
git never showed the rewrite.
Build that file in the native setup the way a project without theme
variables would. The result matches the committed file, so test runs
leave it alone and still compile tests/test.css against what a fresh
install ships. The release workflow now also fails if uniwind.css
differs from the committed file before publishing.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (5)
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughNative test setup now builds ChangesCSS artifact verification
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to The described checks address test-theme leakage and release-time artifact drift. No specific remaining merge risk is established in the supplied review context. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
I ran into this while comparing generated artifacts on a fork. After a test run, my local packages/uniwind/uniwind.css ended with a @theme block, but git status was clean because postinstall marks the file assume-unchanged. Then I checked the published package (npm pack uniwind@1.12.2) and it has the same block, so the release job ships whatever the tests leave behind. Claude was able to root case and propose fix.
The
uniwind.cssin the npm package doesn't match the one in the repo. Since 1.8.0 it ends with the theme block thattests/test.cssgenerates:1.7.0 is clean. Every release from 1.8.0 through 1.12.2 ships the block.
Cause
tests/setup.native.tscallsgenerateArtifacts('./uniwind.css')fortests/test.css(added in c8ed75f). That rewrites the package-rootuniwind.css, which is the file thestyleexport and@import "uniwind"resolve to.release.yamlrunsbun run testand thenbun run releasein the same checkout, so npm publishes the rewritten file. The rootpostinstallmarks the fileassume-unchanged, sogit statusstays clean and nothing flags the change.Until Metro or Vite regenerates it, every install exposes the fixture's
--color-backgroundand--app-foregroundtheme variables to anything that reads@import "uniwind". The file also no longer matches what a project without theme variables generates, so that project's first bundle rewrites the installed copy.Fix
uniwind.cssthe way a project without theme variables would (tests/default.css). The result is identical to the committed file, sobuildCSSskips the write andtests/test.csscompiles against the artifact a fresh install ships. Jest workers can't race: they all produce the same content, and the only write (when an example app has changed the local copy) is atomic.tests/native/bundler/uniwind-css.test.tsfails ifuniwind.csscontains the themes generated fromtests/test.css.release.yamlfails before publishing ifuniwind.cssdiffers from the committed file.CONTEXT.mddocuments both.Testing
main, because the setup has just rewritten the file, and passes with this change.bun run test(native 204, web 48, e2e 9, types). Afterwards:uniwind.cssis byte-identical to the committed file.main, it exits 1.npm pack --dry-runandbun pm packship the committed file (21720 bytes, no@themeblock).apps/expo-examplefor iOS, Android and web, builtapps/vite-example, and bundledapps/bare.Summary by CodeRabbit