MCPcopy Index your code
hub / github.com/adobe/react-spectrum / bumpVersions

Method bumpVersions

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

Source from the content-addressed store, hash-verified

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