mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-14 12:14:41 +01:00
cli: use camelCase for theme
This commit is contained in:
@@ -2,7 +2,7 @@ import { existsSync, promises as fsp } from 'node:fs'
|
||||
import { resolve } from 'pathe'
|
||||
import { defineCommand } from 'citty'
|
||||
import { consola } from 'consola'
|
||||
import { camelCase, kebabCase } from 'scule'
|
||||
import { camelCase } from 'scule'
|
||||
import templates from '../utils/templates.mjs'
|
||||
|
||||
export default defineCommand({
|
||||
@@ -42,7 +42,7 @@ export default defineCommand({
|
||||
|
||||
const themePath = resolve(path, 'src/theme/index.ts')
|
||||
const theme = await fsp.readFile(themePath, 'utf-8')
|
||||
const contents = `export { default as ${camelCase(name)} } from './${kebabCase(name)}'`
|
||||
const contents = `export { default as ${camelCase(name)} } from './${camelCase(name)}'`
|
||||
if (!theme.includes(contents)) {
|
||||
await fsp.writeFile(themePath, theme.trim() + '\n' + contents + '\n')
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ const playground = ({ name }) => {
|
||||
const component = ({ name }) => {
|
||||
const upperName = splitByCase(name).map(p => upperFirst(p)).join('')
|
||||
const camelName = camelCase(name)
|
||||
const kebabName = kebabCase(name)
|
||||
|
||||
return {
|
||||
filename: `src/runtime/components/${upperName}.vue`,
|
||||
@@ -28,7 +27,7 @@ const component = ({ name }) => {
|
||||
import { tv, type VariantProps } from 'tailwind-variants'
|
||||
import type { AppConfig } from '@nuxt/schema'
|
||||
import _appConfig from '#build/app.config'
|
||||
import theme from '#build/ui/${kebabName}'
|
||||
import theme from '#build/ui/${camelName}'
|
||||
|
||||
const appConfig = _appConfig as AppConfig & { ui: { ${camelName}: Partial<typeof theme> } }
|
||||
|
||||
@@ -62,10 +61,10 @@ const ui = computed(() => tv({ extend: ${camelName}, slots: props.ui })())
|
||||
}
|
||||
|
||||
const theme = ({ name }) => {
|
||||
const kebabName = kebabCase(name)
|
||||
const camelName = camelCase(name)
|
||||
|
||||
return {
|
||||
filename: `src/theme/${kebabName}.ts`,
|
||||
filename: `src/theme/${camelName}.ts`,
|
||||
contents: `
|
||||
export default {
|
||||
slots: {
|
||||
|
||||
Reference in New Issue
Block a user