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:minor": "taze minor -fwri --ignore-paths ./packages/cli/test/** --exclude /@iconify/"
|
||||
},
|
||||
"dependencies": {
|
||||
"shadcn-nuxt": "^0.10.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@antfu/eslint-config": "^3.6.2",
|
||||
"@commitlint/cli": "^19.5.0",
|
||||
|
|
|
|||
|
|
@ -4,11 +4,10 @@ import { Command } from 'commander'
|
|||
import { consola } from 'consola'
|
||||
import { colors } from 'consola/utils'
|
||||
import { template } from 'lodash-es'
|
||||
import { addDependency, addDevDependency } from 'nypm'
|
||||
import { addDependency } from 'nypm'
|
||||
import ora from 'ora'
|
||||
import path from 'pathe'
|
||||
import prompts from 'prompts'
|
||||
import { gte } from 'semver'
|
||||
import { z } from 'zod'
|
||||
import {
|
||||
type Config,
|
||||
|
|
@ -40,9 +39,6 @@ const PROJECT_DEPENDENCIES = {
|
|||
'tailwind-merge',
|
||||
'radix-vue',
|
||||
],
|
||||
nuxt: [
|
||||
'@nuxtjs/tailwindcss',
|
||||
],
|
||||
}
|
||||
|
||||
const initOptionsSchema = z.object({
|
||||
|
|
@ -310,23 +306,18 @@ export async function runInit(cwd: string, config: Config) {
|
|||
// Install dependencies.
|
||||
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
|
||||
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']
|
||||
const deps = baseDeps.concat(iconsDep).filter(Boolean)
|
||||
// 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.
|
||||
|
||||
// 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.
|
||||
|
||||
// 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, {
|
||||
cwd,
|
||||
silent: true,
|
||||
}),
|
||||
],
|
||||
)
|
||||
})
|
||||
|
||||
dependenciesSpinner?.succeed()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "shadcn-nuxt",
|
||||
"type": "module",
|
||||
"version": "0.11.0",
|
||||
"version": "0.10.4",
|
||||
"description": "Add shadcn-vue module to Nuxt",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
export default defineNuxtConfig({
|
||||
modules: ['@nuxtjs/tailwindcss', 'shadcn-nuxt'],
|
||||
modules: ['shadcn-nuxt'],
|
||||
shadcn: {
|
||||
prefix: 'Ui',
|
||||
},
|
||||
|
|
|
|||
|
|
@ -10,11 +10,10 @@
|
|||
"dependencies": {
|
||||
"@nuxtjs/tailwindcss": "^6.10.1",
|
||||
"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": {
|
||||
"@nuxtjs/tailwindcss": "^6.12.0",
|
||||
"nuxt": "latest",
|
||||
"shadcn-nuxt": "file:.."
|
||||
"nuxt": "latest"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,6 +59,10 @@ export default defineNuxtModule<ModuleOptions>({
|
|||
})
|
||||
})
|
||||
|
||||
// Install the `@nuxtjs/tailwindcss` module.
|
||||
|
||||
await installModule('@nuxtjs/tailwindcss')
|
||||
|
||||
// Installs the `@nuxtjs/color-mode` module.
|
||||
|
||||
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