()
| 35 | } |
| 36 | |
| 37 | async function bumpVersion() { |
| 38 | if (!dryRun) { |
| 39 | let status = logAndExec("git status --porcelain", true).trim(); |
| 40 | let lines = status.split("\n"); |
| 41 | invariant( |
| 42 | lines.every((line) => line === "" || line.startsWith("?")), |
| 43 | "Working directory is not clean. Please commit or stash your changes.", |
| 44 | ); |
| 45 | } |
| 46 | |
| 47 | let sha = logAndExec("git rev-parse --short HEAD", true); |
| 48 | invariant(sha != null, "Failed to get git SHA"); |
| 49 | let version = `0.0.0-experimental-${sha}`; |
| 50 | let branch = `experimental/${sha}`; |
| 51 | if (dryRun) { |
| 52 | console.log( |
| 53 | colorize( |
| 54 | ` [Dry Run] Would create and switch to branch ${branch}\n`, |
| 55 | colors.yellow, |
| 56 | ), |
| 57 | ); |
| 58 | } else { |
| 59 | logAndExec(`git checkout -b ${branch}`); |
| 60 | } |
| 61 | |
| 62 | for (let packageDirName of packageDirNames) { |
| 63 | if (dryRun) { |
| 64 | console.log( |
| 65 | colorize( |
| 66 | ` [Dry Run] Would update ${packageDirName} to version ${version}`, |
| 67 | colors.yellow, |
| 68 | ), |
| 69 | ); |
| 70 | } else { |
| 71 | let packageName = updatePackageJson(packageDirName, (pkg) => { |
| 72 | pkg["version"] = version; |
| 73 | }); |
| 74 | console.log( |
| 75 | colorize( |
| 76 | ` Updated ${packageName} to version ${version}`, |
| 77 | colors.green, |
| 78 | ), |
| 79 | ); |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | if (!dryRun) { |
| 84 | logAndExec(`git commit -am "Version ${version}"`); |
| 85 | logAndExec(`git tag -am "Version ${version}" v${version}`); |
| 86 | console.log( |
| 87 | colorize(` Committed and tagged version ${version}`, colors.green), |
| 88 | ); |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | async function publishPackages() { |
| 93 | // Ensure we are in CI. We don't do this manually without --dry-run |
no test coverage detected