Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/local-actions/branch-manager/main.js

Large diffs are not rendered by default.

7 changes: 0 additions & 7 deletions ng-dev/release/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,6 @@ export interface ReleaseConfig {
newVersion: string,
builtPackagesWithInfo: BuiltPackageWithInfo[],
) => Promise<void>;

/**
* Whether the repository is in rules_js interop mode, relying on
* integrity files to be automatically updated.
*/
// TODO(devversion): Remove after completing `rules_js` migration.
rulesJsInteropMode?: boolean;
}

/**
Expand Down
1 change: 0 additions & 1 deletion ng-dev/release/publish/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ ts_project(
"//ng-dev:node_modules/@types/semver",
"//ng-dev:node_modules/@types/yargs",
"//ng-dev:node_modules/ejs",
"//ng-dev:node_modules/fast-glob",
"//ng-dev:node_modules/folder-hash",
"//ng-dev:node_modules/semver",
"//ng-dev:node_modules/typed-graphqlify",
Expand Down
48 changes: 4 additions & 44 deletions ng-dev/release/publish/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,11 @@
* found in the LICENSE file at https://angular.io/license
*/

import {promises as fs, existsSync} from 'fs';
import path, {join} from 'path';
import {promises as fs} from 'fs';
import {join} from 'path';
import semver from 'semver';

import {
workspaceRelativeBazelModuleLock,
workspaceRelativePackageJsonPath,
} from '../../utils/constants.js';
import {workspaceRelativePackageJsonPath} from '../../utils/constants.js';
import {AuthenticatedGitClient} from '../../utils/git/authenticated-git-client.js';
import {isGithubApiError} from '../../utils/git/github.js';
import githubMacros from '../../utils/git/github-macros.js';
Expand Down Expand Up @@ -44,7 +41,6 @@ import {githubReleaseBodyLimit} from './constants.js';
import {ExternalCommands} from './external-commands.js';
import {promptToInitiatePullRequestMerge} from './prompt-merge.js';
import {Prompt} from '../../utils/prompt.js';
import glob from 'fast-glob';
import {PnpmVersioning} from './pnpm-versioning.js';
import {Commit} from '../../utils/git/octokit-types.js';
import {updateRenovateConfigTargetLabels} from './actions/renovate-config-updates.js';
Expand Down Expand Up @@ -139,33 +135,6 @@ export abstract class ReleaseAction {
// to avoid unnecessary diff. IDEs usually add a trailing new line.
await fs.writeFile(pkgJsonPath, `${JSON.stringify(pkgJson, null, 2)}\n`);
Log.info(green(` ✓ Updated project version to ${pkgJson.version}`));

if (this.config.rulesJsInteropMode && existsSync(path.join(this.projectDir, '.aspect'))) {
await ExternalCommands.invokeBazelUpdateAspectLockFiles(this.projectDir);
}

if (existsSync(join(this.projectDir, workspaceRelativeBazelModuleLock))) {
await ExternalCommands.invokeBazelModDepsUpdate(this.projectDir);
}
}

/*
* Get the modified Aspect lock files if `rulesJsInteropMode` is enabled.
*/
protected getAspectLockFiles(): string[] {
// TODO: Remove after `rules_js` migration is complete.
return this.config.rulesJsInteropMode
? glob.sync(['.aspect/**', 'pnpm-lock.yaml'], {cwd: this.projectDir})
: [];
}

/*
* Get the modified "MODULE.bazel.lock" if bazel modules are enabled.
*/
protected getModuleBazelLockFile(): string | undefined {
return existsSync(join(this.projectDir, workspaceRelativeBazelModuleLock))
? workspaceRelativeBazelModuleLock
: undefined;
}

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

// Commit message for the release point.
const filesToCommit = [
workspaceRelativePackageJsonPath,
workspaceRelativeChangelogPath,
...this.getAspectLockFiles(),
];

const bazelModuleLockFile = this.getModuleBazelLockFile();
if (bazelModuleLockFile) {
filesToCommit.push(bazelModuleLockFile);
}
const filesToCommit = [workspaceRelativePackageJsonPath, workspaceRelativeChangelogPath];

const commitMessage = getCommitMessageForRelease(newVersion);

Expand Down
11 changes: 1 addition & 10 deletions ng-dev/release/publish/actions/configure-next-as-major.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,7 @@ export class ConfigureNextAsMajorAction extends ReleaseAction {
await this.checkoutUpstreamBranch(branchName);
await this.updateProjectVersion(newVersion);

const filesToCommit: string[] = [
workspaceRelativePackageJsonPath,
...this.getAspectLockFiles(),
];

const bazelModuleLockFile = this.getModuleBazelLockFile();
if (bazelModuleLockFile) {
filesToCommit.push(bazelModuleLockFile);
}

const filesToCommit: string[] = [workspaceRelativePackageJsonPath];
await this.createCommit(getCommitMessageForNextBranchMajorSwitch(newVersion), filesToCommit);

const pullRequest = await this.pushChangesToForkAndCreatePullRequest(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,7 @@ export class PrepareExceptionalMinorAction extends ReleaseAction {
pkgJson[exceptionalMinorPackageIndicator] = true;
});

const filesToCommit: string[] = [
workspaceRelativePackageJsonPath,
...this.getAspectLockFiles(),
];

const bazelModuleLockFile = this.getModuleBazelLockFile();
if (bazelModuleLockFile) {
filesToCommit.push(bazelModuleLockFile);
}
const filesToCommit: string[] = [workspaceRelativePackageJsonPath];

await this.createCommit(
`build: prepare exceptional minor branch: ${this._newBranch}`,
Expand Down
10 changes: 1 addition & 9 deletions ng-dev/release/publish/actions/shared/branch-off-next-branch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,7 @@ export abstract class BranchOffNextBranchBaseAction extends CutNpmNextPrerelease

// Create an individual commit for the next version bump. The changelog should go into
// a separate commit that makes it clear where the changelog is cherry-picked from.
const filesToCommit: string[] = [
workspaceRelativePackageJsonPath,
...this.getAspectLockFiles(),
];

const bazelModuleLockFile = this.getModuleBazelLockFile();
if (bazelModuleLockFile) {
filesToCommit.push(bazelModuleLockFile);
}
const filesToCommit: string[] = [workspaceRelativePackageJsonPath];

const renovateConfigPath = await updateRenovateConfig(
this.projectDir,
Expand Down
39 changes: 0 additions & 39 deletions ng-dev/release/publish/external-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {ReleaseInfoJsonStdout} from '../info/cli.js';
import {ReleasePrecheckJsonStdin} from '../precheck/cli.js';
import {BuiltPackageWithInfo} from '../config/index.js';
import {green, Log} from '../../utils/logging.js';
import {getBazelBin} from '../../utils/bazel-bin.js';
import {PnpmVersioning} from './pnpm-versioning.js';

/*
Expand Down Expand Up @@ -262,44 +261,6 @@ export abstract class ExternalCommands {
}
}

/**
* Invokes the `bazel mod deps --lockfile_mode=update` command in order
* to refresh `MODULE.bazel.lock` file.
*/
static async invokeBazelModDepsUpdate(projectDir: string): Promise<void> {
const spinner = new Spinner('Updating "MODULE.bazel.lock"');
try {
await ChildProcess.spawn(getBazelBin(), ['mod', 'deps', '--lockfile_mode=update'], {
cwd: projectDir,
mode: 'silent',
});
} catch (e) {
Log.error(e);
Log.error(' ✘ An error occurred while updating "MODULE.bazel.lock".');
throw new FatalReleaseActionError();
}
spinner.success(green(' Updated "MODULE.bazel.lock" file.'));
}

/**
* Invokes the `yarn bazel sync --only=repo` command in order
* to refresh Aspect lock files.
*/
static async invokeBazelUpdateAspectLockFiles(projectDir: string): Promise<void> {
const spinner = new Spinner('Updating Aspect lock files');
try {
await ChildProcess.spawn(getBazelBin(), ['sync', '--only=repo'], {
cwd: projectDir,
mode: 'silent',
});
} catch (e) {
// Note: Gracefully handling these errors because `sync` command
// exits with a non-zero exit code when pnpm-lock.yaml file is updated.
Log.debug(e);
}
spinner.success(green(' Updated Aspect `rules_js` lock files.'));
}

private static async _spawnNpmScript(
args: string[],
projectDir: string,
Expand Down
3 changes: 0 additions & 3 deletions ng-dev/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,3 @@ export const ngDevNpmPackageName = '@angular/ng-dev';

/** Workspace-relative path for the "package.json" file. */
export const workspaceRelativePackageJsonPath = 'package.json';

/** Workspace-relative path for the "MODULE.bazel.lock" file. */
export const workspaceRelativeBazelModuleLock = 'MODULE.bazel.lock';