Skip to content
This repository was archived by the owner on Sep 10, 2025. It is now read-only.

Commit 62bc2f7

Browse files
committed
feat: add trac back
1 parent e345792 commit 62bc2f7

1 file changed

Lines changed: 25 additions & 29 deletions

File tree

src/commands/init.ts

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import {
2222
isTypescriptProject,
2323
possibilityComponentsPath,
2424
possibilityCssPath,
25-
possibilityUtilsPath,
25+
possibilityUtilsPath
2626
} from "@/utils/helpers"
2727
import { error, grayText, highlight, info } from "@/utils/logging"
2828
import { getRepoUrlForComponent, getUtilsFolder } from "@/utils/repo"
@@ -47,7 +47,7 @@ export async function init(flags: {
4747
validate: (value) => {
4848
const normalizedValue = value.trim().toLowerCase()
4949
return ["y", "n", "yes", "no"].includes(normalizedValue) || "Please answer yes or no."
50-
},
50+
}
5151
})
5252

5353
const normalizedValue = shouldStartNewProject.trim().toLowerCase()
@@ -61,9 +61,9 @@ export async function init(flags: {
6161
message: "What language do you want to use?",
6262
choices: [
6363
{ name: "Typescript", value: "typescript" },
64-
{ name: "Javascript", value: "javascript" },
64+
{ name: "Javascript", value: "javascript" }
6565
],
66-
default: "typescript",
66+
default: "typescript"
6767
})
6868

6969
await startNewProject(normalizedValue as "y" | "n" | "yes" | "no", language)
@@ -79,10 +79,10 @@ export async function init(flags: {
7979
if (isRepoDirty()) {
8080
checkingGit.stop()
8181
error(
82-
"Git directory is not clean. Please stash or commit your changes before running the init command.",
82+
"Git directory is not clean. Please stash or commit your changes before running the init command."
8383
)
8484
info(
85-
`You may use the ${highlight("--force")} flag to silence this warning and perform the initialization anyway.`,
85+
`You may use the ${highlight("--force")} flag to silence this warning and perform the initialization anyway.`
8686
)
8787
process.exit(1)
8888
}
@@ -93,7 +93,7 @@ export async function init(flags: {
9393
const twExists = isTailwindInstalled()
9494
if (!twExists) {
9595
spinner.fail(
96-
"The tailwindcss package is not installed. Please install before running the init command.",
96+
"The tailwindcss package is not installed. Please install before running the init command."
9797
)
9898
spinner.stop()
9999
return
@@ -124,7 +124,7 @@ export async function init(flags: {
124124
message: "Components folder:",
125125
default: possibilityComponentsPath(),
126126
validate: (value) =>
127-
value.trim() !== "" || "Path cannot be empty. Please enter a valid path.",
127+
value.trim() !== "" || "Path cannot be empty. Please enter a valid path."
128128
})
129129

130130
uiFolder = path.join(componentFolder, "ui")
@@ -133,14 +133,14 @@ export async function init(flags: {
133133
message: "Utils folder:",
134134
default: possibilityUtilsPath(),
135135
validate: (value) =>
136-
value.trim() !== "" || "Path cannot be empty. Please enter a valid path.",
136+
value.trim() !== "" || "Path cannot be empty. Please enter a valid path."
137137
})
138138

139139
cssLocation = await input({
140140
message: "Where would you like to place the CSS file?",
141141
default: possibilityCssPath(),
142142
validate: (value) =>
143-
value.trim() !== "" || "Path cannot be empty. Please enter a valid path.",
143+
value.trim() !== "" || "Path cannot be empty. Please enter a valid path."
144144
})
145145
}
146146

@@ -199,7 +199,7 @@ export async function init(flags: {
199199
console.error(
200200
isTypescript
201201
? "Neither tsconfig.app.json nor tsconfig.json was found."
202-
: "jsconfig.json was not found.",
202+
: "jsconfig.json was not found."
203203
)
204204
process.exit(1)
205205
}
@@ -211,7 +211,7 @@ export async function init(flags: {
211211
config = JSON.parse(stripped)
212212
} catch {
213213
console.error(
214-
`Error reading ${configFilePath} file. Please check if it exists and is valid JSON.`,
214+
`Error reading ${configFilePath} file. Please check if it exists and is valid JSON.`
215215
)
216216
process.exit(1)
217217
}
@@ -223,7 +223,7 @@ export async function init(flags: {
223223
if (!("paths" in config.compilerOptions)) {
224224
const rootPath = "./src"
225225
config.compilerOptions.paths = {
226-
"@/*": [`${rootPath}/*`],
226+
"@/*": [`${rootPath}/*`]
227227
}
228228

229229
const spinner = ora(`Updating ${path.basename(configFilePath)} with paths...`).start()
@@ -262,19 +262,15 @@ export async function init(flags: {
262262
gray: selectedGray?.replace(".css", "")!,
263263
css: cssLocation,
264264
alias: currentAlias || undefined,
265-
language,
265+
language
266266
}
267267

268268
const packageManager = await getPackageManager()
269269

270-
const mainPackages = ["react-aria-components", "justd-icons"].join(" ")
270+
const mainPackages = ["react-aria-components", "tailwindcss-react-aria-components", "justd-icons"].join(" ")
271271

272272
let devPackages = ["tailwind-variants", "tailwind-merge", "clsx", "tailwindcss-animate"].join(" ")
273273

274-
if (isTailwind(3)) {
275-
devPackages += " tailwindcss-react-aria-components"
276-
}
277-
278274
if (isNextJs()) {
279275
devPackages += " next-themes"
280276
}
@@ -295,7 +291,7 @@ export async function init(flags: {
295291

296292
const child = spawn(installCommand, {
297293
stdio: ["ignore", "ignore", "ignore"],
298-
shell: true,
294+
shell: true
299295
})
300296

301297
await new Promise<void>((resolve) => {
@@ -314,13 +310,13 @@ export async function init(flags: {
314310
await writeCodeFile(createdConfig, {
315311
writePath: path.join(uiFolder, "primitive.tsx"),
316312
ogFilename: "primitive.tsx",
317-
content: fileContent,
313+
content: fileContent
318314
})
319315

320316
fs.writeFileSync(
321317
path.join(uiFolder, getCorrectFileExtension(language, "index.ts")),
322318
`export * from './primitive';`,
323-
{ flag: "w" },
319+
{ flag: "w" }
324320
)
325321

326322
const responseClasses = await fetch(getUtilsFolder("classes.ts"))
@@ -329,7 +325,7 @@ export async function init(flags: {
329325
await writeCodeFile(createdConfig, {
330326
writePath: path.join(utilsFolder, "classes.ts"),
331327
ogFilename: "classes.ts",
332-
content: fileContentClasses,
328+
content: fileContentClasses
333329
})
334330

335331
if (themeProvider) {
@@ -338,7 +334,7 @@ export async function init(flags: {
338334
await writeCodeFile(createdConfig, {
339335
ogFilename: "theme-provider.tsx",
340336
writePath: path.join(componentFolder, "theme-provider.tsx"),
341-
content: themeProviderContent,
337+
content: themeProviderContent
342338
})
343339

344340
if (providers) {
@@ -347,7 +343,7 @@ export async function init(flags: {
347343
await writeCodeFile(createdConfig, {
348344
ogFilename: "providers.tsx",
349345
writePath: path.join(componentFolder, "providers.tsx"),
350-
content: providersContent,
346+
content: providersContent
351347
})
352348
}
353349
}
@@ -363,17 +359,17 @@ export async function init(flags: {
363359
}
364360
spinner.succeed(`UI folder created at ${highlight(`${uiFolder}`)}`)
365361
spinner.succeed(
366-
`Primitive file saved to ${highlight(`${uiFolder}/${getCorrectFileExtension(language, "primitive.tsx")}`)}`,
362+
`Primitive file saved to ${highlight(`${uiFolder}/${getCorrectFileExtension(language, "primitive.tsx")}`)}`
367363
)
368364
spinner.succeed(
369-
`Classes file saved to ${highlight(`${utilsFolder}/${getCorrectFileExtension(language, "classes.ts")}`)}`,
365+
`Classes file saved to ${highlight(`${utilsFolder}/${getCorrectFileExtension(language, "classes.ts")}`)}`
370366
)
371367
if (themeProvider) {
372368
spinner.succeed(
373-
`Theme Provider file saved to ${highlight(`"${componentFolder}/${getCorrectFileExtension(language, "theme-provider.ts")}"`)}`,
369+
`Theme Provider file saved to ${highlight(`"${componentFolder}/${getCorrectFileExtension(language, "theme-provider.ts")}"`)}`
374370
)
375371
spinner.succeed(
376-
`Providers file saved to ${highlight(`"${componentFolder}/${getCorrectFileExtension(language, "providers.tsx")}"`)}`,
372+
`Providers file saved to ${highlight(`"${componentFolder}/${getCorrectFileExtension(language, "providers.tsx")}"`)}`
377373
)
378374
}
379375

0 commit comments

Comments
 (0)