feat(template-generator): upgrade native expo templates to sdk 57#1091
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
68f4c67 to
11540e9
Compare
WalkthroughWorkspace build-approval rules, Turbo version selection, and native Expo/React Native template dependencies are updated across the template generator, with matching changes in generated template output and tests. ChangesTemplate generator, workspace approvals, and native template version bumps
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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 |
11540e9 to
a3f633c
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 68f4c678bb
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| "expo": "~57.0.1", | ||
| "expo-constants": "~57.0.2", | ||
| "expo-crypto": "~57.0.0", | ||
| "expo-dev-client": "~57.0.3", |
There was a problem hiding this comment.
Align expo-dev-client with SDK 57 bundle
For generated native-unistyles apps, this pins expo-dev-client to ~57.0.3, but the Expo SDK 57 DevClient reference lists the bundled version as ~57.0.2 (https://docs.expo.dev/versions/latest/sdk/dev-client/). Since Expo's upgrade flow asks users to run npx expo install --fix/expo-doctor, this template will be reported as out of sync and may be rewritten immediately after scaffolding; use the SDK-bundled range here.
Useful? React with 👍 / 👎.
a3f633c to
1065837
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 8a5f9299-cd5f-4a31-b7d5-9ce3f6d2ab21
⛔ Files ignored due to path filters (1)
bun.lockis excluded by!**/*.lock
📒 Files selected for processing (8)
apps/cli/test/pnpm-workspace.test.tspackage.jsonpackages/template-generator/src/templates.generated.tspackages/template-generator/src/utils/add-deps.tspackages/template-generator/templates/extras/pnpm-workspace.yaml.hbspackages/template-generator/templates/frontend/native/bare/package.json.hbspackages/template-generator/templates/frontend/native/unistyles/package.json.hbspackages/template-generator/templates/frontend/native/uniwind/package.json.hbs
✅ Files skipped from review due to trivial changes (1)
- packages/template-generator/src/utils/add-deps.ts
🚧 Files skipped from review as they are similar to previous changes (3)
- packages/template-generator/templates/frontend/native/bare/package.json.hbs
- packages/template-generator/templates/frontend/native/uniwind/package.json.hbs
- packages/template-generator/templates/frontend/native/unistyles/package.json.hbs
| {{#if (or (eq runtime "node") (eq webDeploy "cloudflare") (eq serverDeploy "cloudflare") (eq webDeploy "docker") (eq serverDeploy "docker") (eq orm "prisma") (includes addons "lefthook") (includes addons "nx") (includes addons "pwa") (includes addons "turborepo") (includes addons "vite-plus") (includes frontend "react-router") (includes frontend "next") (includes frontend "nuxt"))}} | ||
|
|
||
| # pnpm 11 blocks dependency lifecycle scripts unless they are approved here. | ||
| # Entries are scoped to packages this generated stack can pull in. | ||
| allowBuilds: | ||
| {{#if (or (eq runtime "node") (eq webDeploy "cloudflare") (eq serverDeploy "cloudflare") (eq webDeploy "docker") (eq serverDeploy "docker") (includes addons "vite-plus") (includes frontend "tanstack-start") (includes frontend "nuxt"))}} | ||
| {{#if (or (eq runtime "node") (eq webDeploy "cloudflare") (eq serverDeploy "cloudflare") (eq webDeploy "docker") (eq serverDeploy "docker") (includes addons "turborepo") (includes addons "vite-plus") (includes frontend "react-router") (includes frontend "nuxt"))}} | ||
| esbuild: true | ||
| {{/if}} |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Confirm the exact native frontend flag values and whether any native template
# dependency needs build-script approval (msgpackr-extract, msw, native modules).
rg -nP '"native-(bare|uniwind|unistyles)"' packages/template-generator/src -C2
rg -nP 'msgpackr-extract|msw' packages/template-generator -C3Repository: AmanVarshney01/create-better-t-stack
Length of output: 25978
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect the workspace template and the native/package gating logic around it.
ast-grep outline packages/template-generator/templates/extras/pnpm-workspace.yaml.hbs --view expanded || true
sed -n '1,120p' packages/template-generator/templates/extras/pnpm-workspace.yaml.hbs
echo
echo '--- template handler wiring ---'
sed -n '1,220p' packages/template-generator/src/template-handlers/extras.ts
echo
echo '--- package/config native detection ---'
sed -n '1,120p' packages/template-generator/src/template-handlers/packages.ts
echo
echo '--- search for allowBuilds / pnpm-workspace usage ---'
rg -n "allowBuilds|pnpm-workspace|ignoredBuiltDependencies|onlyBuiltDependencies|builtDependencies" packages/template-generator -C 3Repository: AmanVarshney01/create-better-t-stack
Length of output: 11000
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo '--- pnpm-related extras ---'
sed -n '1,220p' packages/template-generator/templates/extras/_npmrc.hbs
echo
echo '--- native package templates (deps) ---'
rg -n "msgpackr-extract|msw|sharp|esbuild|workerd|prisma|lefthook|nx|postinstall|prepare|install" packages/template-generator/src/templates.generated.ts packages/template-generator/templates packages/template-generator/src -C 2
echo
echo '--- native stack package handling ---'
sed -n '1,220p' packages/template-generator/src/template-handlers/frontend.ts
sed -n '1,220p' packages/template-generator/src/template-handlers/packages.tsRepository: AmanVarshney01/create-better-t-stack
Length of output: 50393
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo '--- native template manifests ---'
fd -a 'package.json.hbs' packages/template-generator/templates/frontend | rg 'native|expo' || true
fd -a '*.hbs' packages/template-generator/templates/frontend/native packages/template-generator/templates/frontend | rg 'native|expo' || true
echo
echo '--- inspect native-related package.json templates ---'
for f in \
$(fd -a 'package.json.hbs' packages/template-generator/templates | rg 'native|expo' || true)
do
echo "### $f"
sed -n '1,220p' "$f"
echo
done
echo
echo '--- search for lifecycle scripts in native-related generated templates ---'
rg -n '"(preinstall|install|postinstall|prepare|prepack|postpack|prepublishOnly|postpublish)"\s*:' packages/template-generator/templates packages/template-generator/src/templates.generated.ts -C 2 | rg 'native|expo|worklets|reanimated|gesture|svg|router|skia|mmkv|sentry|secure-store|async-storage' -C 2Repository: AmanVarshney01/create-better-t-stack
Length of output: 5566
🌐 Web query:
npm package manifests for react-native-reanimated react-native-worklets react-native-gesture-handler react-native-nitro-modules expo-dev-client install postinstall scripts
💡 Result:
In the React Native ecosystem, the use of postinstall scripts within package manifests is generally discouraged due to potential security risks and interference with package manager processes [1]. Below is a breakdown of the status for the requested packages: 1. react-native-reanimated: Does not include a postinstall script [1]. Older versions historically required workarounds like jetifier in postinstall [2], but modern configurations rely on standard build processes [3]. 2. react-native-worklets: Generally does not rely on postinstall scripts for end-user installation [4][5]. 3. react-native-gesture-handler: Does not include a postinstall script [6]. As with other libraries, historical needs for jetifier in postinstall are no longer applicable to modern React Native versions [7]. 4. react-native-nitro-modules: Has been observed containing a postinstall script (e.g., "postinstall": "bun build || exit 0") in some versions, which has occasionally caused issues in specific environments [8]. Users have sometimes employed patch-package to override or nullify this script in their local node_modules when conflicts arise [8]. 5. expo-dev-client: Does not use a postinstall script [9][10]. Configuration is managed via the Expo CLI (npx expo install) and standard native build processes like pod install [9][10]. Note: While these libraries generally avoid postinstall scripts, projects often use patch-package in their own package.json postinstall scripts to apply hotfixes to dependencies when necessary [11][12][13][14][15]. Additionally, Expo provides dedicated build lifecycle hooks (e.g., eas-build-post-install) for managing tasks during CI/CD builds, which should be used instead of standard postinstall scripts for environment-specific build steps [16].
Citations:
- 1: Migrate to yarn3 software-mansion/react-native-reanimated#5863
- 2: v1.3.0 doesn't work with jetify -r software-mansion/react-native-reanimated#411
- 3: https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/getting-started
- 4: https://registry.npmjs.org/react-native-worklets
- 5: https://docs.swmansion.com/react-native-worklets/docs/
- 6: [Monorepo] Move
scriptsdirectory to root software-mansion/react-native-gesture-handler#3506 - 7: Android 'react-native-gesture-handler' error software-mansion/react-native-gesture-handler#671
- 8: react-native-nitro-modules@npm:0.31.10 [0f065] couldn't be built successfully (exit code 1) mrousavy/nitro#1082
- 9: https://docs.expo.dev/bare/install-dev-builds-in-bare
- 10: https://docs.expo.dev/versions/latest/sdk/dev-client/
- 11: [3.16.1] [0.76.1] Implicit instantiation of undefined template 'std::basic_stringstream<char>' software-mansion/react-native-reanimated#6673
- 12: Reanimated issue if NDK version upgrade software-mansion/react-native-reanimated#8331
- 13: Without this patch web is not building software-mansion/react-native-reanimated#7897
- 14: Use path relative to the directory of Reanimated when checking its version. software-mansion/react-native-gesture-handler#1757
- 15: How to consume changed/forked RN-GH? (Android Package Name Problem) software-mansion/react-native-gesture-handler#1250
- 16: https://docs.expo.dev/build-reference/npm-hooks/
🌐 Web query:
react-native-nitro-modules 0.36.1 npm registry package.json scripts postinstall
💡 Result:
In the react-native-nitro-modules package, the postinstall script historically includes the command "bun build || exit 0;" [1][2][3]. This script is designed to trigger a build process using the Bun runtime upon package installation [1]. If you encounter issues with this script during installation—such as environments where Bun is not available or where the script fails—it has been noted in community discussions that some users mitigate this by patching the package.json to replace the command with a simple "exit 0;" [1]. The package is a core library for Nitro Modules, providing statically compiled bindings for React Native [4][5][6]. It is maintained as part of a monorepo, and its package.json scripts are integral to managing the library's build and versioning lifecycle [1][7].
Citations:
- 1: react-native-nitro-modules@npm:0.31.10 [0f065] couldn't be built successfully (exit code 1) mrousavy/nitro#1082
- 2: https://npmx.dev/package/react-native-nitro-modules/v/%5E0.29.6
- 3: https://npmx.dev/package/react-native-nitro-modules/v/0.25.2
- 4: https://github.com/mrousavy/react-native-nitro
- 5: https://github.com/mrousavy/nitro/tree/main/packages/react-native-nitro-modules
- 6: https://github.com/mrousavy/nitro/blob/main/packages/react-native-nitro-modules/README.md
- 7: mrousavy/nitro@8fb8668
Include native-unistyles in the allowBuilds gate. native-unistyles pulls in react-native-nitro-modules, which has a postinstall script (bun build || exit 0), so a pure native pnpm workspace can lose the whole allowlist and get blocked on install.
Summary
2.10.2in the repo and generated Turborepo stacksallowBuildsoutput to matchpnpm approve-buildsresults: add missingesbuildfor React Router/Turborepo stacks, keep real approvals likesharp,workerd, Prisma, Nuxt watcher deps, and remove stalemsw/nativemsgpackr-extractapprovalsVerification
bun test test/frontend.test.tsfromapps/clibun test test/pnpm-workspace.test.ts test/addons.test.tsfromapps/clibun run checkbun run buildnative-bare,native-uniwind, andnative-unistylesinto/tmp/bts-expo-sdk57and verified with npm/Expo checksnative-bare,native-uniwind, andnative-unistylesinto/tmp/bts-expo-pnpmwith--package-manager pnpmpnpm install --config.strict-dep-builds=truepnpm approve-builds --all-> no packages awaiting approvalpnpm exec expo install --fix-> dependencies up to datepnpm exec expo install --check --json->upToDate: truepnpm exec tsc --noEmitpnpm dlx expo-doctor@latest-> 20/20 checks passedpnpm exec expo export --platform web --clearpnpm install --config.strict-dep-builds=trueandpnpm approve-builds --allon representative generated stacks: React Router, Next.js, Nuxt, Prisma, Cloudflare/workerd, Vite+, and TurborepoDocs checked