Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 46 additions & 6 deletions apps/cli/test/pnpm-workspace.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ describe("pnpm workspace", () => {

expect(workspace.allowBuilds).toMatchObject({
esbuild: true,
msw: true,
sharp: true,
workerd: true,
});
Expand Down Expand Up @@ -118,7 +117,28 @@ describe("pnpm workspace", () => {
expect(workspace.allowBuilds).toEqual({ esbuild: true });
});

it("adds only the React UI approval when no other build-script deps are expected", async () => {
it("adds esbuild approval for Turborepo stacks", async () => {
const workspace = await readPnpmWorkspace({
projectName: "pnpm-turborepo",
frontend: ["tanstack-router"],
backend: "hono",
runtime: "bun",
api: "trpc",
database: "sqlite",
orm: "drizzle",
auth: "none",
payments: "none",
addons: ["turborepo"],
examples: ["none"],
dbSetup: "none",
webDeploy: "none",
serverDeploy: "none",
});

expect(workspace.allowBuilds).toEqual({ esbuild: true });
});

it("does not add build approvals for TanStack Router without lifecycle-script dependencies", async () => {
const workspace = await readPnpmWorkspace({
projectName: "pnpm-react-ui",
frontend: ["tanstack-router"],
Expand All @@ -136,7 +156,28 @@ describe("pnpm workspace", () => {
serverDeploy: "none",
});

expect(workspace.allowBuilds).toEqual({ msw: true });
expect(workspace.allowBuilds).toBeUndefined();
});

it("adds esbuild approval for a plain React Router frontend", async () => {
const workspace = await readPnpmWorkspace({
projectName: "pnpm-react-router-ui",
frontend: ["react-router"],
backend: "none",
runtime: "none",
api: "none",
database: "none",
orm: "none",
auth: "none",
payments: "none",
addons: ["none"],
examples: ["none"],
dbSetup: "none",
webDeploy: "none",
serverDeploy: "none",
});

expect(workspace.allowBuilds).toEqual({ esbuild: true });
});

it("adds build approvals for a plain Next.js frontend", async () => {
Expand All @@ -158,7 +199,6 @@ describe("pnpm workspace", () => {
});

expect(workspace.allowBuilds).toEqual({
msw: true,
sharp: true,
});
});
Expand Down Expand Up @@ -188,7 +228,7 @@ describe("pnpm workspace", () => {
});
});

it("adds build approvals for native Expo stacks", async () => {
it("does not add build approvals for native Expo stacks without lifecycle-script dependencies", async () => {
const workspace = await readPnpmWorkspace({
projectName: "pnpm-native-expo",
frontend: ["native-bare"],
Expand All @@ -206,7 +246,7 @@ describe("pnpm workspace", () => {
serverDeploy: "none",
});

expect(workspace.allowBuilds).toEqual({ "msgpackr-extract": true });
expect(workspace.allowBuilds).toBeUndefined();
});

it("adds build approvals for Docker deploys so non-interactive installs succeed", async () => {
Expand Down
16 changes: 8 additions & 8 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"lint-staged": "^17.0.4",
"oxfmt": "catalog:",
"oxlint": "^1.64.0",
"turbo": "^2.9.12",
"turbo": "^2.10.2",
"typescript": "catalog:"
},
"lint-staged": {
Expand Down
144 changes: 68 additions & 76 deletions packages/template-generator/src/templates.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25293,20 +25293,14 @@ declare module "cloudflare:workers" {
["extras/pnpm-workspace.yaml.hbs", `packages:
- "apps/*"
- "packages/*"
{{#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 "vite-plus") (includes frontend "tanstack-router") (includes frontend "react-router") (includes frontend "tanstack-start") (includes frontend "next") (includes frontend "nuxt") (includes frontend "native-bare") (includes frontend "native-uniwind") (includes frontend "native-unistyles"))}}
{{#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}}
{{#if (or (includes frontend "tanstack-router") (includes frontend "react-router") (includes frontend "tanstack-start") (includes frontend "next"))}}
msw: true
{{/if}}
{{#if (or (includes frontend "native-bare") (includes frontend "native-uniwind") (includes frontend "native-unistyles"))}}
msgpackr-extract: true
{{/if}}
{{#if (includes frontend "nuxt")}}
"@parcel/watcher": true
vue-demi: true
Expand Down Expand Up @@ -26756,39 +26750,38 @@ module.exports = config;
"web": "expo start --web"
},
"dependencies": {
"@expo/ui": "~56.0.12",
"@expo/ui": "~57.0.1",
"@expo/vector-icons": "^15.1.1",
"@tanstack/react-query": "^5.99.2",
"@tanstack/react-query": "^5.101.2",
{{#if (includes examples "ai")}}
"@stardazed/streams-text-encoding": "^1.0.2",
"@ungap/structured-clone": "^1.3.0",
"@ungap/structured-clone": "^1.3.2",
{{/if}}
"expo": "~56.0.3",
"expo-constants": "~56.0.14",
"expo-crypto": "~56.0.3",
"expo-font": "~56.0.5",
"expo-linking": "~56.0.11",
"expo-network": "~56.0.4",
"expo-router": "~56.2.5",
"expo-secure-store": "~56.0.4",
"expo-splash-screen": "~56.0.9",
"expo-status-bar": "~56.0.4",
"expo-system-ui": "~56.0.5",
"expo-web-browser": "~56.0.5",
"expo": "~57.0.1",
"expo-constants": "~57.0.2",
"expo-crypto": "~57.0.0",
"expo-font": "~57.0.0",
"expo-linking": "~57.0.1",
"expo-network": "~57.0.0",
"expo-router": "~57.0.2",
"expo-secure-store": "~57.0.0",
"expo-splash-screen": "~57.0.1",
"expo-status-bar": "~57.0.0",
"expo-system-ui": "~57.0.0",
"expo-web-browser": "~57.0.0",
"react": "19.2.3",
"react-dom": "19.2.3",
"react-native": "0.85.3",
"react-native-gesture-handler": "~2.31.1",
"react-native-reanimated": "4.3.1",
"react-native": "0.86.0",
"react-native-gesture-handler": "~2.32.0",
"react-native-reanimated": "4.5.0",
"react-native-safe-area-context": "~5.7.0",
"react-native-screens": "4.25.2",
"react-native-web": "~0.21.0",
"react-native-worklets": "0.8.3"
"react-native-worklets": "0.10.0"
},
"devDependencies": {
"@babel/core": "^7.29.0",
"@types/react": "~19.2.14",
"typescript": "^6"
"@types/react": "~19.2.17",
"typescript": "~6.0.3"
},
"private": true
}
Expand Down Expand Up @@ -28089,40 +28082,39 @@ module.exports = config;
"@expo/vector-icons": "^15.1.1",
{{#if (includes examples "ai")}}
"@stardazed/streams-text-encoding": "^1.0.2",
"@ungap/structured-clone": "^1.3.0",
"@ungap/structured-clone": "^1.3.2",
{{/if}}
"babel-preset-expo": "~56.0.0",
"expo": "~56.0.3",
"expo-constants": "~56.0.14",
"expo-crypto": "~56.0.3",
"expo-dev-client": "~56.0.14",
"expo-font": "~56.0.5",
"expo-linking": "~56.0.11",
"expo-network": "~56.0.4",
"expo-router": "~56.2.5",
"expo-secure-store": "~56.0.4",
"expo-splash-screen": "~56.0.9",
"expo-status-bar": "~56.0.4",
"expo-system-ui": "~56.0.5",
"expo-web-browser": "~56.0.5",
"babel-preset-expo": "~57.0.1",
"expo": "~57.0.1",
"expo-constants": "~57.0.2",
"expo-crypto": "~57.0.0",
"expo-dev-client": "~57.0.3",
"expo-font": "~57.0.0",
"expo-linking": "~57.0.1",
"expo-network": "~57.0.0",
"expo-router": "~57.0.2",
"expo-secure-store": "~57.0.0",
"expo-splash-screen": "~57.0.1",
"expo-status-bar": "~57.0.0",
"expo-system-ui": "~57.0.0",
"expo-web-browser": "~57.0.0",
"react": "19.2.3",
"react-dom": "19.2.3",
"react-native": "0.85.3",
"react-native-edge-to-edge": "^1.8.1",
"react-native-gesture-handler": "~2.31.1",
"react-native-nitro-modules": "^0.35.7",
"react-native-reanimated": "4.3.1",
"react-native": "0.86.0",
"react-native-gesture-handler": "~2.32.0",
"react-native-nitro-modules": "0.36.1",
"react-native-reanimated": "4.5.0",
"react-native-safe-area-context": "~5.7.0",
"react-native-screens": "4.25.2",
"react-native-unistyles": "^3.2.4",
"react-native-unistyles": "^3.2.5",
"react-native-web": "~0.21.0",
"react-native-worklets": "0.8.3"
"react-native-worklets": "0.10.0"
},
"devDependencies": {
"ajv": "^8.20.0",
"@babel/core": "^7.29.0",
"@types/react": "~19.2.14",
"typescript": "^6"
"@babel/core": "^7.29.7",
"@types/react": "~19.2.17",
"typescript": "~6.0.3"
}
}
`],
Expand Down Expand Up @@ -29220,44 +29212,44 @@ module.exports = uniwindConfig;
"web": "expo start --web"
},
"dependencies": {
"@expo/metro-runtime": "~56.0.11",
"@expo/metro-runtime": "~57.0.2",
"@expo/vector-icons": "^15.1.1",
"@gorhom/bottom-sheet": "^5.2.14",
{{#if (includes examples "ai")}}
"@stardazed/streams-text-encoding": "^1.0.2",
"@ungap/structured-clone": "^1.3.0",
"@ungap/structured-clone": "^1.3.2",
{{/if}}
"expo": "~56.0.3",
"expo-constants": "~56.0.14",
"expo-font": "~56.0.5",
"expo-haptics": "~56.0.3",
"expo-linking": "~56.0.11",
"expo-network": "~56.0.4",
"expo-router": "~56.2.5",
"expo-secure-store": "~56.0.4",
"expo-status-bar": "~56.0.4",
"expo-web-browser": "~56.0.5",
"expo": "~57.0.1",
"expo-constants": "~57.0.2",
"expo-font": "~57.0.0",
"expo-haptics": "~57.0.0",
"expo-linking": "~57.0.1",
"expo-network": "~57.0.0",
"expo-router": "~57.0.2",
"expo-secure-store": "~57.0.0",
"expo-status-bar": "~57.0.0",
"expo-web-browser": "~57.0.0",
"heroui-native": "^1.0.4",
"react": "19.2.3",
"react-dom": "19.2.3",
"react-native": "0.85.3",
"react-native-gesture-handler": "~2.31.1",
"react-native-keyboard-controller": "1.21.6",
"react-native-reanimated": "4.3.1",
"react-native": "0.86.0",
"react-native-gesture-handler": "~2.32.0",
"react-native-keyboard-controller": "1.21.9",
"react-native-reanimated": "4.5.0",
"react-native-safe-area-context": "~5.7.0",
"react-native-screens": "4.25.2",
"react-native-svg": "15.15.4",
"react-native-web": "~0.21.0",
"react-native-worklets": "0.8.3",
"react-native-worklets": "0.10.0",
"tailwind-merge": "^3.6.0",
"tailwind-variants": "^3.2.2",
"tailwindcss": "^4.3.0",
"tailwindcss": "^4.3.2",
"uniwind": "^1.9.0"
},
"devDependencies": {
"@types/node": "^25.9.1",
"@types/react": "~19.2.14",
"typescript": "^6"
"@types/node": "^26.0.1",
"@types/react": "~19.2.17",
"typescript": "~6.0.3"
}
}
`],
Expand Down
2 changes: 1 addition & 1 deletion packages/template-generator/src/utils/add-deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export const dependencyVersionMap = {
fastify: "^5.3.3",
"@fastify/cors": "^11.0.1",

turbo: "^2.9.16",
turbo: "^2.10.2",
nx: "^22.7.5",
"vite-plus": "0.1.24",
rolldown: "1.1.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
packages:
- "apps/*"
- "packages/*"
{{#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 "vite-plus") (includes frontend "tanstack-router") (includes frontend "react-router") (includes frontend "tanstack-start") (includes frontend "next") (includes frontend "nuxt") (includes frontend "native-bare") (includes frontend "native-uniwind") (includes frontend "native-unistyles"))}}
{{#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}}
Comment on lines +4 to 11

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎯 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 -C3

Repository: 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 3

Repository: 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.ts

Repository: 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 2

Repository: 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:


🌐 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:


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.

{{#if (or (includes frontend "tanstack-router") (includes frontend "react-router") (includes frontend "tanstack-start") (includes frontend "next"))}}
msw: true
{{/if}}
{{#if (or (includes frontend "native-bare") (includes frontend "native-uniwind") (includes frontend "native-unistyles"))}}
msgpackr-extract: true
{{/if}}
{{#if (includes frontend "nuxt")}}
"@parcel/watcher": true
vue-demi: true
Expand Down
Loading