Closed mattlewis92 closed 1 year ago
@meeroslav Can you take a look at this issue please?
Thank you @mattlewis92 for opening the issue. I have a look as soon as possible.
I encountered this last night as well in a private repo. I created another example repo before I noticed this issue was already open. When Nx is comparing the modifications to the list of npm packages, it expects the package names to match, but in the case of an alias they do not.
In my repo, here is the change object, c
from the nx code:
{
"type": "JsonPropertyModified",
"path": [
"dependencies",
"@myorg/common"
],
"value": {
"lhs": "npm:@perfective/common@0.8.0",
"rhs": "npm:@perfective/common@0.8.3"
}
}
Here is the package meta data contained in npmPackages
:
{
"type": "npm",
"name": "npm:@myorg/common@npm:@perfective/common",
"data": {
"version": "0.8.3",
"packageName": "@myorg/common@npm:@perfective/common",
"hash": "5a6137d540fe631b7f38fd80917b0e046dce7d5f5ce9b67a8d33e3372e466824"
}
}
So for these aliases, pkg.data.packageName === c.path[1]
doesn't match anything.
Hopefully this helps.
Thank you @gejustin and @mattlewis92 for all the helpful information.
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.
Current Behavior
Adding a new package that is a forked version of the original using this syntax:
Throws an error when running affected via
pnpm nx affected:test
It seems the error is thrown here as
npmPackage
is undefined (one side of the comparison is usingeslint-plugin-disable-autofix
as the package name and the other is using@mattlewis92/eslint-plugin-disable-autofix
):https://github.com/nrwl/nx/blob/master/packages/nx/src/project-graph/affected/locators/npm-packages.ts#L31-L33
Expected Behavior
Affected doesn't throw an error
Steps to Reproduce
See https://github.com/nrwl/nx-examples/pull/244
https://app.circleci.com/pipelines/github/nrwl/nx-examples/436/workflows/d81d036c-2fd9-400e-a6ef-a1db34e8f499/jobs/2493
Failure Logs
See above
Environment