()
| 42 | }); |
| 43 | |
| 44 | async function main() { |
| 45 | const args = parser.parseArgs(); |
| 46 | |
| 47 | // The alpha release unit is released with the monorepo and should not be |
| 48 | // released by this script. Packages in the alpha release unit need their |
| 49 | // package.json dependencies rewritten. |
| 50 | const releaseUnits = RELEASE_UNITS.filter(r => r !== ALPHA_RELEASE_UNIT); |
| 51 | releaseUnits.forEach(printReleaseUnit); |
| 52 | console.log(); |
| 53 | |
| 54 | const releaseUnitStr = |
| 55 | await question('Which release unit (leave empty for 0): '); |
| 56 | const releaseUnitInt = +releaseUnitStr; |
| 57 | if (releaseUnitInt < 0 || releaseUnitInt >= releaseUnits.length) { |
| 58 | console.log(chalk.red(`Invalid release unit: ${releaseUnitStr}`)); |
| 59 | process.exit(1); |
| 60 | } |
| 61 | console.log(chalk.blue(`Using release unit ${releaseUnitInt}`)); |
| 62 | console.log(); |
| 63 | |
| 64 | const releaseUnit = releaseUnits[releaseUnitInt]; |
| 65 | const {name, phases} = releaseUnit; |
| 66 | |
| 67 | phases.forEach((_, i) => printPhase(phases, i)); |
| 68 | console.log(); |
| 69 | |
| 70 | const phaseStr = await question('Which phase (leave empty for 0): '); |
| 71 | const phaseInt = +phaseStr; |
| 72 | if (phaseInt < 0 || phaseInt >= phases.length) { |
| 73 | console.log(chalk.red(`Invalid phase: ${phaseStr}`)); |
| 74 | process.exit(1); |
| 75 | } |
| 76 | console.log(chalk.blue(`Using phase ${phaseInt}`)); |
| 77 | console.log(); |
| 78 | |
| 79 | const phase = phases[phaseInt]; |
| 80 | const packages = phases[phaseInt].packages; |
| 81 | const deps = phases[phaseInt].deps || []; |
| 82 | |
| 83 | if (releaseUnit === WEBSITE_RELEASE_UNIT) { |
| 84 | await releaseWebsite(args); |
| 85 | |
| 86 | console.log( |
| 87 | 'Done. Please remember to deploy the website once you merged the PR.'); |
| 88 | |
| 89 | process.exit(0); |
| 90 | } |
| 91 | |
| 92 | // Release packages in tfjs repo. |
| 93 | const dir = `${TMP_DIR}/tfjs`; |
| 94 | makeReleaseDir(dir); |
| 95 | |
| 96 | const urlBase = args.git_protocol ? 'git@github.com:' : 'https://github.com/'; |
| 97 | let releaseBranch = ''; |
| 98 | |
| 99 | if (phaseInt !== 0) { |
| 100 | // Phase0 should be published and release branch should have been created. |
| 101 | const firstPackageVersions: string[] = JSON.parse( |
no test coverage detected
searching dependent graphs…