Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upAngular - Passing CLI Parameters with storybook #8652
Comments
This comment has been minimized.
This comment has been minimized.
|
Automention: Hey @MaximSagan @igor-dv @kroeder, you've been tagged! Can you give a hand here? |
This comment has been minimized.
This comment has been minimized.
|
Interesting idea. Do you need
Can you specify what exactly you need? Maybe add a short real-world use-case snippet as a comment? |
This comment has been minimized.
This comment has been minimized.
|
H @kroeder , thanks for looking in to this. I am building a white-labeled app, that can support custom SCSS, assets, and other client configurations based on a configuration parameter. The below configuration, set in angular.json, is applied by running -c client1 or --configuration=client1.
So in storybook I would like to do the same, i.e. npm run storybook -c client1 (or with an env variable that hooks into the angular -c), but I would imagine it could be difficult if you are not wrapping the CLI already. |
This comment has been minimized.
This comment has been minimized.
|
A short insight of how storybook currently extracts a project from the angular.json: https://github.com/storybookjs/storybook/blob/next/app/angular/src/server/angular-cli_config.ts#L60 It's this order:
I think having a way of choosing a certain project with something like @shilman @ndelangen this wouldn't be framework agnostic, though. Do we even have non-framework agnostic code in the storybook CLI? This seems to be a very small change to Are there alternatives? |
This comment has been minimized.
This comment has been minimized.
|
Thats a really cool insight, I was not aware it would prioritize a storybook project. Is it possible to have a library as a project? For my use case though I am requesting something a bit different. The "project" consist of shared configurations for multiple clients, and the "configuration" is client specific. So I would want to run start-storybook --ngCliProject storybook --ngCliConfiguration client1 i.e. to show client1 themed ui components in isolation. A solution could be to override the options in Instead it would be something like |


When building and running storybook I would like to be able to pass parameters for angular.json. For instance injecting configurations in Angular is done with "ng serve -c my-config" or "ng build -c my-config" and I would like to do the same when running Angular inside storybook.
As Angular does not support environment variables that is not an option.