| 18 | assert(process.cwd() !== __dirname) |
| 19 | |
| 20 | async 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 | |
| 42 | async function build() { |
| 43 | consola.info('Clean up') |