@nx/vue:stories
Generate stories/specs for all components declared in a project.
Monorepo World: October 7, 2024Monorepo World: October 7, 2024Join us!
Generate stories/specs for all components declared in a project.
This generator will generate stories for all your components in your project. The stories will be generated using Component Story Format 3 (CSF3).
You can also use this generator to generate stories for your Nuxt project:
1nx g @nx/vue:stories project-name
2or
1nx g @nx/nuxt:stories project-name
2You can read more about how this generator works, in the Storybook for Vue overview page.
When running this generator, you will be prompted to provide the following:
name of the project you want to generate the configuration for.interactionTests). If you choose yes, a play function will be added to your stories, and all the necessary dependencies will be installed. You can read more about this in the Nx Storybook interaction tests documentation page..You must provide a name for the generator to work.
By default, this generator will also set up Storybook interaction tests. If you don't want to set up Storybook interaction tests, you can pass the --interactionTests=false option, but it's not recommended.
There are a number of other options available. Let's take a look at some examples.
1nx g @nx/vue:stories --name=ui --ignorePaths=libs/ui/src/not-stories/**,**/**/src/**/*.other.*
2This will generate stories for all the components in the ui project, except for the ones in the libs/ui/src/not-stories directory, and also for components that their file name is of the pattern *.other.*.
This is useful if you have a project that contains components that are not meant to be used in isolation, but rather as part of a larger component.
By default, Nx will ignore the following paths:
1*.stories.ts, *.stories.tsx, *.stories.js, *.stories.jsx, *.stories.mdx
2but you can change this behaviour easily, as explained above.
1nx g @nx/vue:stories --name=ui --js=true
2This will generate stories for all the components in the ui project using JavaScript instead of TypeScript. So, you will have .stories.js files next to your components.
1nx generate stories ...
2By default, Nx will search for stories in the default collection provisioned in workspace.json.
You can specify the collection explicitly as follows:
1nx g @nx/vue:stories ...
2Show what will be generated without writing to disk:
1nx g stories ... --dry-run
2Project for which to generate stories.
trueSet up Storybook interaction tests.
[*.stories.ts,*.stories.tsx,*.stories.js,*.stories.jsx,*.stories.mdx]Paths to ignore when looking for components.
falseGenerate JavaScript files rather than TypeScript files.
falseSkip formatting files.
The Cypress project to generate the stories under. This is inferred from project by default.
Use interactionTests instead. This option will be removed in v20.
Automatically generate *.spec.ts files in the cypress e2e app generated by the cypress-configure generator.
Use interactionTests instead. This option will be removed in v20.