|
1 | 1 | import fs from 'node:fs/promises' |
2 | 2 | import { existsSync } from 'node:fs' |
3 | | -import { dirname, join, relative } from 'node:path' |
| 3 | +import { dirname, join, relative, resolve } from 'node:path' |
4 | 4 | import { fileURLToPath } from 'node:url' |
5 | 5 | import minimist from 'minimist' |
6 | 6 | import chalk from 'chalk' |
7 | 7 | import semver from 'semver' |
8 | 8 | import prompts from '@posva/prompts' |
9 | 9 | import { execa } from 'execa' |
10 | 10 | import pSeries from 'p-series' |
11 | | -import { globby } from 'globby' |
12 | 11 |
|
13 | 12 | const __filename = fileURLToPath(import.meta.url) |
14 | 13 | const __dirname = dirname(__filename) |
@@ -259,6 +258,22 @@ async function main() { |
259 | 258 | step('\nUpdating versions in package.json files...') |
260 | 259 | await updateVersions(pkgWithVersions) |
261 | 260 |
|
| 261 | + if (!IS_MAIN_PKG_ROOT) { |
| 262 | + step('\nCopying README from root to main package...') |
| 263 | + const originalReadme = resolve(__dirname, '../README.md') |
| 264 | + const targetReadme = resolve( |
| 265 | + __dirname, |
| 266 | + '../', |
| 267 | + pkgWithVersions.find(p => p.name === MAIN_PKG_NAME).relativePath, |
| 268 | + 'README.md' |
| 269 | + ) |
| 270 | + if (!isDryRun) { |
| 271 | + await fs.copyFile(originalReadme, targetReadme) |
| 272 | + } else { |
| 273 | + console.log(`(skipped) cp "${originalReadme}" "${targetReadme}"`) |
| 274 | + } |
| 275 | + } |
| 276 | + |
262 | 277 | if (!noLockUpdate) { |
263 | 278 | step('\nUpdating lock...') |
264 | 279 | await runIfNotDry(`pnpm`, ['install']) |
|
0 commit comments