-
-
Notifications
You must be signed in to change notification settings - Fork 9.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chore: (Docs) Updates to the Angular documentation #17387
Conversation
☁️ Nx Cloud ReportCI ran the following commands for commit e7d1401. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this branch ✅ Successfully ran 1 targetSent with 💌 from NxCloud. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good! Misc comments, nothing serious
docs/configure/styling-and-css.md
Outdated
@@ -28,6 +28,37 @@ If your component files import their CSS, Storybook’s webpack config will work | |||
|
|||
<!-- prettier-ignore-end --> | |||
|
|||
- With Angular version 13 and above, you should use a builder configuration to import your CSS: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you want these to be bullets? Also do you want to make this content only visible on the angular version of the docs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed you're correct. I've updated this section and used a similar approach as it's being used in the Get Started section with my latest commit, this way the Angular documentation will only be visible once the reader makes the switch. Let me know of any additional feedback.
- Update your `angular.json` file to include Storybook's custom builder: | ||
|
||
```json | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be placed at the right point in the angular.json
file, either underneath the default project OR in its own project. I'm waiting for @storybookjs/angular , esp @kroeder, to get back to me with best practices here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for letting me know. Once this is addressed, follow up with me and I'll adjust accordingly.
@@ -12,6 +12,28 @@ | |||
|
|||
Check the [Migration Guide](https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#automigrate) for more information on how to set up Webpack 5. | |||
|
|||
- If you're using the custom Storybook builder, Storybook will not automatically open a browser window or tab. It's is a known issue that we plan to fix in future releases. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, I didn't know this 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't mention it. Caught it during testing :)!
# Builds Storybook with Angular's custom builder | ||
# See https://storybook.js.org/docs/angular/get-started/install | ||
# to learn how to create the custom builder | ||
ng run my-project:build-storybook |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we might be able to just instruct users to add this to their "scripts"
tag and then the rest of the instructions could stay the same. WDYT?
{
"scripts": {
"build-storybook": "ng run my-project:build-storybook",
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated the Publish Storybook and factored it in with the latest commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great stuff @jonniebigodes this is awesome 💯
Can we actually add a sample project here? I've made a setup in angular 13, building fine (and I'm able to use the bundle in another app), I've tried all kinds of configs for ~3hrs today. webpack 4, webpack 5, In webpack 5 I either get: a bunch of babel-related errors (e.g. In webpack 4 I keep seeing (and I don't have a custom webpack config) ERR! WebpackOptionsValidationError: Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
ERR! - configuration.module.rules[8].rules[0].oneOf[1].type should be one of these:
ERR! "javascript/auto" | "javascript/dynamic" | "javascript/esm" | "json" | "webassembly/experimental"
ERR! -> Module type to use for the module I have a feeling that the specific versions of angular CLI, devkit & other pieces are really key here. If you have a working repo, would love to see it... |
@theiliad We'll follow up with example projects in the next couple months, but not as part of this PR. |
That's fair. Just so I can make some progress though, could we share the repo/setup that was used to test with angular13? I can just figure it out from there. I might even be able to turn that into a sample repo for the docs |
@theiliad Unfortunately we don't have a repo for that. I was playing around with @kroeder last week to try to better understand where we were at with Angular support and created a repo then. I don't remember where we got to, but I'm sharing that here in case it helps: https://github.com/shilman/storybook-angular13 Most of the inspiration was taken from the monorepo, which is running an older version of Angular but which uses the new config format https://github.com/storybookjs/storybook/tree/next/examples/angular-cli You can also see some migration docs that came out of that session here: #17380 Sorry it's a bit all over the place, but that's where we're at right now. |
Thanks! This is already helping me. Haven't gotten it to fully work yet, but FYI, 1 of the errors that said nothing about compodoc was fixed by adding
to package.json |
Finally got things working! I still have to add my style files, but stories are loading now. Thanks @shilman, I'll look at PRing a new example in the repo soon... |
…ular Chore: (Docs) Updates to the Angular documentation
With this pull request the documentation is updated to feature the Angular Storybook custom builder. Follows up on #17380 and #17305 .
What was done:
@shilman and @storybookjs/angular would appreciate some feedback on this when you're able. Thanks in advance.