MCPcopy Create free account
hub / github.com/formkit/formkit / writePackageJSONFiles

Function writePackageJSONFiles

scripts/publish.mjs:417–436  ·  view source on GitHub ↗

* Loops through prePublish changes and writes new package.json files * for each affected package.

()

Source from the content-addressed store, hash-verified

415 * for each affected package.
416 */
417function 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.

Callers 1

publishPackagesFunction · 0.70

Calls 2

getPackageJSONFunction · 0.90
writePackageJSONFunction · 0.90

Tested by

no test coverage detected