nrwl / nx

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

Generate `storybook-configuration` in Angular installs React #28654

Closed prewk closed 7 hours ago

prewk commented 23 hours ago

Current Behavior

Hi, we've been struggling with this for a while: Every time we run the @nx/angular:storybook-configuration generator in our yarn berry no-installs pnp set-up, nx installs @nx/web, react and react-dom. I've created a repro that shows the problem, it doesn't install @nx/web however.

Expected Behavior

No packages should be installed.

GitHub Repo

https://github.com/prewk/nx-storybook-test

Steps to Reproduce

I've created a lib called foo in the repro repo.

  1. npx nx g @nx/angular:storybook-configuration foo
  2. It'll install React (and some other packages but that makes sense)

Nx Report

Company repo which we want to solve:

Node           : 20.14.0
OS             : darwin-arm64
Native Target  : aarch64-macos
yarn           : 4.4.0

nx                 : 20.0.3
@nx/js             : 20.0.3
@nx/jest           : 20.0.3
@nx/eslint         : 20.0.3
@nx/workspace      : 20.0.3
@nx/angular        : 20.0.3
@nx/devkit         : 20.0.3
@nx/eslint-plugin  : 20.0.3
@nx/plugin         : 20.0.3
@nx/storybook      : 20.0.3
typescript         : 5.5.4
---------------------------------------
Community plugins:
@ngneat/spectator        : 14.0.0
@ngrx/component          : 18.1.0
@ngrx/component-store    : 18.1.0
@ngrx/effects            : 18.1.0
@ngrx/entity             : 18.1.0
@ngrx/operators          : 18.1.0
@ngrx/router-store       : 18.1.0
@ngrx/schematics         : 18.1.0
@ngrx/signals            : 18.1.0
@ngrx/store              : 18.1.0
@ngrx/store-devtools     : 18.1.0
@storybook/angular       : 8.3.6
@testing-library/angular : 14.2.0
---------------------------------------

The reproduction repo:

Node           : 20.14.0
OS             : darwin-arm64
Native Target  : aarch64-macos
npm            : 10.8.2

nx                 : 20.0.6
@nx/js             : 20.0.6
@nx/jest           : 20.0.6
@nx/eslint         : 20.0.6
@nx/workspace      : 20.0.6
@nx/angular        : 20.0.6
@nx/cypress        : 20.0.6
@nx/devkit         : 20.0.6
@nx/eslint-plugin  : 20.0.6
@nx/storybook      : 20.0.6
@nx/web            : 20.0.6
@nx/webpack        : 20.0.6
typescript         : 5.5.4
---------------------------------------
Registered Plugins:
@nx/storybook/plugin

Failure Logs

No response

Package Manager Version

yarn v4.4.0 / npm 10.8.2

Operating System

Additional Information

No response

Coly010 commented 7 hours ago

This is expected and is a result of Storybook requiring it: https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#react-peer-dependencies-required

prewk commented 7 hours ago

That's migration docs for Storybook 7.

As of Storybook 8, Storybook no longer requires React in non-React projects (scroll down to "No more React requirement in non-React projects").