nx affected does not run in dep-graph order

Created on 1 Jul 2020  路  3Comments  路  Source: nrwl/nx

Current Behavior

I have (as an example) four projects:

"projectA": { implicitDependecy: ["projectC"] },
"projectB": { implicitDependecy: ["projectC"] },
"projectC": { implicitDependecy: [] },
"projectD": { implicitDependecy: [] },

Assuming I've made a change that affects all projects then if I then run "nx affected --target=myTask", it first runs that task for projectD, then projectB before it runs it for projectC.

(Note: this is running sequentially, not in parallel)

Expected Behavior

Since projectD is completely standalone in this example, it's fine to run that first. But I expect it to execute the tasks in dep-graph order; ie projectC should have been run before projectA and projectB.

The classic example here is where you want to ensure your backend gets deployed before your frontend does.

Steps to Reproduce

Create a dummy project with four projects, using the implicit dependencies as noted above.

Environment

>  NX  Report complete - copy this into the issue template

  @nrwl/angular : Not Found
  @nrwl/cli : 9.4.5
  @nrwl/cypress : 9.4.5
  @nrwl/eslint-plugin-nx : 9.4.5
  @nrwl/express : Not Found
  @nrwl/jest : 9.4.5
  @nrwl/linter : 9.4.5
  @nrwl/nest : Not Found
  @nrwl/next : Not Found
  @nrwl/node : 9.4.5
  @nrwl/react : 9.4.5
  @nrwl/schematics : Not Found
  @nrwl/tao : 9.4.5
  @nrwl/web : 9.4.5
  @nrwl/workspace : 9.4.5
  typescript : 3.8.3
docs feature

Most helpful comment

@jliebrand thanks for submitting the issue. You need to add strictlyOrderedTargets property to the option of your tasks runner. By default it is set to ["build"]. So you probably want to set it to strictlyOrderedTargets: ["build", "myTask"].

I need to make sure it's well documented.

@isaacplmann could you make sure we have information about all runner options in the docs?

All 3 comments

@jliebrand thanks for submitting the issue. You need to add strictlyOrderedTargets property to the option of your tasks runner. By default it is set to ["build"]. So you probably want to set it to strictlyOrderedTargets: ["build", "myTask"].

I need to make sure it's well documented.

@isaacplmann could you make sure we have information about all runner options in the docs?

so basically this whole interface should be added to docs right @vsavkin ?

image

This is now documented with #3399! :tada:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dereklin picture dereklin  路  3Comments

MichaelWarneke picture MichaelWarneke  路  3Comments

jon301 picture jon301  路  3Comments

elliotmendiola picture elliotmendiola  路  3Comments

ZempTime picture ZempTime  路  3Comments