-
-
Notifications
You must be signed in to change notification settings - Fork 133
fix: nativewind support tailwind css v3 for native app #455
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
@@ -0,0 +1,38 @@ | ||||
import consola from "consola"; | ||||
import pc from "picocolors"; | ||||
import type { ProjectConfig } from "../../types"; | ||||
import { addPackageDependency } from "../../utils/add-package-deps"; | ||||
|
||||
export async function setupFrontendDependencies(config: ProjectConfig) { | ||||
const { frontend, projectDir } = config; | ||||
|
||||
// Check if nativewind is being used | ||||
const hasNativeWind = frontend.includes("native-nativewind"); | ||||
const hasUnistyles = frontend.includes("native-unistyles"); | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Remove unused variable or implement Unistyles support. The - const hasUnistyles = frontend.includes("native-unistyles"); Alternatively, if Unistyles support is planned, consider implementing similar dependency setup logic for it. 📝 Committable suggestion
Suggested change
🧰 Tools🪛 Biome (2.1.2)[error] 11-11: This variable hasUnistyles is unused. Unused variables are often the result of an incomplete refactoring, typos, or other sources of bugs. (lint/correctness/noUnusedVariables) 🤖 Prompt for AI Agents
|
||||
|
||||
consola.info(`Frontend: ${frontend.join(", ")}`); | ||||
consola.info(`Has NativeWind: ${hasNativeWind}`); | ||||
consola.info(`Project Dir: ${projectDir}`); | ||||
|
||||
if (hasNativeWind) { | ||||
try { | ||||
consola.info("Adding TailwindCSS dependencies..."); | ||||
// Add TailwindCSS and related dependencies to root package.json | ||||
await addPackageDependency({ | ||||
devDependencies: ["autoprefixer", "postcss", "tailwindcss"], | ||||
projectDir, | ||||
}); | ||||
|
||||
consola.success( | ||||
pc.green("Added TailwindCSS dependencies to root package.json"), | ||||
); | ||||
} catch (error) { | ||||
consola.error(pc.red("Failed to add TailwindCSS dependencies")); | ||||
if (error instanceof Error) { | ||||
consola.error(pc.red(error.message)); | ||||
} | ||||
} | ||||
} else { | ||||
consola.info("NativeWind not detected, skipping TailwindCSS dependencies"); | ||||
} | ||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pin exact Tailwind version and correct PostCSS release to avoid install failures
postcss@8.5.6
has not been published on npm (latest 8.x is 8.4.x). Trying to install it will break project generation.^3.4.17
risks silently bumping to 3.5/3.6 once they are released and re-introducing the incompatibility we’re fixing.Pinning all three to published, known-good versions guarantees reproducible scaffolding across package managers and CI.
📝 Committable suggestion
🤖 Prompt for AI Agents