Problem:
Affected script does not calculate the affected projects correctly
npm run affected:* -- --base=origin/master --head=HEAD
e.g. npm run affected:dep-graph -- --base=origin/master --head=HEAD
Situation:
Mono Repository that contains more than only an angular project
monorepo
└── backend
└── angular-project
└── more stuff
Problem located:
directlyTouchedProjects and implicitlyTouchedProjects (@nrwl/schematics/src/command-line/affected-apps.js) do a comparison of the filename and the root of the project.
The path of the touched files gets calculated by getFilesUsingBaseAndHead (shared.js) which gets a path with the root of the git repository.
Not working solution:
I changed the root of the project to: angular-project/apps/my-app
This led to a not correct calculation of the dep-graph because the file array of the projects was empty.
Hi, this seems like an interesting problem.
Is it possible to provide a minimal reproduction of this issue?
I was not in office to provide a minimal repo yet.
Thanks to @tfiwm for the Pull request.
Same problem here as well. The same scenario and almost identical structure provided in the situation section of the issue.
I used the patch provided in the associated PR #621 and it's working correctly.
Still a repo for reproduction needed?
Shouldn't because the reason is clear from the source perspective
I've switched my affected:* scripts to affected:* --all until this issue is resolved and the PR #621 is reviewed and merged since it's broken when the workspace root is not on the root of the repo.
It takes to much time for us to use all ;) we just do a copy & Paste (Copy patched file over old one) after npm install to patch the file till it gets merged
@FrozenPandaz this issue can be closed now since the fix is already merged 👍
Closing the issue, fix merged.