rushstack
rushstack copied to clipboard
[heft-storybook-plugin] feat: storybook v8 support
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
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/@[email protected]/node_modules/@storybook/core/dist/common/index.cjs:143260:11)
at getIncompatibleStorybookPackages (/home/taylorl/code/kawaka/common/temp/node_modules/.pnpm/@[email protected]/node_modules/@storybook/core/dist/core-server/index.cjs:48358:58)
at warnOnIncompatibleAddons (/home/taylorl/code/kawaka/common/temp/node_modules/.pnpm/@[email protected]/node_modules/@storybook/core/dist/core-server/index.cjs:48391:17)
at buildDevStandalone (/home/taylorl/code/kawaka/common/temp/node_modules/.pnpm/@[email protected]/node_modules/@storybook/core/dist/core-server/index.cjs:48465:11)
at async withTelemetry (/home/taylorl/code/kawaka/common/temp/node_modules/.pnpm/@[email protected]/node_modules/@storybook/core/dist/core-server/index.cjs:47080:12)
at async dev (/home/taylorl/code/kawaka/common/temp/node_modules/.pnpm/@[email protected]/node_modules/@storybook/core/dist/cli/bin/index.cjs:2877:3)
at async r.<anonymous> (/home/taylorl/code/kawaka/common/temp/node_modules/.pnpm/@[email protected]/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.