Skip to content

Commit dbc0e07

Browse files
committed
fix(ng-dev): forcefully remove node_modules before publishing (#3044)
Currently, when preparing a release, we execute 'git clean -dfq' to ensure a clean working directory. This is problematic when a '.gitignore' file is present that excludes 'node_modules', as 'git clean' will not remove them. This change updates the release preparation to explicitly remove all 'node_modules' directories, ensuring that we always publish from a clean state. PR Close #3044
1 parent ed31a41 commit dbc0e07

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ng-dev/release/publish/actions.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,10 @@ export abstract class ReleaseAction {
366366
protected async checkoutUpstreamBranch(branchName: string) {
367367
this.git.run(['fetch', '-q', this.git.getRepoGitUrl(), branchName]);
368368
this.git.run(['checkout', '-q', 'FETCH_HEAD', '--detach']);
369-
this.git.run(['clean', '-dfq']);
369+
try {
370+
// Remove node_modules even if they are ignored. (We do not want to run -dxf to avoid deleting other files suchs as .ng-dev-lock)
371+
this.git.run(['clean', 'git clean -dfX **/node_modules']);
372+
} catch {}
370373
}
371374

372375
/** Installs all Yarn dependencies in the current branch. */

0 commit comments

Comments
 (0)