MCPcopy Create free account
hub / github.com/cn-docs/vueuse / buildMetaFiles

Function buildMetaFiles

scripts/build.ts:20–40  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

18assert(process.cwd() !== __dirname)
19
20async function buildMetaFiles() {
21 const workspaceData = YAML.parse(await fs.readFile(path.resolve(rootDir, 'pnpm-workspace.yaml'), 'utf-8'))
22
23 for (const { name } of packages) {
24 const packageRoot = path.resolve(rootDir, 'packages', name)
25
26 const packageJSON = JSON.parse(await fs.readFile(path.join(packageRoot, 'package.json'), { encoding: 'utf8' }))
27 for (const [key, value] of Object.entries(packageJSON.dependencies || {})) {
28 if (key.startsWith('@vueuse/')) {
29 packageJSON.dependencies[key] = version
30 }
31 else if ((value as string).startsWith('catalog:')) {
32 const resolved = workspaceData.catalog[key as string]
33 if (!resolved)
34 throw new Error(`Cannot resolve catalog entry for ${key}`)
35 packageJSON.dependencies[key] = resolved
36 }
37 }
38 delete packageJSON.devDependencies
39 }
40}
41
42async function build() {
43 consola.info('Clean up')

Callers 1

buildFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected