Skip to content
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

storybookConfigurationGenerator appending to nx.json ad nauseam #27866

Closed
1 of 4 tasks
matthew-williamson opened this issue Sep 10, 2024 · 6 comments · Fixed by #27951
Closed
1 of 4 tasks

storybookConfigurationGenerator appending to nx.json ad nauseam #27866

matthew-williamson opened this issue Sep 10, 2024 · 6 comments · Fixed by #27951
Assignees
Labels

Comments

@matthew-williamson
Copy link

Current Behavior

When using the storybookConfigurationGenerator from @nx/react, my workspace's nx.json file gets an additional tasksRunnerOptions.default.options.cacheableOperations build-storybook value every single time, meaning it eventually looks like

{
  "tasksRunnerOptions": {
    "default": {
      "options": {
        "cacheableOperations": ["build-storybook", "build-storybook", "build-storybook", ...]
      }
    }
  }
}

Expected Behavior

It should not be doing that, if the generator or update of the tree or files or whatever is causing it sees the value in the nx.json array, it shouldn't add a new one.

GitHub Repo

No response

Steps to Reproduce

  1. Run the storybookConfigurationGenerator

Nx Report

N/A

Failure Logs

No response

Package Manager Version

yarn 3.1.1

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

@Coly010
Copy link
Contributor

Coly010 commented Sep 16, 2024

@matthew-williamson Can you please provide the Nx version you're using by running nx report because this should have been fixed already:

nxJson.tasksRunnerOptions?.default?.options?.cacheableOperations &&

@Coly010 Coly010 added blocked: more info needed scope: storybook Issues related to Storybook support in Nx labels Sep 16, 2024
@Coly010 Coly010 self-assigned this Sep 16, 2024
@matthew-williamson
Copy link
Author

@Coly010 ah, I see. Totally possible:

image

@Coly010
Copy link
Contributor

Coly010 commented Sep 16, 2024

Interestingly, you’re on a version that fix exists for.

I see you have a local workspace plugin, are you invoking storybookConfigurationGenerator from this plugin?

@jrschifa
Copy link

jrschifa commented Sep 16, 2024

I think this PR is the culprit that broke the comparison. 05e7602#diff-2cc24f7df8a70ad01ff5f9e420bd92c04b86adda2ee5005bce9aa5a165ab0147L137-L145

Simply missing a ! in front of the check in storybook/src/generators/init/init.js

@Coly010
Copy link
Contributor

Coly010 commented Sep 17, 2024

@jrschifa Ah! good spot. I'll get it resolved

FrozenPandaz pushed a commit that referenced this issue Sep 18, 2024
<!-- 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 -->
`build-storybook` is being added to cacheable operations multiple times
when the `@nx/storybook:init` generator is being invoked.

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
Do not add `build-storybook` multiple times

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #27866

(cherry picked from commit 79443ff)
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants