MCPcopy Create free account
hub / github.com/adobe/react-spectrum / bumpVersions

Method bumpVersions

scripts/bumpVersions.js:465–511  ·  view source on GitHub ↗
(versions)

Source from the content-addressed store, hash-verified

463 }
464
465 bumpVersions(versions) {
466 for (let [name, {location}] of this.releasedPackages) {
467 let filePath = location + '/package.json';
468 let pkg = JSON.parse(fs.readFileSync(filePath, 'utf8'));
469 pkg.version = versions.get(name)[1];
470
471 if (pkg.private) {
472 delete pkg.private;
473 }
474
475 for (let dep in pkg.dependencies) {
476 if (versions.has(dep)) {
477 let {status} = this.releasedPackages.get(dep);
478 // Pin dependencies on monopackages.
479 // Individual packages are left as caret dependencies since they only exist for backward compatibility.
480 pkg.dependencies[dep] =
481 (status === 'released' && !monopackages.has(dep) ? '^' : '') + versions.get(dep)[1];
482 }
483 }
484
485 fs.writeFileSync(filePath, JSON.stringify(pkg, false, 2) + '\n');
486 }
487
488 for (let name in this.workspacePackages) {
489 if (!this.releasedPackages.has(name)) {
490 let filePath = this.workspacePackages[name].location + '/package.json';
491 let pkg = JSON.parse(fs.readFileSync(filePath, 'utf8'));
492
493 // Mark package as private if it wasn't already published.
494 if (!pkg.private && !excludedPackages.has(name) && !this.existingPackages.has(name)) {
495 pkg = insertKey(pkg, 'license', 'private', true);
496 }
497
498 // Ensure pinned dependencies of unpublished packages in the monorepo are updated.
499 for (let dep in pkg.dependencies) {
500 if (versions.has(dep)) {
501 let {status} = this.releasedPackages.get(dep);
502 if (status !== 'released') {
503 pkg.dependencies[dep] = versions.get(dep)[1];
504 }
505 }
506 }
507
508 fs.writeFileSync(filePath, JSON.stringify(pkg, false, 2) + '\n');
509 }
510 }
511 }
512
513 commit(versions) {
514 exec('git commit -a -m "Publish"', {stdio: 'inherit'});

Callers 1

runMethod · 0.95

Calls 3

insertKeyFunction · 0.85
hasMethod · 0.65
parseMethod · 0.45

Tested by

no test coverage detected