Skip to content

Commit 0adf2f4

Browse files
omasakunFrozenPandaz
authored andcommitted
fix(core): make watch command work with all and initialRun specified (#32282)
<!-- Please make sure you have read the submission guidelines before posting an PR --> <!-- https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr --> <!-- Please make sure that your commit message follows our format --> <!-- Example: `fix(nx): must begin with lowercase` --> <!-- If this is a particularly complex change or feature addition, you can request a dedicated Nx release for this pull request branch. Mention someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they will confirm if the PR warrants its own release for testing purposes, and generate it for you if appropriate. --> ## Current Behavior <!-- This is the behavior we have today --> If you specify both the `all` and `initialRun` options when running `nx watch`, `initialRun` have no effect. ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> The command should be called once at the beginning even if there are no file changes. ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #32281 (cherry picked from commit c364312)
1 parent fe3c51c commit 0adf2f4

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

  • packages/nx/src/command-line/watch

packages/nx/src/command-line/watch/watch.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ export class BatchFunctionRunner {
4848
this.pendingFiles.add(fileChange.path);
4949
});
5050

51-
return this.process();
51+
return this.process(true);
5252
}
5353

54-
private async process() {
55-
if (!this.running && this.hasPending) {
54+
private async process(runAnyway: boolean) {
55+
if (!this.running && (this.hasPending || runAnyway)) {
5656
this.running = true;
5757

5858
// Clone the pending projects and files before clearing
@@ -65,7 +65,7 @@ export class BatchFunctionRunner {
6565

6666
return this.callback(projects, files).then(() => {
6767
this.running = false;
68-
this.process();
68+
this.process(false);
6969
});
7070
} else {
7171
this._verbose &&

0 commit comments

Comments
 (0)