fix(storybook): update configuration generator nx.json - #34880
Conversation
update namedImports and targetDefaults to not include tsconfig.storybook.json in case the framework is angular Closes nrwl#34879
👷 Deploy request for nx-docs pending review.Visit the deploys page to approve it
|
👷 Deploy request for nx-dev pending review.Visit the deploys page to approve it
|
|
View your CI Pipeline Execution ↗ for commit 362f677
☁️ Nx Cloud last updated this comment at |
There was a problem hiding this comment.
Important
At least one additional CI pipeline execution has run since the conclusion below was written and it may no longer be applicable.
Nx Cloud is proposing a fix for your failed CI:
We applied automatic formatting via pnpm nx format to fix the format:check failure on packages/storybook/src/generators/configuration/lib/util-functions.ts. The file was modified as part of the storybook Angular nx.json fix but was not formatted before the PR was pushed. This change brings the file in line with the workspace's Prettier configuration.
Tip
✅ We verified this fix by re-running nx-cloud record -- nx format:check.
diff --git a/packages/storybook/src/generators/configuration/lib/util-functions.ts b/packages/storybook/src/generators/configuration/lib/util-functions.ts
index 05196cd6..adf78d2f 100644
--- a/packages/storybook/src/generators/configuration/lib/util-functions.ts
+++ b/packages/storybook/src/generators/configuration/lib/util-functions.ts
@@ -672,8 +672,8 @@ export function getTsConfigPath(
path?.length > 0
? path
: getProjectType(tree, root, projectType) === 'application'
- ? 'tsconfig.app.json'
- : 'tsconfig.lib.json'
+ ? 'tsconfig.app.json'
+ : 'tsconfig.lib.json'
);
}
🔔 Heads up, your workspace has pending recommendations ↗ to auto-apply fixes for similar failures.
Because this branch comes from a fork, it is not possible for us to apply fixes directly, but you can apply the changes locally using the available options below.
Apply changes locally with:
npx nx-cloud apply-locally iFuj-C9ko
Apply fix locally with your editor ↗ View interactive diff ↗
🎓 Learn more about Self-Healing CI on nx.dev
…gular-nx-json # Conflicts: # packages/storybook/src/generators/configuration/lib/util-functions.ts
The getTsConfigPath ternary on this branch kept the pre-prettier-3 indentation, so it no longer matched the formatting on master. Running nx format realigns it.
The configuration generator skips tsconfig.storybook.json in nx.json when the UI framework is Angular, but nothing asserted it, so the suite passed with or without the gate. Cover both the production named input and the build-storybook target default, in the Angular and non-Angular directions.
update namedImports and targetDefaults to not include `tsconfig.storybook.json` in case the framework is angular <!-- Please make sure you have read the submission guidelines before posting an PR --> <!-- https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr --> <!-- Please make sure that your commit message follows our format --> <!-- Example: `fix(nx): must begin with lowercase` --> <!-- If this is a particularly complex change or feature addition, you can request a dedicated Nx release for this pull request branch. Mention someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they will confirm if the PR warrants its own release for testing purposes, and generate it for you if appropriate. --> ## Current Behavior <!-- This is the behavior we have today --> When generating storybook configuration for a new project, the nx.json is updated with an entry in the namedImports and targetDefaults for `tsconfig.storybook.json. This file does not exists when angular is used as uiFramework ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> In case the uiFramework is angular the file `tsconfig.storybook.json` should not be added to the namedInputs or targetDefaults in nx.json ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #34879 --------- Co-authored-by: Leosvel Pérez Espinosa <leosvel.perez.espinosa@gmail.com> (cherry picked from commit a283c4f)
update namedImports and targetDefaults to not include
tsconfig.storybook.jsonin case the framework is angularCurrent Behavior
When generating storybook configuration for a new project, the nx.json is updated with an entry in the namedImports and targetDefaults for `tsconfig.storybook.json. This file does not exists when angular is used as uiFramework
Expected Behavior
In case the uiFramework is angular the file
tsconfig.storybook.jsonshould not be added to the namedInputs or targetDefaults in nx.jsonRelated Issue(s)
Fixes #34879