-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Angular: Use Nx function to read non-angularCli configs #13558
Angular: Use Nx function to read non-angularCli configs #13558
Conversation
@ThibaudAV @Marklb can you guys do a quick sanity check. LGTM @gaetanmaisse @merceyz should |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM @mandarini and thanks so much for the contribution. i'm OK with it except for the comments above. will get a few more eyes on it and then merge/release if nobody objects. after you've tested the alpha, we can patch it back into 6.1.x!
Based on its usage, yes, though not just for Yarn PnP (Yarn 2 != pnp as Yarn 2 also supports node_modules) it must be declared so package managers can account for it when they do hoisting |
b0feb1d
to
6acb5d0
Compare
I just updated my PR, added |
6acb5d0
to
3df7a34
Compare
The failing unit test looks related to a caching/hoisting issue in the |
try { | ||
/** | ||
* Apologies for the following line | ||
* If there's a better way to do it, let's do it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know if it's better (or if it's possible)🙈 . but an alternative without try/catch would be to let storybook choose if it should use nx or not 🤷♂️
Something like this:
const isNxWorkspace = fs.existsSync(path.join(dirToSearch, 'nx.json'))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The thing is that it will need to access the readWorkspaceConfig()
from @nrwl/workspace
, so I apologized for using the eslint-disable
to let me require it... :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay,
my point is more about the try/catch. I find the way we handle the nominal case (without nx) in a Catch is not pretty. :/
and I propose this solution if it works and suits you of course :)
const isNxWorkspace = fs.existsSync(path.join(dirToSearch, 'nx.json'))
if(isNxWorkspace) {
return require('@nrwl/workspace').readWorkspaceConfig({
format: 'angularCli',
});
}
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ThibaudAV are you ok to go with the current state?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes 🚀 , I have plans to improve this part. I will do it with a dedicated PR ;)
3df7a34
to
6369a62
Compare
6369a62
to
0009e69
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @gaetanmaisse ! Let me know if I need to make any further changes! I see that the tests are still failing :( |
We are currently working on fixing the tests (they are failing on |
Thank you very much! :) |
Signed-off-by: Gaëtan Maisse <gaetanmaisse@gmail.com>
Issue: #12232
What I did
This is a fix for a behavior described here and here.
A new function is created in the
@nrwl/workspace
package, which will take care of reading/parsing the workspace configuration, and returning it to Storybook in theangularCli
format, which it expects.The new functionality will work after this Nx PR is successfully merged.