-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Angular: Add multi-project setup for ng workspaces #20559
Conversation
144e554
to
ffd1938
Compare
a10a7a5
to
5c7ae17
Compare
fdac629
to
14cf5cc
Compare
f87fc79
to
d584960
Compare
090cf83
to
20fd5e0
Compare
That's great!!! :D Thank you very much @valentinpalkovic for pointing to the Nx plugin! I'm sure it will help with setting up Storybook for Nx. I also like the new Compodoc docs and the opt-in. I need to add this to the Also, how great is this flowchart. |
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 read quickly I don't know the context of each change 😁
But on the whole I think it's great.
And the choice for nx is good
Nice to see people working on this part 😊
Now that the Builder is required, should we still leave a small check to for invalid configuration. In my PR to fix tests, I also removed the deprecated so I could drop the deprecated code's tests. I added a check for the |
7e6698a
to
40d1784
Compare
7841693
to
d015495
Compare
Fix Angular story related to forRoot Module Add back platform reset Fix provider override issue in Angular stories
e039f7c
to
871c650
Compare
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.
Amazing work @valentinpalkovic ❤️
A few questions from my testing. In your test instructions:
const mainRoot = require('../../../.storybook/main.js');
module.exports = {
...mainRoot,
previewAnnotations: [],
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"]
};
What's the purpose of previewAnnotations
? Is that a typo?
Also, the sandbox generated the following in angular.json
:
"storybook": {
"builder": "@storybook/angular:start-storybook",
"options": {
"configDir": ".storybook",
"browserTarget": "angular-latest:build",
"compodoc": false,
"compodocArgs": [
"-e",
"json",
"-d",
"."
],
"port": 6006
}
},
But it seems like compodoc
is still running/working. Any idea what's going on there?
Resolves #20213
Resolves #14026
Resolves #19289
What I did
Remove NX dependency
Previously, we tried to read the NX configuration during initialization to figure out which tsconfig we have to adjust for Storybook to work with Angular. We remove this kind of check. Instead, as soon as we recognize nx being part of the project, we exit the initialization and point to the excellent @nrwl/storybook plugin instead.
Removed support for Angular < 14
We do not support Angular below v14 anymore (18b7618)
Remove the legacy way of using Storybook for Angular
In the past, it was possible to start Storybook independently of any Angular builder. Running
yarn storybook
did the job. Now Storybook is bound to an Angular project, which is set up in theangular.json
file. During initialization, new entries are added to a particular project'sarchitect
section to set up Storybook. You have to runng run <project>:storybook
andng run <project>:build-storybook
now instead. (4b68d75)Multi-project setup in Angular workspace
Before, one Storybook was set up for the entire Angular workspace. Since Storybook is now bound to a particular project, this is not the case anymore. If you have set up multiple applications/libraries within an Angular workspace, you will be asked for which particular project you would like to set up Storybook. (542c535)
Optional Compodoc generation
Previously, compodoc was set up automatically for you. You'll be asked if you'd like to set it up for a particular project.
Fixes some Typescript-related issues related to Template Stories
The stricter set of Typescript rules was causing issues with the Template Stories, which are copied/linked over to a sandbox (4f4b4e4)
Removed legacy renderer
The
parameters.angularLegacyRendering
option is removed. You cannot use the old legacy renderer anymore.Flowchart
How to test
yarn task --task sandbox --template angular-cli/default-ts --no-link
) (Script sometimes stops atPublishing packages
. Rerun the command and start fromRun the internal npm server (run-registry)
.cd ./sandbox/angular-cli-default-ts
yarn storybook
-> Check whether Storybook runs smoothly. Check whether compodoc documentation is available in the addon section. Button inputs for example has some descriptions.npx ng generate application new-application
-> Creates a new application in the angular workspace<path-to-storybook>/code/lib/cli/bin/index.js init
-> Initialize Storybook for new-application. Answer compodoc prompt withN
.projects.angular-latest.architect.storybook
is configured with compodoc args andprojects.new-application.architect.storybook
is configured without compodoc args../projects/new-application/.storybook/main.js
and replace the content with:You must do this for testing because the sub-project does not have defined
template stories
. This adjustment, therefore, is only necessary due to how we set up sandboxes.npx ng run new-application:storybook
yarn build-storybook
-> Builds root project. Outputs Storybook dist tostorybook-static
npx ng run new-application:build-storybook
-> Builds new-application project. Outputs Storybook dist todist/storybook/new-application