Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[heft] heft-storybook-plugin support "--docs" flag #4982

Open
natle01 opened this issue Oct 23, 2024 · 1 comment
Open

[heft] heft-storybook-plugin support "--docs" flag #4982

natle01 opened this issue Oct 23, 2024 · 1 comment
Labels
effort: easy Probably a quick fix. Want to contribute? :-) help wanted If you're looking to contribute, this issue is a good place to start!

Comments

@natle01
Copy link

natle01 commented Oct 23, 2024

Summary

Extend @rushstack/heft-storybook-plugin to allow passing of Storybook flag --docs.

Need to run and build Storybook in "documentation mode" which requires passing Storybook's --docs flag.

Nice to have:
Able to pass other Storybook flags, but --docs is the main one.

Possible Solution

Could be something like this to extend the schema.

"cliOptionsBuild": {
  "title": "Additional cli options to run when building",
  "description": "Add Storybook flags here to customize your build command. Example. --config-dir config/.storybook",
  "type": "string"
},
"cliOptionsServe": {
  "title": "Additional cli options to run when serving",
  "description": "Add Storybook flags here to customize your serve command. Example. --docs --config-dir config/.storybook",
  "type": "string"
}
// StorybookPlugin.ts
...
const { cliOptionsBuild, cliOptionsServe } = options;
const storybookArgs: string[] = runStorybookOptions.moduleDefaultArgs ?? [];

if (cliOptionsBuild) {
  const _args: string[] = cliOptionsBuild.split(' ');
  storybookArgs.push(_args);
}
if (cliOptionsServe) {
  const _args: string[] = cliOptionsServe.split(' ');
  storybookArgs.push(_args);
}

Standard questions

Question Answer
@rushstack/heft version? 0.68.5
Operating system? Windows
Would you consider contributing a PR? Yes
Node.js version (node -v)? 10.7.0
Question Answer
@rushstack/heft-storybook-plugin version? 0.6.51
Storybook version? 7.6.6
@iclanton
Copy link
Member

iclanton commented Nov 4, 2024

Sounds like a useful feature. Instead of splitting by spaces, you should be able to say the cliOptionsBuild and cliOptionsServe options are string arrays.

@iclanton iclanton moved this from Needs triage to Low priority in Bug Triage Nov 4, 2024
@iclanton iclanton added help wanted If you're looking to contribute, this issue is a good place to start! effort: easy Probably a quick fix. Want to contribute? :-) labels Nov 4, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
effort: easy Probably a quick fix. Want to contribute? :-) help wanted If you're looking to contribute, this issue is a good place to start!
Projects
Status: Low priority
Development

No branches or pull requests

2 participants