Skip to content

Commit b78158c

Browse files
committed
refactor: remove aspect and bazel lock file updates code
Due to the recent changes this code is no longer needed.
1 parent 99cc879 commit b78158c

File tree

9 files changed

+8
-123
lines changed

9 files changed

+8
-123
lines changed

.github/local-actions/branch-manager/main.js

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

ng-dev/release/config/index.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,6 @@ export interface ReleaseConfig {
6161
newVersion: string,
6262
builtPackagesWithInfo: BuiltPackageWithInfo[],
6363
) => Promise<void>;
64-
65-
/**
66-
* Whether the repository is in rules_js interop mode, relying on
67-
* integrity files to be automatically updated.
68-
*/
69-
// TODO(devversion): Remove after completing `rules_js` migration.
70-
rulesJsInteropMode?: boolean;
7164
}
7265

7366
/**

ng-dev/release/publish/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ ts_project(
1414
"//ng-dev:node_modules/@types/semver",
1515
"//ng-dev:node_modules/@types/yargs",
1616
"//ng-dev:node_modules/ejs",
17-
"//ng-dev:node_modules/fast-glob",
1817
"//ng-dev:node_modules/folder-hash",
1918
"//ng-dev:node_modules/semver",
2019
"//ng-dev:node_modules/typed-graphqlify",

ng-dev/release/publish/actions.ts

Lines changed: 4 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,11 @@
66
* found in the LICENSE file at https://angular.io/license
77
*/
88

9-
import {promises as fs, existsSync} from 'fs';
10-
import path, {join} from 'path';
9+
import {promises as fs} from 'fs';
10+
import {join} from 'path';
1111
import semver from 'semver';
1212

13-
import {
14-
workspaceRelativeBazelModuleLock,
15-
workspaceRelativePackageJsonPath,
16-
} from '../../utils/constants.js';
13+
import {workspaceRelativePackageJsonPath} from '../../utils/constants.js';
1714
import {AuthenticatedGitClient} from '../../utils/git/authenticated-git-client.js';
1815
import {isGithubApiError} from '../../utils/git/github.js';
1916
import githubMacros from '../../utils/git/github-macros.js';
@@ -44,7 +41,6 @@ import {githubReleaseBodyLimit} from './constants.js';
4441
import {ExternalCommands} from './external-commands.js';
4542
import {promptToInitiatePullRequestMerge} from './prompt-merge.js';
4643
import {Prompt} from '../../utils/prompt.js';
47-
import glob from 'fast-glob';
4844
import {PnpmVersioning} from './pnpm-versioning.js';
4945
import {Commit} from '../../utils/git/octokit-types.js';
5046
import {updateRenovateConfigTargetLabels} from './actions/renovate-config-updates.js';
@@ -139,33 +135,6 @@ export abstract class ReleaseAction {
139135
// to avoid unnecessary diff. IDEs usually add a trailing new line.
140136
await fs.writeFile(pkgJsonPath, `${JSON.stringify(pkgJson, null, 2)}\n`);
141137
Log.info(green(` ✓ Updated project version to ${pkgJson.version}`));
142-
143-
if (this.config.rulesJsInteropMode && existsSync(path.join(this.projectDir, '.aspect'))) {
144-
await ExternalCommands.invokeBazelUpdateAspectLockFiles(this.projectDir);
145-
}
146-
147-
if (existsSync(join(this.projectDir, workspaceRelativeBazelModuleLock))) {
148-
await ExternalCommands.invokeBazelModDepsUpdate(this.projectDir);
149-
}
150-
}
151-
152-
/*
153-
* Get the modified Aspect lock files if `rulesJsInteropMode` is enabled.
154-
*/
155-
protected getAspectLockFiles(): string[] {
156-
// TODO: Remove after `rules_js` migration is complete.
157-
return this.config.rulesJsInteropMode
158-
? glob.sync(['.aspect/**', 'pnpm-lock.yaml'], {cwd: this.projectDir})
159-
: [];
160-
}
161-
162-
/*
163-
* Get the modified "MODULE.bazel.lock" if bazel modules are enabled.
164-
*/
165-
protected getModuleBazelLockFile(): string | undefined {
166-
return existsSync(join(this.projectDir, workspaceRelativeBazelModuleLock))
167-
? workspaceRelativeBazelModuleLock
168-
: undefined;
169138
}
170139

171140
/** Gets the most recent commit of a specified branch. */
@@ -235,16 +204,7 @@ export abstract class ReleaseAction {
235204
}
236205

237206
// Commit message for the release point.
238-
const filesToCommit = [
239-
workspaceRelativePackageJsonPath,
240-
workspaceRelativeChangelogPath,
241-
...this.getAspectLockFiles(),
242-
];
243-
244-
const bazelModuleLockFile = this.getModuleBazelLockFile();
245-
if (bazelModuleLockFile) {
246-
filesToCommit.push(bazelModuleLockFile);
247-
}
207+
const filesToCommit = [workspaceRelativePackageJsonPath, workspaceRelativeChangelogPath];
248208

249209
const commitMessage = getCommitMessageForRelease(newVersion);
250210

ng-dev/release/publish/actions/configure-next-as-major.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,7 @@ export class ConfigureNextAsMajorAction extends ReleaseAction {
3939
await this.checkoutUpstreamBranch(branchName);
4040
await this.updateProjectVersion(newVersion);
4141

42-
const filesToCommit: string[] = [
43-
workspaceRelativePackageJsonPath,
44-
...this.getAspectLockFiles(),
45-
];
46-
47-
const bazelModuleLockFile = this.getModuleBazelLockFile();
48-
if (bazelModuleLockFile) {
49-
filesToCommit.push(bazelModuleLockFile);
50-
}
51-
42+
const filesToCommit: string[] = [workspaceRelativePackageJsonPath];
5243
await this.createCommit(getCommitMessageForNextBranchMajorSwitch(newVersion), filesToCommit);
5344

5445
const pullRequest = await this.pushChangesToForkAndCreatePullRequest(

ng-dev/release/publish/actions/exceptional-minor/prepare-exceptional-minor.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,7 @@ export class PrepareExceptionalMinorAction extends ReleaseAction {
4949
pkgJson[exceptionalMinorPackageIndicator] = true;
5050
});
5151

52-
const filesToCommit: string[] = [
53-
workspaceRelativePackageJsonPath,
54-
...this.getAspectLockFiles(),
55-
];
56-
57-
const bazelModuleLockFile = this.getModuleBazelLockFile();
58-
if (bazelModuleLockFile) {
59-
filesToCommit.push(bazelModuleLockFile);
60-
}
52+
const filesToCommit: string[] = [workspaceRelativePackageJsonPath];
6153

6254
await this.createCommit(
6355
`build: prepare exceptional minor branch: ${this._newBranch}`,

ng-dev/release/publish/actions/shared/branch-off-next-branch.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -140,15 +140,7 @@ export abstract class BranchOffNextBranchBaseAction extends CutNpmNextPrerelease
140140

141141
// Create an individual commit for the next version bump. The changelog should go into
142142
// a separate commit that makes it clear where the changelog is cherry-picked from.
143-
const filesToCommit: string[] = [
144-
workspaceRelativePackageJsonPath,
145-
...this.getAspectLockFiles(),
146-
];
147-
148-
const bazelModuleLockFile = this.getModuleBazelLockFile();
149-
if (bazelModuleLockFile) {
150-
filesToCommit.push(bazelModuleLockFile);
151-
}
143+
const filesToCommit: string[] = [workspaceRelativePackageJsonPath];
152144

153145
const renovateConfigPath = await updateRenovateConfig(
154146
this.projectDir,

ng-dev/release/publish/external-commands.ts

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import {ReleaseInfoJsonStdout} from '../info/cli.js';
1818
import {ReleasePrecheckJsonStdin} from '../precheck/cli.js';
1919
import {BuiltPackageWithInfo} from '../config/index.js';
2020
import {green, Log} from '../../utils/logging.js';
21-
import {getBazelBin} from '../../utils/bazel-bin.js';
2221
import {PnpmVersioning} from './pnpm-versioning.js';
2322

2423
/*
@@ -262,44 +261,6 @@ export abstract class ExternalCommands {
262261
}
263262
}
264263

265-
/**
266-
* Invokes the `bazel mod deps --lockfile_mode=update` command in order
267-
* to refresh `MODULE.bazel.lock` file.
268-
*/
269-
static async invokeBazelModDepsUpdate(projectDir: string): Promise<void> {
270-
const spinner = new Spinner('Updating "MODULE.bazel.lock"');
271-
try {
272-
await ChildProcess.spawn(getBazelBin(), ['mod', 'deps', '--lockfile_mode=update'], {
273-
cwd: projectDir,
274-
mode: 'silent',
275-
});
276-
} catch (e) {
277-
Log.error(e);
278-
Log.error(' ✘ An error occurred while updating "MODULE.bazel.lock".');
279-
throw new FatalReleaseActionError();
280-
}
281-
spinner.success(green(' Updated "MODULE.bazel.lock" file.'));
282-
}
283-
284-
/**
285-
* Invokes the `yarn bazel sync --only=repo` command in order
286-
* to refresh Aspect lock files.
287-
*/
288-
static async invokeBazelUpdateAspectLockFiles(projectDir: string): Promise<void> {
289-
const spinner = new Spinner('Updating Aspect lock files');
290-
try {
291-
await ChildProcess.spawn(getBazelBin(), ['sync', '--only=repo'], {
292-
cwd: projectDir,
293-
mode: 'silent',
294-
});
295-
} catch (e) {
296-
// Note: Gracefully handling these errors because `sync` command
297-
// exits with a non-zero exit code when pnpm-lock.yaml file is updated.
298-
Log.debug(e);
299-
}
300-
spinner.success(green(' Updated Aspect `rules_js` lock files.'));
301-
}
302-
303264
private static async _spawnNpmScript(
304265
args: string[],
305266
projectDir: string,

ng-dev/utils/constants.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,3 @@ export const ngDevNpmPackageName = '@angular/ng-dev';
1111

1212
/** Workspace-relative path for the "package.json" file. */
1313
export const workspaceRelativePackageJsonPath = 'package.json';
14-
15-
/** Workspace-relative path for the "MODULE.bazel.lock" file. */
16-
export const workspaceRelativeBazelModuleLock = 'MODULE.bazel.lock';

0 commit comments

Comments
 (0)