diff --git a/.eslintrc.cjs b/.eslintrc.cjs index d901d8744..87256eee4 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -14,5 +14,6 @@ module.exports = { 'no-invalid-character': 'off', 'import/first': 'off', '@stylistic/js/no-tabs': 'off', + 'n/prefer-global/process': 'off', }, } diff --git a/apps/www/scripts/build-registry.ts b/apps/www/scripts/build-registry.ts index 07550cc1c..6ab0ccf2b 100644 --- a/apps/www/scripts/build-registry.ts +++ b/apps/www/scripts/build-registry.ts @@ -46,9 +46,7 @@ for (const style of styles) { name: "${item.name}", type: "${item.type}", registryDependencies: ${JSON.stringify(item.registryDependencies)}, - component: () => import("../src/lib/registry/${style.name}/${type}/${ - item.name - }.vue").then((m) => m.default), + component: () => import("${resolveFiles[0]}").then((m) => m.default), files: [${resolveFiles.map(file => `"${file}"`)}], },` } @@ -375,7 +373,7 @@ export const THEME_STYLES_WITH_VARIABLES = ` --ring: <%- colors.dark["ring"] %>; }` -const themeCSS = [] +const themeCSS: Array = [] for (const theme of themes) { themeCSS.push( template(THEME_STYLES_WITH_VARIABLES)({ diff --git a/apps/www/src/lib/registry/registry.ts b/apps/www/src/lib/registry/registry.ts index 748d46d93..77a69b7bc 100644 --- a/apps/www/src/lib/registry/registry.ts +++ b/apps/www/src/lib/registry/registry.ts @@ -6,10 +6,15 @@ import type { Registry } from '../../lib/registry' const DEPENDENCIES = new Map([ ['radix-vue', []], + ['@vueuse/core', []], ['v-calendar', []], ['@tanstack/vue-table', []], ['vee-validate', ['@vee-validate/zod', 'zod']], ]) +// Some dependencies latest tag were not compatible with Vue3. +const DEPENDENCIES_WITH_TAGS = new Map([ + ['v-calendar', 'v-calendar@next'], +]) const REGISTRY_DEPENDENCY = '@/' type ArrayItem = T extends Array ? X : never @@ -62,7 +67,7 @@ async function crawlExample(rootPath: string) { if (dirent.isFile()) { 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 } = await getDependencies(join(dirent.path, dirent.name)) @@ -139,8 +144,12 @@ async function getDependencies(filename: string) { Object.values(compiled.imports!).forEach((value) => { const source = value.source const peerDeps = DEPENDENCIES.get(source) + const taggedDeps = DEPENDENCIES_WITH_TAGS.get(source) if (peerDeps !== undefined) { - dependencies.add(source) + if (taggedDeps !== undefined) + dependencies.add(taggedDeps) + else + dependencies.add(source) peerDeps.forEach(dep => dependencies.add(dep)) } diff --git a/apps/www/src/public/registry/index.json b/apps/www/src/public/registry/index.json index 328d58fd2..6ea8e2e7f 100644 --- a/apps/www/src/public/registry/index.json +++ b/apps/www/src/public/registry/index.json @@ -108,7 +108,8 @@ { "name": "calendar", "dependencies": [ - "v-calendar" + "@vueuse/core", + "v-calendar@next" ], "registryDependencies": [ "utils" @@ -302,7 +303,9 @@ }, { "name": "input", - "dependencies": [], + "dependencies": [ + "@vueuse/core" + ], "registryDependencies": [ "utils" ], @@ -590,7 +593,9 @@ }, { "name": "textarea", - "dependencies": [], + "dependencies": [ + "@vueuse/core" + ], "registryDependencies": [ "utils" ], diff --git a/apps/www/src/public/registry/styles/default/calendar.json b/apps/www/src/public/registry/styles/default/calendar.json index c68836fcf..c79005171 100644 --- a/apps/www/src/public/registry/styles/default/calendar.json +++ b/apps/www/src/public/registry/styles/default/calendar.json @@ -1,7 +1,8 @@ { "name": "calendar", "dependencies": [ - "v-calendar" + "@vueuse/core", + "v-calendar@next" ], "registryDependencies": [ "utils" diff --git a/apps/www/src/public/registry/styles/default/input.json b/apps/www/src/public/registry/styles/default/input.json index 18fff2de5..9aff41dc2 100644 --- a/apps/www/src/public/registry/styles/default/input.json +++ b/apps/www/src/public/registry/styles/default/input.json @@ -1,6 +1,8 @@ { "name": "input", - "dependencies": [], + "dependencies": [ + "@vueuse/core" + ], "registryDependencies": [ "utils" ], diff --git a/apps/www/src/public/registry/styles/default/textarea.json b/apps/www/src/public/registry/styles/default/textarea.json index 66db35564..78d5ea2f5 100644 --- a/apps/www/src/public/registry/styles/default/textarea.json +++ b/apps/www/src/public/registry/styles/default/textarea.json @@ -1,6 +1,8 @@ { "name": "textarea", - "dependencies": [], + "dependencies": [ + "@vueuse/core" + ], "registryDependencies": [ "utils" ], diff --git a/apps/www/src/public/registry/styles/new-york/calendar.json b/apps/www/src/public/registry/styles/new-york/calendar.json index 20c70f6fe..129f9fcdd 100644 --- a/apps/www/src/public/registry/styles/new-york/calendar.json +++ b/apps/www/src/public/registry/styles/new-york/calendar.json @@ -1,7 +1,8 @@ { "name": "calendar", "dependencies": [ - "v-calendar" + "@vueuse/core", + "v-calendar@next" ], "registryDependencies": [ "utils" diff --git a/apps/www/src/public/registry/styles/new-york/input.json b/apps/www/src/public/registry/styles/new-york/input.json index e26c88776..7bce11f9d 100644 --- a/apps/www/src/public/registry/styles/new-york/input.json +++ b/apps/www/src/public/registry/styles/new-york/input.json @@ -1,6 +1,8 @@ { "name": "input", - "dependencies": [], + "dependencies": [ + "@vueuse/core" + ], "registryDependencies": [ "utils" ], diff --git a/apps/www/src/public/registry/styles/new-york/textarea.json b/apps/www/src/public/registry/styles/new-york/textarea.json index dd29f8913..1f8441be6 100644 --- a/apps/www/src/public/registry/styles/new-york/textarea.json +++ b/apps/www/src/public/registry/styles/new-york/textarea.json @@ -1,6 +1,8 @@ { "name": "textarea", - "dependencies": [], + "dependencies": [ + "@vueuse/core" + ], "registryDependencies": [ "utils" ], diff --git a/tsconfig.json b/tsconfig.json index d72a9f3a2..b6cea7444 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,18 +3,19 @@ "display": "Default", "compilerOptions": { "composite": false, + "module": "ESNext", + "moduleResolution": "node", "declaration": true, "declarationMap": true, - "esModuleInterop": true, - "forceConsistentCasingInFileNames": true, "inlineSources": false, "isolatedModules": true, - "moduleResolution": "node", + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "strict": true, "noUnusedLocals": false, "noUnusedParameters": false, "preserveWatchOutput": true, - "skipLibCheck": true, - "strict": true + "skipLibCheck": true }, "exclude": ["node_modules"] }