refactor: 815 shadcn-nuxt dependencies and CLI init
Closes: 815
This commit is contained in:
parent
f9615d3657
commit
04b647217c
|
|
@ -30,6 +30,9 @@
|
||||||
"taze": "taze major -frI --ignore-paths ./packages/cli/test/** --exclude typescript,/@iconify/",
|
"taze": "taze major -frI --ignore-paths ./packages/cli/test/** --exclude typescript,/@iconify/",
|
||||||
"taze:minor": "taze minor -fwri --ignore-paths ./packages/cli/test/** --exclude /@iconify/"
|
"taze:minor": "taze minor -fwri --ignore-paths ./packages/cli/test/** --exclude /@iconify/"
|
||||||
},
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"shadcn-nuxt": "^0.10.4"
|
||||||
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@antfu/eslint-config": "^3.6.2",
|
"@antfu/eslint-config": "^3.6.2",
|
||||||
"@commitlint/cli": "^19.5.0",
|
"@commitlint/cli": "^19.5.0",
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,10 @@ import { Command } from 'commander'
|
||||||
import { consola } from 'consola'
|
import { consola } from 'consola'
|
||||||
import { colors } from 'consola/utils'
|
import { colors } from 'consola/utils'
|
||||||
import { template } from 'lodash-es'
|
import { template } from 'lodash-es'
|
||||||
import { addDependency, addDevDependency } from 'nypm'
|
import { addDependency } from 'nypm'
|
||||||
import ora from 'ora'
|
import ora from 'ora'
|
||||||
import path from 'pathe'
|
import path from 'pathe'
|
||||||
import prompts from 'prompts'
|
import prompts from 'prompts'
|
||||||
import { gte } from 'semver'
|
|
||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
import {
|
import {
|
||||||
type Config,
|
type Config,
|
||||||
|
|
@ -40,9 +39,6 @@ const PROJECT_DEPENDENCIES = {
|
||||||
'tailwind-merge',
|
'tailwind-merge',
|
||||||
'radix-vue',
|
'radix-vue',
|
||||||
],
|
],
|
||||||
nuxt: [
|
|
||||||
'@nuxtjs/tailwindcss',
|
|
||||||
],
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const initOptionsSchema = z.object({
|
const initOptionsSchema = z.object({
|
||||||
|
|
@ -310,23 +306,18 @@ export async function runInit(cwd: string, config: Config) {
|
||||||
// Install dependencies.
|
// Install dependencies.
|
||||||
const dependenciesSpinner = ora('Installing dependencies...')?.start()
|
const dependenciesSpinner = ora('Installing dependencies...')?.start()
|
||||||
|
|
||||||
// Starting from `shadcn-nuxt` version 0.10.4, Base dependencies are handled by the module so no need to re-add them by the CLI
|
// Starting from `shadcn-nuxt` version 0.10.4, Base dependencies are handled by the module so no need to re-add them by the CLI.
|
||||||
const baseDeps = gte(shadcnNuxt?.version || '0.0.0', '0.10.4') ? [] : PROJECT_DEPENDENCIES.base
|
|
||||||
const iconsDep = config.style === 'new-york' ? ['@radix-icons/vue'] : ['lucide-vue-next']
|
// Unfortunately, the dependencies are not available when using the latest `shadcn-nuxt` module. Hence why we need to rely on the CLI to install the required deps for both Nuxt 3 and Vue 3.
|
||||||
const deps = baseDeps.concat(iconsDep).filter(Boolean)
|
|
||||||
|
// Install the required deps.
|
||||||
|
const iconsDep = config.style === 'new-york' ? ['@radix-icons/vue'] : ['lucide-vue-next']
|
||||||
|
const deps = PROJECT_DEPENDENCIES.base.concat(iconsDep).filter(Boolean)
|
||||||
|
|
||||||
await Promise.allSettled(
|
|
||||||
[
|
|
||||||
config.framework === 'nuxt' && await addDevDependency(PROJECT_DEPENDENCIES.nuxt, {
|
|
||||||
cwd,
|
|
||||||
silent: true,
|
|
||||||
}),
|
|
||||||
await addDependency(deps, {
|
await addDependency(deps, {
|
||||||
cwd,
|
cwd,
|
||||||
silent: true,
|
silent: true,
|
||||||
}),
|
})
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
||||||
dependenciesSpinner?.succeed()
|
dependenciesSpinner?.succeed()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "shadcn-nuxt",
|
"name": "shadcn-nuxt",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "0.11.0",
|
"version": "0.10.4",
|
||||||
"description": "Add shadcn-vue module to Nuxt",
|
"description": "Add shadcn-vue module to Nuxt",
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
export default defineNuxtConfig({
|
export default defineNuxtConfig({
|
||||||
modules: ['@nuxtjs/tailwindcss', 'shadcn-nuxt'],
|
modules: ['shadcn-nuxt'],
|
||||||
shadcn: {
|
shadcn: {
|
||||||
prefix: 'Ui',
|
prefix: 'Ui',
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -10,11 +10,10 @@
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nuxtjs/tailwindcss": "^6.10.1",
|
"@nuxtjs/tailwindcss": "^6.10.1",
|
||||||
"embla-carousel-vue": "8.0.0-rc19",
|
"embla-carousel-vue": "8.0.0-rc19",
|
||||||
"lucide-vue-next": "^0.276.0"
|
"lucide-vue-next": "^0.276.0",
|
||||||
|
"shadcn-nuxt": "^0.10.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@nuxtjs/tailwindcss": "^6.12.0",
|
"nuxt": "latest"
|
||||||
"nuxt": "latest",
|
|
||||||
"shadcn-nuxt": "file:.."
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,10 @@ export default defineNuxtModule<ModuleOptions>({
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Install the `@nuxtjs/tailwindcss` module.
|
||||||
|
|
||||||
|
await installModule('@nuxtjs/tailwindcss')
|
||||||
|
|
||||||
// Installs the `@nuxtjs/color-mode` module.
|
// Installs the `@nuxtjs/color-mode` module.
|
||||||
|
|
||||||
await installModule('@nuxtjs/color-mode', {
|
await installModule('@nuxtjs/color-mode', {
|
||||||
|
|
|
||||||
1585
pnpm-lock.yaml
1585
pnpm-lock.yaml
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user