fix: normalize components:example path to process crawlExample function correctly

This commit is contained in:
Sadegh Barati 2023-12-20 23:04:50 +03:30
parent 993c68e0c6
commit 9fe52b4d86

View File

@ -1,5 +1,5 @@
import { readFile, readdir } from 'node:fs/promises'
import { join, resolve } from 'pathe'
import { join, normalize, resolve } from 'pathe'
import { compileScript, parse } from 'vue/compiler-sfc'
import type { Registry } from '../../lib/registry'
@ -66,7 +66,7 @@ async function crawlExample(rootPath: string) {
if (dirent.isFile()) {
const [name] = dirent.name.split('.vue')
const file_path = join('example', dirent.path.split('/example')[1], dirent.name)
const file_path = join('example', normalize(dirent.path).split('/example')[1], dirent.name)
const { dependencies, registryDependencies }
= await getDependencies(join(dirent.path, dirent.name))