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

Method getVersions

scripts/bumpVersions.js:381–412  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers 1

runMethod · 0.95

Calls 3

hasMethod · 0.65
parseMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected