fix: demo component paths incorrect with subfolder

This commit is contained in:
zernonia 2023-11-06 12:38:41 +08:00
parent 4657fe8ccc
commit f2fe72efc5
5 changed files with 22 additions and 22 deletions

View File

@ -14,5 +14,6 @@ module.exports = {
'no-invalid-character': 'off', 'no-invalid-character': 'off',
'import/first': 'off', 'import/first': 'off',
'@stylistic/js/no-tabs': 'off', '@stylistic/js/no-tabs': 'off',
'n/prefer-global/process': 'off',
}, },
} }

View File

@ -615,22 +615,22 @@ export const Index = {
name: 'ActivityGoal', name: 'ActivityGoal',
type: 'components:example', type: 'components:example',
registryDependencies: ['button', 'card', 'themes', 'config'], registryDependencies: ['button', 'card', 'themes', 'config'],
component: () => import('../src/lib/registry/default/example/ActivityGoal.vue').then(m => m.default), component: () => import('../src/lib/registry/default/example/Cards/ActivityGoal.vue').then(m => m.default),
files: ['../src/lib/registry/default/example/ActivityGoal.vue'], files: ['../src/lib/registry/default/example/Cards/ActivityGoal.vue'],
}, },
DataTable: { DataTable: {
name: 'DataTable', name: 'DataTable',
type: 'components:example', type: 'components:example',
registryDependencies: ['button', 'checkbox', 'dropdown-menu', 'input', 'table', 'card', 'utils'], registryDependencies: ['button', 'checkbox', 'dropdown-menu', 'input', 'table', 'card', 'utils'],
component: () => import('../src/lib/registry/default/example/DataTable.vue').then(m => m.default), component: () => import('../src/lib/registry/default/example/Cards/DataTable.vue').then(m => m.default),
files: ['../src/lib/registry/default/example/DataTable.vue'], files: ['../src/lib/registry/default/example/Cards/DataTable.vue'],
}, },
Metric: { Metric: {
name: 'Metric', name: 'Metric',
type: 'components:example', type: 'components:example',
registryDependencies: ['card', 'config'], registryDependencies: ['card', 'config'],
component: () => import('../src/lib/registry/default/example/Metric.vue').then(m => m.default), component: () => import('../src/lib/registry/default/example/Cards/Metric.vue').then(m => m.default),
files: ['../src/lib/registry/default/example/Metric.vue'], files: ['../src/lib/registry/default/example/Cards/Metric.vue'],
}, },
}, },
'new-york': { 'new-york': {
@ -1247,22 +1247,22 @@ export const Index = {
name: 'ActivityGoal', name: 'ActivityGoal',
type: 'components:example', type: 'components:example',
registryDependencies: ['button', 'card', 'themes', 'config'], registryDependencies: ['button', 'card', 'themes', 'config'],
component: () => import('../src/lib/registry/new-york/example/ActivityGoal.vue').then(m => m.default), component: () => import('../src/lib/registry/new-york/example/Cards/ActivityGoal.vue').then(m => m.default),
files: ['../src/lib/registry/new-york/example/ActivityGoal.vue'], files: ['../src/lib/registry/new-york/example/Cards/ActivityGoal.vue'],
}, },
DataTable: { DataTable: {
name: 'DataTable', name: 'DataTable',
type: 'components:example', type: 'components:example',
registryDependencies: ['button', 'checkbox', 'dropdown-menu', 'input', 'table', 'card', 'utils'], registryDependencies: ['button', 'checkbox', 'dropdown-menu', 'input', 'table', 'card', 'utils'],
component: () => import('../src/lib/registry/new-york/example/DataTable.vue').then(m => m.default), component: () => import('../src/lib/registry/new-york/example/Cards/DataTable.vue').then(m => m.default),
files: ['../src/lib/registry/new-york/example/DataTable.vue'], files: ['../src/lib/registry/new-york/example/Cards/DataTable.vue'],
}, },
Metric: { Metric: {
name: 'Metric', name: 'Metric',
type: 'components:example', type: 'components:example',
registryDependencies: ['card', 'config'], registryDependencies: ['card', 'config'],
component: () => import('../src/lib/registry/new-york/example/Metric.vue').then(m => m.default), component: () => import('../src/lib/registry/new-york/example/Cards/Metric.vue').then(m => m.default),
files: ['../src/lib/registry/new-york/example/Metric.vue'], files: ['../src/lib/registry/new-york/example/Cards/Metric.vue'],
}, },
}, },
} }

View File

@ -46,9 +46,7 @@ for (const style of styles) {
name: "${item.name}", name: "${item.name}",
type: "${item.type}", type: "${item.type}",
registryDependencies: ${JSON.stringify(item.registryDependencies)}, registryDependencies: ${JSON.stringify(item.registryDependencies)},
component: () => import("../src/lib/registry/${style.name}/${type}/${ component: () => import("${resolveFiles[0]}").then((m) => m.default),
item.name
}.vue").then((m) => m.default),
files: [${resolveFiles.map(file => `"${file}"`)}], files: [${resolveFiles.map(file => `"${file}"`)}],
},` },`
} }
@ -375,7 +373,7 @@ export const THEME_STYLES_WITH_VARIABLES = `
--ring: <%- colors.dark["ring"] %>; --ring: <%- colors.dark["ring"] %>;
}` }`
const themeCSS = [] const themeCSS: Array<string> = []
for (const theme of themes) { for (const theme of themes) {
themeCSS.push( themeCSS.push(
template(THEME_STYLES_WITH_VARIABLES)({ template(THEME_STYLES_WITH_VARIABLES)({

View File

@ -67,7 +67,7 @@ async function crawlExample(rootPath: string) {
if (dirent.isFile()) { if (dirent.isFile()) {
const [name] = dirent.name.split('.vue') const [name] = dirent.name.split('.vue')
const file_path = join('example', dirent.name) const file_path = join('example', dirent.path.split('/example')[1], dirent.name)
const { dependencies, registryDependencies } const { dependencies, registryDependencies }
= await getDependencies(join(dirent.path, dirent.name)) = await getDependencies(join(dirent.path, dirent.name))

View File

@ -3,18 +3,19 @@
"display": "Default", "display": "Default",
"compilerOptions": { "compilerOptions": {
"composite": false, "composite": false,
"module": "ESNext",
"moduleResolution": "node",
"declaration": true, "declaration": true,
"declarationMap": true, "declarationMap": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"inlineSources": false, "inlineSources": false,
"isolatedModules": true, "isolatedModules": true,
"moduleResolution": "node", "esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"noUnusedLocals": false, "noUnusedLocals": false,
"noUnusedParameters": false, "noUnusedParameters": false,
"preserveWatchOutput": true, "preserveWatchOutput": true,
"skipLibCheck": true, "skipLibCheck": true
"strict": true
}, },
"exclude": ["node_modules"] "exclude": ["node_modules"]
} }