-
-
Notifications
You must be signed in to change notification settings - Fork 354
/
Copy pathaliases.ts
34 lines (28 loc) · 925 Bytes
/
aliases.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { readdirSync, statSync } from 'node:fs'
import { resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
const resolveEntryForPkg = (p: string) =>
resolve(fileURLToPath(import.meta.url), `../../packages/${p}/src/index.ts`)
const dirs = readdirSync(new URL('../packages', import.meta.url))
const entries: Record<string, string> = {
'vue-i18n': resolveEntryForPkg('vue-i18n'),
'petite-vue-i18n': resolveEntryForPkg('petite-vue-i18n')
}
const nonSrcPackages = [
'size-check-core',
'size-check-vue-i18n',
'size-check-petite-vue-i18n',
'format-explorer'
]
for (const dir of dirs) {
const key = `@intlify/${dir}`
if (
!(dir === 'vue-i18n' || dir === 'petite-vue-i18n') &&
!nonSrcPackages.includes(dir) &&
!(key in entries) &&
statSync(new URL(`../packages/${dir}`, import.meta.url)).isDirectory()
) {
entries[key] = resolveEntryForPkg(dir)
}
}
export { entries }