Angular Storybook - Is there a way to generate .stories.ts files automatically
Asked Answered
E

1

9

I'm looking to generate a .stories.ts file inside a component folder once we have run ng g component my-component.

The final result should look somehting like this:

my-component

  -my-component.component.html

   .

   .

   .

  -my-component.stories.ts

What I've found so far is a PR that seems to be resolved about using angular with storybook, but i can't find something that explicitly tells how i can do this

The other solution i came across is creating the sript that generates this extra file by myself so that i can run somehting like: ng g component my-component && node generate-story-file.js my-component

Does anyone know if there is another solution?

Thx

Essayist answered 5/10, 2021 at 16:37 Comment(0)
F
0

You can create a custom schematic in Angular and while creating the component call it.

Reference: https://angular.io/guide/schematics

Firelock answered 12/10, 2023 at 7:17 Comment(2)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Phionna
It looks like this article has all answers) mihalcan.medium.com/…Drove

© 2022 - 2024 — McMap. All rights reserved.