* Loops through prePublish changes and writes new package.json files * for each affected package.
()
| 415 | * for each affected package. |
| 416 | */ |
| 417 | function writePackageJSONFiles() { |
| 418 | const packages = Object.keys(Object.assign({}, prePublished)) |
| 419 | let didWrite = true |
| 420 | while (packages.length) { |
| 421 | const pkg = packages.shift() |
| 422 | const packageJSON = getPackageJSON(pkg) |
| 423 | packageJSON.version = prePublished[pkg].newVersion |
| 424 | // Note: Dependencies use workspace:^ protocol, so pnpm will automatically |
| 425 | // convert them to real versions at publish time. No manual sync needed. |
| 426 | try { |
| 427 | writePackageJSON(pkg, packageJSON) |
| 428 | msg.info(`✅ /packages/${chalk.magenta(pkg)}/package.json updated`) |
| 429 | } catch (e) { |
| 430 | console.log(e) |
| 431 | didWrite = false |
| 432 | msg.error(`There was a problem writing the package.json for ${pkg}`) |
| 433 | } |
| 434 | } |
| 435 | return didWrite |
| 436 | } |
| 437 | |
| 438 | /** |
| 439 | * Restore the package.json files to the original version. |
no test coverage detected