Skip to content

[heft-storybook-plugin] feat: storybook v8 support #4971

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

Merged
merged 5 commits into from
Oct 24, 2024

Conversation

UberMouse
Copy link
Contributor

Also adds new parameter to use the new test build mode in Storybook v8

Summary

Adds a new cliCallingConvention for Storybook v8
Adds a new --storybook-test flag parameter to enable the --test storybook build flag

Fixes #4964

Details

How it was tested

Linked into our monorepo
Built a v8 storybook with/without --storybook-test flag and verified that running a watch build with --storybook-test throws an error

Impacted documentation

Also adds new parameter to use the new test build mode in Storybook v8
@UberMouse UberMouse force-pushed the heft-storybook-plugin-storybook-v8 branch from bd24667 to ada6434 Compare October 14, 2024 01:03
@UberMouse
Copy link
Contributor Author

UberMouse commented Oct 14, 2024

This leaves the "Storybook failed to check addon compatibility" warning

Storybook failed to check addon compatibility Error: Unable to find a usable package manager within NPM, PNPM, Yarn and Yarn 2
    at JsPackageManagerFactory.getPackageManager (/home/taylorl/code/kawaka/common/temp/node_modules/.pnpm/@storybook+core@8.3.5/node_modules/@storybook/core/dist/common/index.cjs:143260:11)
    at getIncompatibleStorybookPackages (/home/taylorl/code/kawaka/common/temp/node_modules/.pnpm/@storybook+core@8.3.5/node_modules/@storybook/core/dist/core-server/index.cjs:48358:58)
    at warnOnIncompatibleAddons (/home/taylorl/code/kawaka/common/temp/node_modules/.pnpm/@storybook+core@8.3.5/node_modules/@storybook/core/dist/core-server/index.cjs:48391:17)
    at buildDevStandalone (/home/taylorl/code/kawaka/common/temp/node_modules/.pnpm/@storybook+core@8.3.5/node_modules/@storybook/core/dist/core-server/index.cjs:48465:11)
    at async withTelemetry (/home/taylorl/code/kawaka/common/temp/node_modules/.pnpm/@storybook+core@8.3.5/node_modules/@storybook/core/dist/core-server/index.cjs:47080:12)
    at async dev (/home/taylorl/code/kawaka/common/temp/node_modules/.pnpm/@storybook+core@8.3.5/node_modules/@storybook/core/dist/cli/bin/index.cjs:2877:3)
    at async r.<anonymous> (/home/taylorl/code/kawaka/common/temp/node_modules/.pnpm/@storybook+core@8.3.5/node_modules/@storybook/core/dist/cli/bin/index.cjs:2929:74)

I'm not sure the best way to work around this with the plugin. Storybook will accept an npm_config_user_agent environment variable that contains manager/version to force it. The plugin could provide this automatically, but it would need to look up the Rush config in your repo to figure out what package manager you are using (which means depending on rush-lib?).

I'm not clear what this is for either, I'm just aiming to get rid of the warning. Looking at references to the getPackageManager method it seems to be things like adding/removing addons, upgrading and something about a "sandbox" which I have to assume probably won't work well in a Rush monorepo anyway even if it knows what package manager to use.

Quite frankly I'm unclear why Storybook logs the message at all. It should fall back to npm assuming the cwd the plugin is executed in can execute npm --version, which I have installed. So I guess the environment it's inheriting doesn't contain the same PATH as my shell it's executed from.

@iclanton iclanton enabled auto-merge (squash) October 24, 2024 00:01
Copy link
Member

@iclanton iclanton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more quick thing.

auto-merge was automatically disabled October 24, 2024 00:44

Head branch was pushed to by a user without write access

@iclanton iclanton merged commit b83d961 into microsoft:main Oct 24, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Closed
Development

Successfully merging this pull request may close these issues.

[heft] support Storybook v8 in heft-storybook-plugin
2 participants