nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.51k stars 2.34k forks source link

Add additional entries to workspaceLayout for other configurable root folders, such as coverage #10141

Closed Chowarmaan closed 2 years ago

Chowarmaan commented 2 years ago

Different plugins and configured options place files in directories that are hardset/assumed. For instance, the Jest testing code coverage, goes under the coverage subdirectory of the workspace. It would be nice to be able to specify where these should be placed, instead of the assumed directory.

@twittwer/compdoc for instance, puts data under dist/compodoc.

For instance, I might want to use reports/codecoverage/ and reports/dev/ to have the outputs. Therefore, an added entry to the workspaceLayout for coverage would be needed. All other plugins should be able to do the similar.

It would be nice if I could even specify the project first, so outputs might be in: reports//coverage reports//dev etc.

Description

Add additional base directory configuration settings to workspaceLayout (beyond appDir, libDir) to support the changing the base path that all new generated apps/libs use.

Motivation

While the individual project.json files could be changed to specify these directories, it does mean that each newly generated application (or Library) requires someone to remember to make this change. Having a default value in the main nx.json enforces the structure without others needing to make the changes each time a new app is generated.

Suggested Implementation

With the new specification, similar to appDir/libDir, the base path would simply be used for all the other directory options as well. It would be nice to have a pattern for project as well.

Alternate Implementations

AgentEnder commented 2 years ago

I'm going to close this out, as the workspaceLayout key is meant as a set of areas for Nx to determine where to place items based on the type of project that they are.

In the examples you gave (re: code coverage reports), these are closer to artifact locations. Artifact locations are determined by the executors themselves. If a plugin author wishes to limit repetition in these, they could support <projectRoot> tokens, or similar on the option, or they could place some configuration in the nx.json/pluginsConfiguration object.

For most cases, this will be addressed by some of the negative configuration work briefly touched on in talks at nx-conf lite and the v15 roadmap.

If you have any other questions feel free to ask, but the basis is that adding to workspaceLayout is not the direction we would like to head in for the tool, and that the ability to set defaults + token replacement is closer to where the project is heading.

github-actions[bot] commented 1 year ago

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.