feat: include option in init
This commit is contained in:
parent
0a2a68ac47
commit
60f3868ef4
|
|
@ -104,7 +104,7 @@ Would you like to use TypeScript (recommended)? no / yes
|
||||||
Which framework are you using? Astro
|
Which framework are you using? Astro
|
||||||
Which style would you like to use? › Default
|
Which style would you like to use? › Default
|
||||||
Which color would you like to use as base color? › Slate
|
Which color would you like to use as base color? › Slate
|
||||||
Where is your typescript configuration file? › ./tsconfig.json
|
Where is your tsconfig.json located? › ./tsconfig.json
|
||||||
Where is your global CSS file? › src/styles/globals.css
|
Where is your global CSS file? › src/styles/globals.css
|
||||||
Do you want to use CSS variables for colors? › no / yes
|
Do you want to use CSS variables for colors? › no / yes
|
||||||
Where is your tailwind.config located? › tailwind.config.mjs
|
Where is your tailwind.config located? › tailwind.config.mjs
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ Would you like to use TypeScript (recommended)? no / yes
|
||||||
Which framework are you using? Vite / Nuxt / Laravel
|
Which framework are you using? Vite / Nuxt / Laravel
|
||||||
Which style would you like to use? › Default
|
Which style would you like to use? › Default
|
||||||
Which color would you like to use as base color? › Slate
|
Which color would you like to use as base color? › Slate
|
||||||
Where is your typescript configuration file? › ./tsconfig.json
|
Where is your tsconfig.json located? › ./tsconfig.json
|
||||||
Where is your global CSS file? › resources/css/app.css
|
Where is your global CSS file? › resources/css/app.css
|
||||||
Do you want to use CSS variables for colors? › no / yes
|
Do you want to use CSS variables for colors? › no / yes
|
||||||
Where is your tailwind.config.js located? › tailwind.config.js
|
Where is your tailwind.config.js located? › tailwind.config.js
|
||||||
|
|
|
||||||
|
|
@ -184,7 +184,7 @@ Would you like to use TypeScript (recommended)? no / yes
|
||||||
Which framework are you using? Vite / Nuxt / Laravel
|
Which framework are you using? Vite / Nuxt / Laravel
|
||||||
Which style would you like to use? › Default
|
Which style would you like to use? › Default
|
||||||
Which color would you like to use as base color? › Slate
|
Which color would you like to use as base color? › Slate
|
||||||
Where is your typescript configuration file? › ./tsconfig.json
|
Where is your tsconfig.json located? › ./tsconfig.json
|
||||||
Where is your global CSS file? › › src/index.css
|
Where is your global CSS file? › › src/index.css
|
||||||
Do you want to use CSS variables for colors? › no / yes
|
Do you want to use CSS variables for colors? › no / yes
|
||||||
Where is your tailwind.config.js located? › tailwind.config.js
|
Where is your tailwind.config.js located? › tailwind.config.js
|
||||||
|
|
|
||||||
|
|
@ -159,7 +159,7 @@ Would you like to use TypeScript (recommended)? no / yes
|
||||||
Which framework are you using? Vite / Nuxt / Laravel
|
Which framework are you using? Vite / Nuxt / Laravel
|
||||||
Which style would you like to use? › Default
|
Which style would you like to use? › Default
|
||||||
Which color would you like to use as base color? › Slate
|
Which color would you like to use as base color? › Slate
|
||||||
Where is your typescript configuration file? › ./tsconfig.json
|
Where is your tsconfig.json located? › ./tsconfig.json
|
||||||
Where is your global CSS file? › › src/index.css
|
Where is your global CSS file? › › src/index.css
|
||||||
Do you want to use CSS variables for colors? › no / yes
|
Do you want to use CSS variables for colors? › no / yes
|
||||||
Where is your tailwind.config.js located? › tailwind.config.js
|
Where is your tailwind.config.js located? › tailwind.config.js
|
||||||
|
|
|
||||||
|
|
@ -135,6 +135,16 @@ export async function promptForConfig(
|
||||||
value: color.name,
|
value: color.name,
|
||||||
})),
|
})),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
type: 'text',
|
||||||
|
name: 'tsConfigPath',
|
||||||
|
message: (prev, values) => `Where is your ${highlight(values.typescript ? 'tsconfig.json' : 'jsconfig.json')} file?`,
|
||||||
|
initial: (prev, values) => {
|
||||||
|
const prefix = values.framework === 'nuxt' ? '.nuxt/' : './'
|
||||||
|
const path = values.typescript ? 'tsconfig.json' : 'jsconfig.json'
|
||||||
|
return prefix + path
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
type: 'text',
|
type: 'text',
|
||||||
name: 'tailwindCss',
|
name: 'tailwindCss',
|
||||||
|
|
@ -189,6 +199,7 @@ export async function promptForConfig(
|
||||||
$schema: 'https://shadcn-vue.com/schema.json',
|
$schema: 'https://shadcn-vue.com/schema.json',
|
||||||
style: options.style,
|
style: options.style,
|
||||||
typescript: options.typescript,
|
typescript: options.typescript,
|
||||||
|
tsConfigPath: options.tsConfigPath,
|
||||||
framework: options.framework,
|
framework: options.framework,
|
||||||
tailwind: {
|
tailwind: {
|
||||||
config: options.tailwindConfig,
|
config: options.tailwindConfig,
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ export const rawConfigSchema = z
|
||||||
$schema: z.string().optional(),
|
$schema: z.string().optional(),
|
||||||
style: z.string(),
|
style: z.string(),
|
||||||
typescript: z.boolean().default(true),
|
typescript: z.boolean().default(true),
|
||||||
|
tsConfigPath: z.string().default(DEFAULT_TYPESCRIPT_CONFIG),
|
||||||
tailwind: z.object({
|
tailwind: z.object({
|
||||||
config: z.string(),
|
config: z.string(),
|
||||||
css: z.string(),
|
css: z.string(),
|
||||||
|
|
@ -33,7 +34,6 @@ export const rawConfigSchema = z
|
||||||
prefix: z.string().optional(),
|
prefix: z.string().optional(),
|
||||||
}),
|
}),
|
||||||
framework: z.string().default('Vite'),
|
framework: z.string().default('Vite'),
|
||||||
tsConfigPath: z.string().default('./tsconfig.json'),
|
|
||||||
aliases: z.object({
|
aliases: z.object({
|
||||||
components: z.string(),
|
components: z.string(),
|
||||||
utils: z.string(),
|
utils: z.string(),
|
||||||
|
|
@ -85,10 +85,9 @@ export async function resolveConfigPaths(cwd: string, config: RawConfig) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
tsConfigPath = path.resolve(cwd, './jsconfig.json')
|
tsConfigPath = config.tsConfigPath.includes('tsconfig.json') ? path.resolve(cwd, './jsconfig.json') : path.resolve(cwd, config.tsConfigPath)
|
||||||
tsConfig = loadConfig(tsConfigPath)
|
tsConfig = loadConfig(tsConfigPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tsConfig.resultType === 'failed') {
|
if (tsConfig.resultType === 'failed') {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Failed to load ${tsConfigPath}. ${tsConfig.message ?? ''}`.trim(),
|
`Failed to load ${tsConfigPath}. ${tsConfig.message ?? ''}`.trim(),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user