From c181b155b826371e5e33b4080da6ab0a5160c946 Mon Sep 17 00:00:00 2001 From: Nikhil Thorat Date: Thu, 15 Aug 2019 11:08:49 -0400 Subject: [PATCH 1/2] Update release script to send a single PR when multiple packages update with the same dep. --- scripts/release.ts | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/scripts/release.ts b/scripts/release.ts index 8f047d3b7b5..6146a97762d 100644 --- a/scripts/release.ts +++ b/scripts/release.ts @@ -121,6 +121,7 @@ async function main() { const packages = PHASES[phaseInt].packages; const deps = PHASES[phaseInt].deps || []; + const newVersions = []; for (let i = 0; i < packages.length; i++) { const packageName = packages[i]; @@ -208,17 +209,22 @@ async function main() { phase.scripts.forEach(script => $(script)); } - $(`git checkout -b b${newVersion}`); - $(`git push -u origin b${newVersion}`); - $(`git add .`); - $(`git commit -a -m "Update ${packageName} to ${newVersion}."`); - $(`git push`); - const title = - phase.title ? phase.title : `Update ${packageName} to ${newVersion}.`; - $(`hub pull-request --browse --message "${title}" --labels INTERNAL`); - console.log(); + newVersions.push(newVersion); } + const packageNames = packages.join(', '); + const versionNames = newVersions.join(', '); + const branchName = `b${newVersions.join('-')}`; + $(`git checkout -b ${branchName}`); + $(`git push -u origin ${branchName}`); + $(`git add .`); + $(`git commit -a -m "Update ${packageNames} to ${versionNames}."`); + $(`git push`); + const title = + phase.title ? phase.title : `Update ${packageNames} to ${versionNames}.`; + $(`hub pull-request --browse --message "${title}" --labels INTERNAL`); + console.log(); + console.log( `Done. FYI, this script does not publish to NPM. ` + `Please publish by running ./scripts/publish-npm.sh ` + From dc4133e51a8ea36774df1ff50e5addbe4784e2e1 Mon Sep 17 00:00:00 2001 From: Nikhil Thorat Date: Mon, 19 Aug 2019 10:01:31 -0400 Subject: [PATCH 2/2] save --- scripts/release.ts | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/scripts/release.ts b/scripts/release.ts index 6146a97762d..e0f510fc88e 100644 --- a/scripts/release.ts +++ b/scripts/release.ts @@ -121,29 +121,27 @@ async function main() { const packages = PHASES[phaseInt].packages; const deps = PHASES[phaseInt].deps || []; + const dir = `${TMP_DIR}/tfjs`; + mkdirp(TMP_DIR, err => { + if (err) { + console.log('Error creating temp dir', TMP_DIR); + process.exit(1); + } + }); + $(`rm -f -r ${dir}/*`); + $(`rm -f -r ${dir}`); + $(`mkdir ${dir}`); + $(`git clone https://github.com/tensorflow/tfjs ${dir} --depth=1`); + shell.cd(dir); + const newVersions = []; for (let i = 0; i < packages.length; i++) { const packageName = packages[i]; - - mkdirp(TMP_DIR, (err) => { - if (err) { - console.log('Error creating temp dir', TMP_DIR); - process.exit(1); - } - }); - $(`rm -f -r ${TMP_DIR}/${packageName}/*`); - $(`rm -f -r ${TMP_DIR}/${packageName}`); + shell.cd(packageName); const depsLatestVersion: string[] = deps.map(dep => $(`npm view @tensorflow/${dep} dist-tags.latest`)); - const dir = `${TMP_DIR}/${packageName}`; - $(`mkdir ${dir}`); - $(`git clone https://github.com/tensorflow/tfjs ${dir} --depth=1`); - - shell.cd(dir); - shell.cd(packageName); - // Update the version. let pkg = `${fs.readFileSync(`${dir}/${packageName}/package.json`)}`; const parsedPkg = JSON.parse(`${pkg}`); @@ -210,6 +208,7 @@ async function main() { } newVersions.push(newVersion); + shell.cd('..'); } const packageNames = packages.join(', ');