-
-
Notifications
You must be signed in to change notification settings - Fork 165
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 1 commit
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 commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Verification agent 🧩 Analysis chainVerify dependency versions are defined in constants. Ensure that the dependencies being added ( 🏁 Script executed: #!/bin/bash
# Verify that TailwindCSS dependencies have versions defined in constants
ast-grep --pattern 'dependencyVersionMap = {
$$$
}' Length of output: 55 🏁 Script executed: #!/bin/bash
# Search for dependencyVersionMap constant definition across the codebase
rg --color=never "dependencyVersionMap" -n Length of output: 514 🏁 Script executed: #!/bin/bash
# Display the dependencyVersionMap entries to verify TailwindCSS dependencies
sed -n '30,100p' apps/cli/src/constants.ts Length of output: 1395 🏁 Script executed: #!/bin/bash
# Check if TailwindCSS dependencies have versions defined in dependencyVersionMap
rg --color=never -n '"autoprefixer"' apps/cli/src/constants.ts
rg --color=never -n '"postcss"' apps/cli/src/constants.ts
rg --color=never -n '"tailwindcss"' apps/cli/src/constants.ts Length of output: 188 Add missing TailwindCSS dependency versions to dependencyVersionMap The • File: apps/cli/src/constants.ts "autoprefixer": "<your-version-here>",
"postcss": "<your-version-here>",
"tailwindcss": "<your-version-here>", • Ensure the chosen versions match the TailwindCSS setup requirements for your project. 🧰 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
|
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
[email protected]
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