From 86853951b1aee5461a484be37d975b31b38e62c2 Mon Sep 17 00:00:00 2001 From: Alan Agius <17563226+alan-agius4@users.noreply.github.com> Date: Tue, 17 Mar 2026 16:43:56 +0000 Subject: [PATCH] refactor(ng-dev/release): centralize and expand ignored paths for snapshot publishing Centralizes the paths to exclude when detecting changes for snapshot publishing into a single constant. Additionally, adds `pubspec.lock` to the list of ignored files to avoid unnecessary snapshot releases when only lock files change. --- ng-dev/release/snapshot-publish/snapshots.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ng-dev/release/snapshot-publish/snapshots.ts b/ng-dev/release/snapshot-publish/snapshots.ts index 5f0ef6a00..982b38d19 100644 --- a/ng-dev/release/snapshot-publish/snapshots.ts +++ b/ng-dev/release/snapshot-publish/snapshots.ts @@ -31,6 +31,11 @@ interface SnapshotRepo { containsChanges: boolean; } +/** + * Paths to exclude from the snapshot commit. + */ +const PATHS_TO_EXCLUDE = ['**/MODULE.bazel.lock', '**/package-lock.json', '**/pubspec.lock']; + export class SnapshotPublisher { /** The current branch name. */ readonly branchName = this.git.getCurrentBranchOrRevision(); @@ -152,7 +157,7 @@ export class SnapshotPublisher { .stdout.trim() .split('\n') .filter((filePath) => filePath !== '') - .map((filePath: string) => rm(join(tmpRepoDir, filePath), {force: true})), + .map((filePath) => rm(join(tmpRepoDir, filePath), {force: true})), ); cpSync(pkg.outputPath, tmpRepoDir, {recursive: true}); this.git.run(['add', '-A'], {cwd: tmpRepoDir}); @@ -166,8 +171,7 @@ export class SnapshotPublisher { 'HEAD', '--', '.', - ':(exclude)**/MODULE.bazel.lock', - ':(exclude)**/package-lock.json', + ...PATHS_TO_EXCLUDE.map((p) => `:(exclude)${p}`), ], {cwd: tmpRepoDir}, ).status === 1;