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

Method getVersions

scripts/bumpVersions.js:380–411  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

378 }
379
380 getVersions() {
381 let versions = new Map();
382 for (let [name, {location, status, bump}] of this.releasedPackages) {
383 let filePath = this.workspacePackages[name].location + '/package.json';
384 let pkg = JSON.parse(fs.readFileSync(filePath, 'utf8'));
385
386 if (!bump || bump === 'unreleased' || bump === 'unchanged') {
387 versions.set(name, [pkg.version, pkg.version, pkg.private]);
388 continue;
389 }
390
391 // If the package already exists on npm, then increment the version
392 // number to the correct status. If it's a new package, then ensure
393 // the package.json version is correct according to the status.
394 if (this.existingPackages.has(name)) {
395 let newVersion =
396 status === 'released'
397 ? semver.inc(pkg.version, bump)
398 : semver.inc(pkg.version, 'prerelease', status);
399 versions.set(name, [pkg.version, newVersion, pkg.private]);
400 } else {
401 let newVersion = '3.0.0';
402 if (status !== 'released') {
403 newVersion += `-${status}.0`;
404 }
405
406 versions.set(name, [pkg.version, newVersion, pkg.private]);
407 }
408 }
409
410 return versions;
411 }
412
413 async promptVersions(versions) {
414 console.log('');

Callers 1

runMethod · 0.95

Calls 3

hasMethod · 0.65
parseMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected