Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to trigger Nx Release on apps/* when changes made to dependent libs/* modules?

Im experimenting with nx release and cannot figure out how make the command release an app when I make a change to a dependent module. Looking at the below graph, you can see i have 3 apps, 2 are dependent on the shared-ui module. nx graph

If I make direct changes to the apps, nx release detects the changes (via conventional commits) and continues as expected. I've now made a change to the shared-ui module and committed it as fix(shared-ui): made a change. I expected that task-management-web and sales-orders-web would have their patch version incremented, but nx release does not detect any changes. nx release output

The changes to shared-ui are being done in a branch. The list of affected apps is correct;

$ nx show projects --type app --affected
sales-orders-web
company-web

but nx release does not detect the changes.

Even explicitly listing the projects to release yields the same output, ie:

$ nx release --projects sales-orders-web company-web --dry-run --skip-publish

Does anyone know how I can resolve this issue?

Thanks, Grant

like image 807
CodeNameGrant Avatar asked Dec 27 '25 14:12

CodeNameGrant


1 Answers

I found this issue (https://github.com/nrwl/nx/issues/26041) and associated reproducer project (https://github.com/JamesHenry/nx-26041) that helped solve this same problem for me.

The key parts were to include the following snippet in the nx.json

{
    "release": {
        "generatorOptions": {
            "updateDependents": "auto"

        }
    }
}

And include a reference to the library in each application project package.json

{
    "name": "@repo/app1",
    "dependencies": {
        "@repo/lib": "x.x.x."
    }
}

After including these changes the nx release command would release and publish both the changed library and the indirectly impacted application.

like image 114
Tim Avatar answered Dec 30 '25 16:12

Tim