fix: nuxt config
This commit is contained in:
parent
22e46c16f5
commit
27ac382bf9
|
|
@ -7,8 +7,7 @@ import { execa } from 'execa'
|
|||
import ora from 'ora'
|
||||
import prompts from 'prompts'
|
||||
import * as z from 'zod'
|
||||
import { transformImport } from '../utils/transformers/transform-import'
|
||||
import { transformSFC } from '../utils/transformers/transform-sfc'
|
||||
import { transform } from '@/src/utils/transformers'
|
||||
import { getConfig } from '@/src/utils/get-config'
|
||||
import { getPackageManager } from '@/src/utils/get-package-manager'
|
||||
import { handleError } from '@/src/utils/handle-error'
|
||||
|
|
@ -130,15 +129,11 @@ export const add = new Command()
|
|||
if (existingComponent.length && !options.overwrite) {
|
||||
if (selectedComponents.includes(item.name)) {
|
||||
logger.warn(
|
||||
`\nComponent ${
|
||||
item.name
|
||||
} already exists. Use ${chalk.green(
|
||||
'--overwrite',
|
||||
)} to overwrite.`,
|
||||
`Component ${item.name} already exists. Use ${chalk.green(
|
||||
'--overwrite',
|
||||
)} to overwrite.`,
|
||||
)
|
||||
spinner.stop()
|
||||
process.exitCode = 1
|
||||
return
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
continue
|
||||
|
|
@ -152,14 +147,19 @@ export const add = new Command()
|
|||
file.name,
|
||||
)
|
||||
|
||||
// Run transformers.
|
||||
const content = await transformSFC(file, config)
|
||||
if (!config.typescript)
|
||||
filePath = filePath.replace(/\.ts$/, '.js')
|
||||
|
||||
if (!existsSync(componentDir))
|
||||
await fs.mkdir(componentDir, { recursive: true })
|
||||
|
||||
if (!config.typescript)
|
||||
filePath = filePath.replace(/\.ts$/, '.js')
|
||||
// Run transformers.
|
||||
const content = await transform({
|
||||
filename: file.name,
|
||||
raw: file.content,
|
||||
config,
|
||||
baseColor,
|
||||
})
|
||||
|
||||
await fs.writeFile(filePath, content)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -266,9 +266,8 @@ export async function runInit(cwd: string, config: Config) {
|
|||
const dependenciesSpinner = ora('Installing dependencies...')?.start()
|
||||
const packageManager = await getPackageManager(cwd)
|
||||
|
||||
// TODO: add support for other icon libraries.
|
||||
const deps = PROJECT_DEPENDENCIES.base.concat(
|
||||
config.framework === 'nuxt' ? PROJECT_DEPENDENCIES.nuxt : PROJECT_DEPENDENCIES.vue,
|
||||
config.framework === 'nuxt' ? PROJECT_DEPENDENCIES.nuxt : [],
|
||||
).concat(
|
||||
config.style === 'new-york' ? [] : ['lucide-vue-next'],
|
||||
).filter(Boolean)
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ export const DEFAULT_STYLE = 'default'
|
|||
export const DEFAULT_COMPONENTS = '@/components'
|
||||
export const DEFAULT_UTILS = '@/lib/utils'
|
||||
export const DEFAULT_TAILWIND_CSS = 'src/assets/index.css'
|
||||
export const DEFAULT_TAILWIND_CSS_NUXT = 'assets/style/tailwind.css'
|
||||
export const DEFAULT_TAILWIND_CSS_NUXT = 'assets/css/tailwind.css'
|
||||
export const DEFAULT_TAILWIND_CONFIG = 'tailwind.config.js'
|
||||
export const DEFAULT_TAILWIND_BASE_COLOR = 'slate'
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ export function useEmitAsProps<Name extends string>(
|
|||
const result: Record<string, any> = {}
|
||||
if (!events?.length) {
|
||||
console.warn(
|
||||
'No emitted event found. Please check component: \${vm?.type.__name}',
|
||||
\`No emitted event found. Please check component: \${vm?.type.__name}\`,
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,11 +6,11 @@ export const transformImport: Transformer = async ({ sourceFile, config }) => {
|
|||
for (const importDeclaration of importDeclarations) {
|
||||
const moduleSpecifier = importDeclaration.getModuleSpecifierValue()
|
||||
|
||||
// Replace @/registry/[style] with the components alias.
|
||||
if (moduleSpecifier.startsWith('@/registry/')) {
|
||||
// Replace @/lib/registry/[style] with the components alias.
|
||||
if (moduleSpecifier.startsWith('@/lib/registry/')) {
|
||||
importDeclaration.setModuleSpecifier(
|
||||
moduleSpecifier.replace(
|
||||
/^@\/registry\/[^/]+/,
|
||||
/^@\/lib\/registry\/[^/]+/,
|
||||
config.aliases.components,
|
||||
),
|
||||
)
|
||||
|
|
|
|||
25
packages/cli/test/fixtures/nuxt/app.vue
vendored
25
packages/cli/test/fixtures/nuxt/app.vue
vendored
|
|
@ -1,5 +1,28 @@
|
|||
<template>
|
||||
<div>
|
||||
<NuxtWelcome />
|
||||
<UiButton :variant="'secondary'" :size="'lg'">
|
||||
Save
|
||||
</UiButton>
|
||||
|
||||
<UiAlertDialog>
|
||||
<UiAlertDialogTrigger as-child>
|
||||
<UiButton variant="outline">
|
||||
Show Dialog
|
||||
</UiButton>
|
||||
</UiAlertDialogTrigger>
|
||||
<UiAlertDialogContent>
|
||||
<UiAlertDialogHeader>
|
||||
<UiAlertDialogTitle>Are you absolutely sure?</UiAlertDialogTitle>
|
||||
<UiAlertDialogDescription>
|
||||
This action cannot be undone. This will permanently delete your
|
||||
account and remove your data from our servers.
|
||||
</UiAlertDialogDescription>
|
||||
</UiAlertDialogHeader>
|
||||
<UiAlertDialogFooter>
|
||||
<UiAlertDialogCancel>Cancel</UiAlertDialogCancel>
|
||||
<UiAlertDialogAction>Continue</UiAlertDialogAction>
|
||||
</UiAlertDialogFooter>
|
||||
</UiAlertDialogContent>
|
||||
</UiAlertDialog>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -1,3 +1,78 @@
|
|||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
||||
@tailwind utilities;
|
||||
|
||||
@layer base {
|
||||
:root {
|
||||
--background: 0 0% 100%;
|
||||
--foreground: 222.2 84% 4.9%;
|
||||
|
||||
--muted: 210 40% 96.1%;
|
||||
--muted-foreground: 215.4 16.3% 46.9%;
|
||||
|
||||
--popover: 0 0% 100%;
|
||||
--popover-foreground: 222.2 84% 4.9%;
|
||||
|
||||
--card: 0 0% 100%;
|
||||
--card-foreground: 222.2 84% 4.9%;
|
||||
|
||||
--border: 214.3 31.8% 91.4%;
|
||||
--input: 214.3 31.8% 91.4%;
|
||||
|
||||
--primary: 222.2 47.4% 11.2%;
|
||||
--primary-foreground: 210 40% 98%;
|
||||
|
||||
--secondary: 210 40% 96.1%;
|
||||
--secondary-foreground: 222.2 47.4% 11.2%;
|
||||
|
||||
--accent: 210 40% 96.1%;
|
||||
--accent-foreground: 222.2 47.4% 11.2%;
|
||||
|
||||
--destructive: 0 84.2% 60.2%;
|
||||
--destructive-foreground: 210 40% 98%;
|
||||
|
||||
--ring: 222.2 84% 4.9%;
|
||||
|
||||
--radius: 0.5rem;
|
||||
}
|
||||
|
||||
.dark {
|
||||
--background: 222.2 84% 4.9%;
|
||||
--foreground: 210 40% 98%;
|
||||
|
||||
--muted: 217.2 32.6% 17.5%;
|
||||
--muted-foreground: 215 20.2% 65.1%;
|
||||
|
||||
--popover: 222.2 84% 4.9%;
|
||||
--popover-foreground: 210 40% 98%;
|
||||
|
||||
--card: 222.2 84% 4.9%;
|
||||
--card-foreground: 210 40% 98%;
|
||||
|
||||
--border: 217.2 32.6% 17.5%;
|
||||
--input: 217.2 32.6% 17.5%;
|
||||
|
||||
--primary: 210 40% 98%;
|
||||
--primary-foreground: 222.2 47.4% 11.2%;
|
||||
|
||||
--secondary: 217.2 32.6% 17.5%;
|
||||
--secondary-foreground: 210 40% 98%;
|
||||
|
||||
--accent: 217.2 32.6% 17.5%;
|
||||
--accent-foreground: 210 40% 98%;
|
||||
|
||||
--destructive: 0 62.8% 30.6%;
|
||||
--destructive-foreground: 210 40% 98%;
|
||||
|
||||
--ring: 212.7 26.8% 83.9%;
|
||||
}
|
||||
}
|
||||
|
||||
@layer base {
|
||||
* {
|
||||
@apply border-border;
|
||||
}
|
||||
body {
|
||||
@apply bg-background text-foreground;
|
||||
}
|
||||
}
|
||||
15
packages/cli/test/fixtures/nuxt/components.json
vendored
Normal file
15
packages/cli/test/fixtures/nuxt/components.json
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"style": "default",
|
||||
"typescript": true,
|
||||
"tailwind": {
|
||||
"config": "tailwind.config.js",
|
||||
"css": "assets/css/tailwind.css",
|
||||
"baseColor": "slate",
|
||||
"cssVariables": true
|
||||
},
|
||||
"framework": "nuxt",
|
||||
"aliases": {
|
||||
"components": "@/components",
|
||||
"utils": "@/lib/utils"
|
||||
}
|
||||
}
|
||||
16
packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialog.vue
vendored
Normal file
16
packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialog.vue
vendored
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
<script setup lang="ts">
|
||||
import { type AlertDialogEmits, type AlertDialogProps, AlertDialogRoot } from 'radix-vue'
|
||||
import { useEmitAsProps } from '@/lib/utils'
|
||||
|
||||
const props = defineProps<AlertDialogProps>()
|
||||
|
||||
const emits = defineEmits<AlertDialogEmits>()
|
||||
|
||||
const emitsAsProps = useEmitAsProps(emits)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<AlertDialogRoot v-bind="{ ...props, ...emitsAsProps }">
|
||||
<slot />
|
||||
</AlertDialogRoot>
|
||||
</template>
|
||||
13
packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogAction.vue
vendored
Normal file
13
packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogAction.vue
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<script setup lang="ts">
|
||||
import { AlertDialogAction, type AlertDialogActionProps } from 'radix-vue'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { buttonVariants } from '@/components/ui/button'
|
||||
|
||||
const props = defineProps<AlertDialogActionProps>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<AlertDialogAction v-bind="props" :class="cn(buttonVariants(), $attrs.class ?? '')">
|
||||
<slot />
|
||||
</AlertDialogAction>
|
||||
</template>
|
||||
13
packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogCancel.vue
vendored
Normal file
13
packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogCancel.vue
vendored
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
<script setup lang="ts">
|
||||
import { AlertDialogCancel, type AlertDialogCancelProps } from 'radix-vue'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { buttonVariants } from '@/components/ui/button'
|
||||
|
||||
const props = defineProps<AlertDialogCancelProps>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<AlertDialogCancel v-bind="props" :class="cn(buttonVariants({ variant: 'outline' }), 'mt-2 sm:mt-0', $attrs.class ?? '')">
|
||||
<slot />
|
||||
</AlertDialogCancel>
|
||||
</template>
|
||||
35
packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogContent.vue
vendored
Normal file
35
packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogContent.vue
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
<script setup lang="ts">
|
||||
import {
|
||||
AlertDialogContent,
|
||||
type AlertDialogContentEmits,
|
||||
type AlertDialogContentProps,
|
||||
AlertDialogOverlay,
|
||||
AlertDialogPortal,
|
||||
} from 'radix-vue'
|
||||
import { cn, useEmitAsProps } from '@/lib/utils'
|
||||
|
||||
const props = defineProps<AlertDialogContentProps & { class?: string }>()
|
||||
|
||||
const emits = defineEmits<AlertDialogContentEmits>()
|
||||
|
||||
const emitsAsProps = useEmitAsProps(emits)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<AlertDialogPortal>
|
||||
<AlertDialogOverlay
|
||||
class="fixed inset-0 z-50 bg-background/80 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"
|
||||
/>
|
||||
<AlertDialogContent
|
||||
v-bind="{ ...props, ...emitsAsProps }"
|
||||
:class="
|
||||
cn(
|
||||
'fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg md:w-full',
|
||||
props.class,
|
||||
)
|
||||
"
|
||||
>
|
||||
<slot />
|
||||
</AlertDialogContent>
|
||||
</AlertDialogPortal>
|
||||
</template>
|
||||
18
packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogDescription.vue
vendored
Normal file
18
packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogDescription.vue
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<script setup lang="ts">
|
||||
import {
|
||||
AlertDialogDescription,
|
||||
type AlertDialogDescriptionProps,
|
||||
} from 'radix-vue'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
const props = defineProps<AlertDialogDescriptionProps & { class?: string }>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<AlertDialogDescription
|
||||
:class="cn('text-muted-foreground text-sm', props.class)"
|
||||
:as-child="props.asChild"
|
||||
>
|
||||
<slot />
|
||||
</AlertDialogDescription>
|
||||
</template>
|
||||
23
packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogFooter.vue
vendored
Normal file
23
packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogFooter.vue
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<script setup lang="ts">
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
const props = defineProps({
|
||||
class: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
:class="
|
||||
cn(
|
||||
'flex flex-col space-y-2 sm:space-y-0 mt-3.5 sm:flex-row sm:justify-end sm:space-x-2',
|
||||
props.class,
|
||||
)
|
||||
"
|
||||
>
|
||||
<slot />
|
||||
</div>
|
||||
</template>
|
||||
18
packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogHeader.vue
vendored
Normal file
18
packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogHeader.vue
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<script setup lang="ts">
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
const props = defineProps({
|
||||
class: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
:class="cn('flex flex-col space-y-2 text-center sm:text-left', props.class)"
|
||||
>
|
||||
<slot />
|
||||
</div>
|
||||
</template>
|
||||
15
packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogTitle.vue
vendored
Normal file
15
packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogTitle.vue
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<script setup lang="ts">
|
||||
import { AlertDialogTitle, type AlertDialogTitleProps } from 'radix-vue'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
const props = defineProps<AlertDialogTitleProps & { class?: string }>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<AlertDialogTitle
|
||||
:as-child="props.asChild"
|
||||
:class="cn('text-lg text-foreground font-semibold', props.class)"
|
||||
>
|
||||
<slot />
|
||||
</AlertDialogTitle>
|
||||
</template>
|
||||
11
packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogTrigger.vue
vendored
Normal file
11
packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/AlertDialogTrigger.vue
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<script setup lang="ts">
|
||||
import { AlertDialogTrigger, type AlertDialogTriggerProps } from 'radix-vue'
|
||||
|
||||
const props = defineProps<AlertDialogTriggerProps>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<AlertDialogTrigger v-bind="props">
|
||||
<slot />
|
||||
</AlertDialogTrigger>
|
||||
</template>
|
||||
9
packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/index.ts
vendored
Normal file
9
packages/cli/test/fixtures/nuxt/components/ui/alert-dialog/index.ts
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
export { default as AlertDialog } from './AlertDialog.vue'
|
||||
export { default as AlertDialogTrigger } from './AlertDialogTrigger.vue'
|
||||
export { default as AlertDialogContent } from './AlertDialogContent.vue'
|
||||
export { default as AlertDialogHeader } from './AlertDialogHeader.vue'
|
||||
export { default as AlertDialogTitle } from './AlertDialogTitle.vue'
|
||||
export { default as AlertDialogDescription } from './AlertDialogDescription.vue'
|
||||
export { default as AlertDialogFooter } from './AlertDialogFooter.vue'
|
||||
export { default as AlertDialogAction } from './AlertDialogAction.vue'
|
||||
export { default as AlertDialogCancel } from './AlertDialogCancel.vue'
|
||||
23
packages/cli/test/fixtures/nuxt/components/ui/button/Button.vue
vendored
Normal file
23
packages/cli/test/fixtures/nuxt/components/ui/button/Button.vue
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<script setup lang="ts">
|
||||
import { buttonVariants } from '.'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
interface Props {
|
||||
variant?: NonNullable<Parameters<typeof buttonVariants>[0]>['variant']
|
||||
size?: NonNullable<Parameters<typeof buttonVariants>[0]>['size']
|
||||
as?: string
|
||||
}
|
||||
|
||||
withDefaults(defineProps<Props>(), {
|
||||
as: 'button',
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<component
|
||||
:is="as"
|
||||
:class="cn(buttonVariants({ variant, size }), $attrs.class ?? '')"
|
||||
>
|
||||
<slot />
|
||||
</component>
|
||||
</template>
|
||||
32
packages/cli/test/fixtures/nuxt/components/ui/button/index.ts
vendored
Normal file
32
packages/cli/test/fixtures/nuxt/components/ui/button/index.ts
vendored
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
import { cva } from 'class-variance-authority'
|
||||
|
||||
export { default as Button } from './Button.vue'
|
||||
|
||||
export const buttonVariants = cva(
|
||||
'inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50',
|
||||
{
|
||||
variants: {
|
||||
variant: {
|
||||
default: 'bg-primary text-primary-foreground hover:bg-primary/90',
|
||||
destructive:
|
||||
'bg-destructive text-destructive-foreground hover:bg-destructive/90',
|
||||
outline:
|
||||
'border border-input bg-background hover:bg-accent hover:text-accent-foreground',
|
||||
secondary:
|
||||
'bg-secondary text-secondary-foreground hover:bg-secondary/80',
|
||||
ghost: 'hover:bg-accent hover:text-accent-foreground',
|
||||
link: 'text-primary underline-offset-4 hover:underline',
|
||||
},
|
||||
size: {
|
||||
default: 'h-10 px-4 py-2',
|
||||
sm: 'h-9 rounded-md px-3',
|
||||
lg: 'h-11 rounded-md px-8',
|
||||
icon: 'h-10 w-10',
|
||||
},
|
||||
},
|
||||
defaultVariants: {
|
||||
variant: 'default',
|
||||
size: 'default',
|
||||
},
|
||||
},
|
||||
)
|
||||
26
packages/cli/test/fixtures/nuxt/lib/utils.ts
vendored
Normal file
26
packages/cli/test/fixtures/nuxt/lib/utils.ts
vendored
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import { type ClassValue, clsx } from 'clsx'
|
||||
import { twMerge } from 'tailwind-merge'
|
||||
import { camelize, getCurrentInstance, toHandlerKey } from 'vue'
|
||||
|
||||
export function cn(...inputs: ClassValue[]) {
|
||||
return twMerge(clsx(inputs))
|
||||
}
|
||||
|
||||
export function useEmitAsProps<Name extends string>(
|
||||
emit: (name: Name, ...args: any[]) => void,
|
||||
) {
|
||||
const vm = getCurrentInstance()
|
||||
|
||||
const events = vm?.type.emits as Name[]
|
||||
const result: Record<string, any> = {}
|
||||
if (!events?.length) {
|
||||
console.warn(
|
||||
`No emitted event found. Please check component: ${vm?.type.__name}`,
|
||||
)
|
||||
}
|
||||
|
||||
events?.forEach((ev) => {
|
||||
result[toHandlerKey(camelize(ev))] = (...arg: any) => emit(ev, ...arg)
|
||||
})
|
||||
return result
|
||||
}
|
||||
|
|
@ -1,4 +1,12 @@
|
|||
// https://nuxt.com/docs/api/configuration/nuxt-config
|
||||
export default defineNuxtConfig({
|
||||
devtools: { enabled: true },
|
||||
modules: ['@nuxtjs/tailwindcss'],
|
||||
components: [
|
||||
{
|
||||
path: '~/components/ui',
|
||||
extensions: ['.vue'],
|
||||
prefix: 'Ui',
|
||||
},
|
||||
],
|
||||
})
|
||||
|
|
|
|||
8
packages/cli/test/fixtures/nuxt/package.json
vendored
8
packages/cli/test/fixtures/nuxt/package.json
vendored
|
|
@ -9,6 +9,14 @@
|
|||
"preview": "nuxt preview",
|
||||
"postinstall": "nuxt prepare"
|
||||
},
|
||||
"dependencies": {
|
||||
"class-variance-authority": "^0.7.0",
|
||||
"clsx": "^2.0.0",
|
||||
"lucide-vue-next": "^0.276.0",
|
||||
"radix-vue": "^0.2.2",
|
||||
"tailwind-merge": "^1.14.0",
|
||||
"tailwindcss-animate": "^1.0.7"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@nuxt/devtools": "latest",
|
||||
"@nuxtjs/tailwindcss": "^6.8.0",
|
||||
|
|
|
|||
70
packages/cli/test/fixtures/nuxt/tailwind.config.js
vendored
Normal file
70
packages/cli/test/fixtures/nuxt/tailwind.config.js
vendored
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
/** @type {import('tailwindcss').Config} */
|
||||
module.exports = {
|
||||
darkMode: ['class'],
|
||||
theme: {
|
||||
container: {
|
||||
center: true,
|
||||
padding: '2rem',
|
||||
screens: {
|
||||
'2xl': '1400px',
|
||||
},
|
||||
},
|
||||
extend: {
|
||||
colors: {
|
||||
border: 'hsl(var(--border))',
|
||||
input: 'hsl(var(--input))',
|
||||
ring: 'hsl(var(--ring))',
|
||||
background: 'hsl(var(--background))',
|
||||
foreground: 'hsl(var(--foreground))',
|
||||
primary: {
|
||||
DEFAULT: 'hsl(var(--primary))',
|
||||
foreground: 'hsl(var(--primary-foreground))',
|
||||
},
|
||||
secondary: {
|
||||
DEFAULT: 'hsl(var(--secondary))',
|
||||
foreground: 'hsl(var(--secondary-foreground))',
|
||||
},
|
||||
destructive: {
|
||||
DEFAULT: 'hsl(var(--destructive))',
|
||||
foreground: 'hsl(var(--destructive-foreground))',
|
||||
},
|
||||
muted: {
|
||||
DEFAULT: 'hsl(var(--muted))',
|
||||
foreground: 'hsl(var(--muted-foreground))',
|
||||
},
|
||||
accent: {
|
||||
DEFAULT: 'hsl(var(--accent))',
|
||||
foreground: 'hsl(var(--accent-foreground))',
|
||||
},
|
||||
popover: {
|
||||
DEFAULT: 'hsl(var(--popover))',
|
||||
foreground: 'hsl(var(--popover-foreground))',
|
||||
},
|
||||
card: {
|
||||
DEFAULT: 'hsl(var(--card))',
|
||||
foreground: 'hsl(var(--card-foreground))',
|
||||
},
|
||||
},
|
||||
borderRadius: {
|
||||
lg: 'var(--radius)',
|
||||
md: 'calc(var(--radius) - 2px)',
|
||||
sm: 'calc(var(--radius) - 4px)',
|
||||
},
|
||||
keyframes: {
|
||||
'accordion-down': {
|
||||
from: { height: 0 },
|
||||
to: { height: 'var(--radix-accordion-content-height)' },
|
||||
},
|
||||
'accordion-up': {
|
||||
from: { height: 'var(--radix-accordion-content-height)' },
|
||||
to: { height: 0 },
|
||||
},
|
||||
},
|
||||
animation: {
|
||||
'accordion-down': 'accordion-down 0.2s ease-out',
|
||||
'accordion-up': 'accordion-up 0.2s ease-out',
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: [require('tailwindcss-animate')],
|
||||
}
|
||||
|
|
@ -6,9 +6,9 @@ test('transform import', async () => {
|
|||
await transform({
|
||||
filename: 'app.vue',
|
||||
raw: `import { Foo } from "bar"
|
||||
import { Button } from "@/registry/new-york/ui/button"
|
||||
import { Button } from "@/lib/registry/new-york/ui/button"
|
||||
import { Label} from "ui/label"
|
||||
import { Box } from "@/registry/new-york/box"
|
||||
import { Box } from "@/lib/registry/new-york/box"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
`,
|
||||
|
|
@ -29,9 +29,9 @@ test('transform import', async () => {
|
|||
await transform({
|
||||
filename: 'app.vue',
|
||||
raw: `import { Foo } from "bar"
|
||||
import { Button } from "@/registry/new-york/ui/button"
|
||||
import { Button } from "@/lib/registry/new-york/ui/button"
|
||||
import { Label} from "ui/label"
|
||||
import { Box } from "@/registry/new-york/box"
|
||||
import { Box } from "@/lib/registry/new-york/box"
|
||||
|
||||
import { cn, foo, bar } from "@/lib/utils"
|
||||
import { bar } from "@/lib/utils/bar"
|
||||
|
|
@ -49,9 +49,9 @@ test('transform import', async () => {
|
|||
await transform({
|
||||
filename: 'app.vue',
|
||||
raw: `import { Foo } from "bar"
|
||||
import { Button } from "@/registry/new-york/ui/button"
|
||||
import { Button } from "@/lib/registry/new-york/ui/button"
|
||||
import { Label} from "ui/label"
|
||||
import { Box } from "@/registry/new-york/box"
|
||||
import { Box } from "@/lib/registry/new-york/box"
|
||||
|
||||
import { cn } from "@/lib/utils"
|
||||
import { bar } from "@/lib/utils/bar"
|
||||
|
|
|
|||
|
|
@ -252,6 +252,25 @@ importers:
|
|||
version: 5.2.2
|
||||
|
||||
packages/cli/test/fixtures/nuxt:
|
||||
dependencies:
|
||||
class-variance-authority:
|
||||
specifier: ^0.7.0
|
||||
version: 0.7.0
|
||||
clsx:
|
||||
specifier: ^2.0.0
|
||||
version: 2.0.0
|
||||
lucide-vue-next:
|
||||
specifier: ^0.276.0
|
||||
version: 0.276.0(vue@3.3.4)
|
||||
radix-vue:
|
||||
specifier: ^0.2.2
|
||||
version: 0.2.2(vue@3.3.4)
|
||||
tailwind-merge:
|
||||
specifier: ^1.14.0
|
||||
version: 1.14.0
|
||||
tailwindcss-animate:
|
||||
specifier: ^1.0.7
|
||||
version: 1.0.7(tailwindcss@3.3.3)
|
||||
devDependencies:
|
||||
'@nuxt/devtools':
|
||||
specifier: latest
|
||||
|
|
@ -1072,6 +1091,7 @@ packages:
|
|||
engines: {node: '>=12'}
|
||||
dependencies:
|
||||
'@jridgewell/trace-mapping': 0.3.9
|
||||
dev: true
|
||||
|
||||
/@csstools/cascade-layer-name-parser@1.0.4(@csstools/css-parser-algorithms@2.3.1)(@csstools/css-tokenizer@2.2.0):
|
||||
resolution: {integrity: sha512-zXMGsJetbLoXe+gjEES07MEGjL0Uy3hMxmnGtVBrRpVKr5KV9OgCB09zr/vLrsEtoVQTgJFewxaU8IYSAE4tjg==}
|
||||
|
|
@ -1840,6 +1860,7 @@ packages:
|
|||
dependencies:
|
||||
'@jridgewell/resolve-uri': 3.1.0
|
||||
'@jridgewell/sourcemap-codec': 1.4.15
|
||||
dev: true
|
||||
|
||||
/@juggle/resize-observer@3.4.0:
|
||||
resolution: {integrity: sha512-dfLbk+PwWvFzSxwk3n5ySL0hfBog779o8h68wK/7/APo/7cgyWp5jcXockbxdk5kFRkbeXWm4Fbi9FrdN381sA==}
|
||||
|
|
@ -2534,6 +2555,7 @@ packages:
|
|||
dependencies:
|
||||
is-glob: 4.0.3
|
||||
micromatch: 4.0.5
|
||||
napi-wasm: 1.1.0
|
||||
dev: true
|
||||
bundledDependencies:
|
||||
- napi-wasm
|
||||
|
|
@ -2857,15 +2879,19 @@ packages:
|
|||
|
||||
/@tsconfig/node10@1.0.9:
|
||||
resolution: {integrity: sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==}
|
||||
dev: true
|
||||
|
||||
/@tsconfig/node12@1.0.11:
|
||||
resolution: {integrity: sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==}
|
||||
dev: true
|
||||
|
||||
/@tsconfig/node14@1.0.3:
|
||||
resolution: {integrity: sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==}
|
||||
dev: true
|
||||
|
||||
/@tsconfig/node16@1.0.4:
|
||||
resolution: {integrity: sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==}
|
||||
dev: true
|
||||
|
||||
/@tufjs/canonical-json@1.0.0:
|
||||
resolution: {integrity: sha512-QTnf++uxunWvG2z3UFNzAoQPHxnSXOwtaI3iJ+AohhV+5vONuArPjJE7aPXPVXfXJsqrVbZBu9b81AJoSd09IQ==}
|
||||
|
|
@ -3218,6 +3244,7 @@ packages:
|
|||
|
||||
/@types/node@20.4.7:
|
||||
resolution: {integrity: sha512-bUBrPjEry2QUTsnuEjzjbS7voGWCc30W0qzgMf90GPeDGFRakvrz47ju+oqDAKCXLUCe39u57/ORMl/O/04/9g==}
|
||||
dev: true
|
||||
|
||||
/@types/node@20.6.0:
|
||||
resolution: {integrity: sha512-najjVq5KN2vsH2U/xyh2opaSEz6cZMR2SetLIlxlj08nOcmPOemJmUK2o4kUzfLqfrWE0PIrNeE16XhYDd3nqg==}
|
||||
|
|
@ -4103,6 +4130,7 @@ packages:
|
|||
/acorn-walk@8.2.0:
|
||||
resolution: {integrity: sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==}
|
||||
engines: {node: '>=0.4.0'}
|
||||
dev: true
|
||||
|
||||
/acorn@8.10.0:
|
||||
resolution: {integrity: sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==}
|
||||
|
|
@ -4309,6 +4337,7 @@ packages:
|
|||
|
||||
/arg@4.1.3:
|
||||
resolution: {integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==}
|
||||
dev: true
|
||||
|
||||
/arg@5.0.2:
|
||||
resolution: {integrity: sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==}
|
||||
|
|
@ -5107,6 +5136,7 @@ packages:
|
|||
|
||||
/create-require@1.1.1:
|
||||
resolution: {integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==}
|
||||
dev: true
|
||||
|
||||
/cross-spawn@7.0.3:
|
||||
resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==}
|
||||
|
|
@ -5777,6 +5807,7 @@ packages:
|
|||
/diff@4.0.2:
|
||||
resolution: {integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==}
|
||||
engines: {node: '>=0.3.1'}
|
||||
dev: true
|
||||
|
||||
/diff@5.1.0:
|
||||
resolution: {integrity: sha512-D+mk+qE8VC/PAUrlAU34N+VfXev0ghe5ywmpqrawphmVZc1bEfn56uo9qpyGp1p4xpzOHkSW4ztBd6L7Xx4ACw==}
|
||||
|
|
@ -7282,6 +7313,7 @@ packages:
|
|||
/iconv-lite@0.6.3:
|
||||
resolution: {integrity: sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
requiresBuild: true
|
||||
dependencies:
|
||||
safer-buffer: 2.1.2
|
||||
|
||||
|
|
@ -8212,6 +8244,7 @@ packages:
|
|||
|
||||
/make-error@1.3.6:
|
||||
resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==}
|
||||
dev: true
|
||||
|
||||
/make-fetch-happen@11.1.1:
|
||||
resolution: {integrity: sha512-rLWS7GCSTcEujjVBs2YqG7Y4643u8ucvCJeSRqiLYhesrDuzeuFIk37xREzAsfQaqzl8b9rNCE4m6J8tvX4Q8w==}
|
||||
|
|
@ -8617,6 +8650,10 @@ packages:
|
|||
hasBin: true
|
||||
dev: true
|
||||
|
||||
/napi-wasm@1.1.0:
|
||||
resolution: {integrity: sha512-lHwIAJbmLSjF9VDRm9GoVOy9AGp3aIvkjv+Kvz9h16QR3uSVYH78PNQUnT2U4X53mhlnV2M7wrhibQ3GHicDmg==}
|
||||
dev: true
|
||||
|
||||
/natural-compare@1.4.0:
|
||||
resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==}
|
||||
dev: true
|
||||
|
|
@ -9672,7 +9709,6 @@ packages:
|
|||
lilconfig: 2.1.0
|
||||
postcss: 8.4.28
|
||||
yaml: 2.3.1
|
||||
dev: true
|
||||
|
||||
/postcss-load-config@4.0.1(postcss@8.4.28)(ts-node@10.9.1):
|
||||
resolution: {integrity: sha512-vEJIc8RdiBRu3oRAI0ymerOn+7rPuMvRXslTvZUKZonDHFIczxztIyJ1urxM1x9JXEikvpWWTUUqal5j/8QgvA==}
|
||||
|
|
@ -9690,6 +9726,7 @@ packages:
|
|||
postcss: 8.4.28
|
||||
ts-node: 10.9.1(@types/node@20.4.7)(typescript@5.2.2)
|
||||
yaml: 2.3.1
|
||||
dev: true
|
||||
|
||||
/postcss-loader@4.3.0(postcss@8.4.28)(webpack@5.88.2):
|
||||
resolution: {integrity: sha512-M/dSoIiNDOo8Rk0mUqoj4kpGq91gcxCfb9PoyZVdZ76/AuhxylHDYZblNE8o+EQ9AMSASeMFEKxZf5aU6wlx1Q==}
|
||||
|
|
@ -10146,7 +10183,6 @@ packages:
|
|||
transitivePeerDependencies:
|
||||
- '@vue/composition-api'
|
||||
- vue
|
||||
dev: true
|
||||
|
||||
/radix3@1.1.0:
|
||||
resolution: {integrity: sha512-pNsHDxbGORSvuSScqNJ+3Km6QAVqk8CfsCBIEoDgpqLrkD2f3QM4I7d1ozJJ172OmIcoUcerZaNWqtLkRXTV3A==}
|
||||
|
|
@ -10493,6 +10529,7 @@ packages:
|
|||
|
||||
/safer-buffer@2.1.2:
|
||||
resolution: {integrity: sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==}
|
||||
requiresBuild: true
|
||||
|
||||
/schema-utils@3.3.0:
|
||||
resolution: {integrity: sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg==}
|
||||
|
|
@ -11076,14 +11113,13 @@ packages:
|
|||
|
||||
/tailwind-merge@1.14.0:
|
||||
resolution: {integrity: sha512-3mFKyCo/MBcgyOTlrY8T7odzZFx+w+qKSMAmdFzRvqBfLlSigU6TZnlFHK0lkMwj9Bj8OYU+9yW9lmGuS0QEnQ==}
|
||||
dev: true
|
||||
|
||||
/tailwindcss-animate@1.0.7(tailwindcss@3.3.3):
|
||||
resolution: {integrity: sha512-bl6mpH3T7I3UFxuvDEXLxy/VuFxBk5bbzplh7tXI68mwMokNYd1t9qPBHlnyTwfa4JGC4zP516I1hYYtQ/vspA==}
|
||||
peerDependencies:
|
||||
tailwindcss: '>=3.0.0 || insiders'
|
||||
dependencies:
|
||||
tailwindcss: 3.3.3(ts-node@10.9.1)
|
||||
tailwindcss: 3.3.3
|
||||
dev: false
|
||||
|
||||
/tailwindcss@3.3.3:
|
||||
|
|
@ -11115,7 +11151,6 @@ packages:
|
|||
sucrase: 3.34.0
|
||||
transitivePeerDependencies:
|
||||
- ts-node
|
||||
dev: true
|
||||
|
||||
/tailwindcss@3.3.3(ts-node@10.9.1):
|
||||
resolution: {integrity: sha512-A0KgSkef7eE4Mf+nKJ83i75TMyq8HqY3qmFIJSWy8bNt0v1lG7jUcpGpoTFxAwYcWOphcTBLPPJg+bDfhDf52w==}
|
||||
|
|
@ -11146,6 +11181,7 @@ packages:
|
|||
sucrase: 3.34.0
|
||||
transitivePeerDependencies:
|
||||
- ts-node
|
||||
dev: true
|
||||
|
||||
/tapable@1.1.3:
|
||||
resolution: {integrity: sha512-4WK/bYZmj8xLr+HUCODHGF1ZFzsYffasLUgEiMBY4fgtltdO6B4WJtlSbPaDTLpYTcGVwM2qLnFTICEcNxs3kA==}
|
||||
|
|
@ -11395,6 +11431,7 @@ packages:
|
|||
typescript: 5.2.2
|
||||
v8-compile-cache-lib: 3.0.1
|
||||
yn: 3.1.1
|
||||
dev: true
|
||||
|
||||
/tsconfck@2.1.2(typescript@5.2.2):
|
||||
resolution: {integrity: sha512-ghqN1b0puy3MhhviwO2kGF8SeMDNhEbnKxjK7h6+fvY9JAxqvXi8y5NAHSQv687OVboS2uZIByzGd45/YxrRHg==}
|
||||
|
|
@ -11938,6 +11975,7 @@ packages:
|
|||
|
||||
/v8-compile-cache-lib@3.0.1:
|
||||
resolution: {integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==}
|
||||
dev: true
|
||||
|
||||
/validate-npm-package-license@3.0.4:
|
||||
resolution: {integrity: sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==}
|
||||
|
|
@ -12720,6 +12758,7 @@ packages:
|
|||
/yn@3.1.1:
|
||||
resolution: {integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==}
|
||||
engines: {node: '>=6'}
|
||||
dev: true
|
||||
|
||||
/yocto-queue@0.1.0:
|
||||
resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user