Skip to content

Commit e6c8108

Browse files
Update e2e dependencies in a release PR (#6254)
Update e2e dependencies to the versions that are released when releasing the tfjs monorepo. This fixes a failure in release tests where e2e tries to install 'link:' dependencies. Add a '--local' option to the release-tfjs script to prevent creating a release PR. This is just for development and makes it easier to see the output of the script.
1 parent 37277d7 commit e6c8108

File tree

2 files changed

+30
-6
lines changed

2 files changed

+30
-6
lines changed

scripts/release-tfjs.ts

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import * as argparse from 'argparse';
2727
import chalk from 'chalk';
2828
import * as fs from 'fs';
2929
import * as shell from 'shelljs';
30-
import {TMP_DIR, $, question, makeReleaseDir, createPR, TFJS_RELEASE_UNIT, updateTFJSDependencyVersions, ALPHA_RELEASE_UNIT, getMinorUpdateVersion, getPatchUpdateVersion} from './release-util';
30+
import {TMP_DIR, $, question, makeReleaseDir, createPR, TFJS_RELEASE_UNIT, updateTFJSDependencyVersions, ALPHA_RELEASE_UNIT, getMinorUpdateVersion, getPatchUpdateVersion, E2E_PHASE} from './release-util';
3131

3232
const parser = new argparse.ArgumentParser();
3333

@@ -36,6 +36,11 @@ parser.addArgument('--git-protocol', {
3636
help: 'Use the git protocol rather than the http protocol when cloning repos.'
3737
});
3838

39+
parser.addArgument('--local', {
40+
action: 'storeTrue',
41+
help: 'Only create the release branch locally. Do not push or create a PR.',
42+
});
43+
3944
async function main() {
4045
const args = parser.parseArgs();
4146
const urlBase = args.git_protocol ? '[email protected]:' : 'https://github.com/';
@@ -86,10 +91,14 @@ async function main() {
8691
console.log(chalk.magenta.bold(
8792
`~~~ Creating new release branch ${releaseBranch} ~~~`));
8893
$(`git checkout -b ${releaseBranch} ${commit}`);
89-
$(`git push origin ${releaseBranch}`);
94+
if (!args.local) {
95+
$(`git push origin ${releaseBranch}`);
96+
}
9097

9198
// Update versions in package.json files.
92-
const phases = [...TFJS_RELEASE_UNIT.phases, ...ALPHA_RELEASE_UNIT.phases];
99+
const phases = [
100+
...TFJS_RELEASE_UNIT.phases, ...ALPHA_RELEASE_UNIT.phases, E2E_PHASE
101+
];
93102
for (const phase of phases) {
94103
for (const packageName of phase.packages) {
95104
shell.cd(packageName);
@@ -109,8 +118,8 @@ async function main() {
109118

110119
shell.cd('..');
111120

112-
// Make version for all packages other than tfjs-node-gpu.
113-
if (packageName !== 'tfjs-node-gpu') {
121+
// Make version for all packages other than tfjs-node-gpu and e2e.
122+
if (packageName !== 'tfjs-node-gpu' && packageName !== 'e2e') {
114123
$(`./scripts/make-version.js ${packageName}`);
115124
}
116125
}
@@ -120,7 +129,9 @@ async function main() {
120129
const devBranchName = `dev_${releaseBranch}`;
121130

122131
const message = `Update monorepo to ${newVersion}.`;
123-
createPR(devBranchName, releaseBranch, message);
132+
if (!args.local) {
133+
createPR(devBranchName, releaseBranch, message);
134+
}
124135

125136
console.log(
126137
'Done. FYI, this script does not publish to NPM. ' +
@@ -131,6 +142,9 @@ async function main() {
131142
'Please remeber to update the website once you have released ' +
132143
'a new package version.');
133144

145+
if (args.local) {
146+
console.log(`Local output located in ${dir}`)
147+
}
134148
process.exit(0);
135149
}
136150

scripts/release-util.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,16 @@ export const WEBSITE_PHASE: Phase = {
130130
title: 'Update website to latest dependencies.'
131131
};
132132

133+
// Note that e2e is not actually published. As a result, this phase is not
134+
// included in any release unit, however, it is used for updating dependencies.
135+
export const E2E_PHASE: Phase = {
136+
packages: ['e2e'],
137+
deps: [
138+
'tfjs', 'tfjs-backend-cpu', 'tfjs-backend-wasm', 'tfjs-backend-webgl',
139+
'tfjs-converter', 'tfjs-core', 'tfjs-data', 'tfjs-layers', 'tfjs-node'
140+
],
141+
}
142+
133143
export const TFJS_RELEASE_UNIT: ReleaseUnit = {
134144
name: 'tfjs',
135145
phases: [

0 commit comments

Comments
 (0)