Closed manju-reddys closed 2 years ago
This isn't really a bug but is just an implementation detail behind the CLI bootstrapping process. When Nx starts up, it builds the dependency graph (or reads it from the daemon).
To do this, it needs the workspace configuration. The complete configuration consists of workspace.json
, with all project.json
files inlined. Alternatively, if workspace.json
doesn't exist, the entire configuration is represented as an in-memory object based on all projects located during project inference (think npm workspaces projects).
To change this would be a reasonably major refactoring in CLI initialization/graph construction. Is there a reason behind needing the behavior? Perhaps there is a better way to accomplish your goal.
@AgentEnder We have quite a few applications and private node modules
that some applications depends on (not all the apps). Coping every apps, its related private modules and build, is huge deal breaker in terms of time, resource and unpredictable/breaking issues of apps.
So to minimize the complexity and challenges in the CI build, deploy process, we copy only the app's that are building for example checkout client app and its related server apps + private modules, and remaining apps won't be copied into the docker container for building and packaging, which finally deployed to k8s cluster.
Temp. solution as recommended by you in the slack support, we are cleaning up the angular.json
in the docker before we run the build+package.
You could try removing the workspace.json
/angular.json
file entirely, in which case Nx builds up the configuration from the project.json
files it can find. There's a minor perf hit, so you may decide it's not worth it. We plan to address the perf hit, but you can see if it's a significant enough issue for your use case.
@AgentEnder how would it know the name of the project? I tried this but a command like
yarn nx run myproject:mytarget
says it was unable to find project "myproject". Is there a key in "project.json" that would specify the name?
Project name is inferred based on path in the workspace, or can be manually specified by adding a "name" field in project.json
Confirm that "name" field in the project.json works. Thanks @AgentEnder !
This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. If we missed this issue please reply to keep it active. Thanks for being a part of the Nx community! 🙏
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
Running a build in the docker by just loading relevant apps code, will fail to complete with error, app2
project.json
not found error.Expected Behavior
Should only load the targeted app
project.json
in the build process and ignore rest in theangular.json
Steps to Reproduce
angular.json
to NX version 2 format - it will generateapps/app*/project.json
.nx build app1 --prod
.From the stacktrace:
readWorkspaceConfig (/opt/armada/node_modules/nx/src/project-graph/file-utils.js:99:21
looks like it's trying to load all the projects defined inangular.json
Failure Logs
Environment