@storybook/angular 0.0.0-pr-23609-sha-f47ef339
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +8 -0
- package/README.md +322 -0
- package/dist/builders/build-storybook/index.js +72 -0
- package/dist/builders/build-storybook/index.spec.d.ts +1 -0
- package/dist/builders/build-storybook/index.spec.js +216 -0
- package/dist/builders/build-storybook/schema.json +167 -0
- package/dist/builders/builders.json +14 -0
- package/dist/builders/start-storybook/index.js +93 -0
- package/dist/builders/start-storybook/index.spec.d.ts +1 -0
- package/dist/builders/start-storybook/index.spec.js +215 -0
- package/dist/builders/start-storybook/schema.json +198 -0
- package/dist/builders/utils/error-handler.d.ts +2 -0
- package/dist/builders/utils/error-handler.js +38 -0
- package/dist/builders/utils/run-compodoc.d.ts +6 -0
- package/dist/builders/utils/run-compodoc.js +58 -0
- package/dist/builders/utils/run-compodoc.spec.d.ts +1 -0
- package/dist/builders/utils/run-compodoc.spec.js +86 -0
- package/dist/builders/utils/standalone-options.d.ts +15 -0
- package/dist/builders/utils/standalone-options.js +2 -0
- package/dist/client/angular-beta/AbstractRenderer.d.ts +53 -0
- package/dist/client/angular-beta/AbstractRenderer.js +180 -0
- package/dist/client/angular-beta/CanvasRenderer.d.ts +13 -0
- package/dist/client/angular-beta/CanvasRenderer.js +16 -0
- package/dist/client/angular-beta/ComputesTemplateFromComponent.d.ts +17 -0
- package/dist/client/angular-beta/ComputesTemplateFromComponent.js +132 -0
- package/dist/client/angular-beta/ComputesTemplateFromComponent.test.d.ts +1 -0
- package/dist/client/angular-beta/ComputesTemplateFromComponent.test.js +403 -0
- package/dist/client/angular-beta/DocsRenderer.d.ts +13 -0
- package/dist/client/angular-beta/DocsRenderer.js +40 -0
- package/dist/client/angular-beta/RendererFactory.d.ts +11 -0
- package/dist/client/angular-beta/RendererFactory.js +56 -0
- package/dist/client/angular-beta/RendererFactory.test.d.ts +1 -0
- package/dist/client/angular-beta/RendererFactory.test.js +164 -0
- package/dist/client/angular-beta/StorybookModule.d.ts +8 -0
- package/dist/client/angular-beta/StorybookModule.js +29 -0
- package/dist/client/angular-beta/StorybookModule.test.d.ts +1 -0
- package/dist/client/angular-beta/StorybookModule.test.js +311 -0
- package/dist/client/angular-beta/StorybookProvider.d.ts +5 -0
- package/dist/client/angular-beta/StorybookProvider.js +26 -0
- package/dist/client/angular-beta/StorybookWrapperComponent.d.ts +16 -0
- package/dist/client/angular-beta/StorybookWrapperComponent.js +140 -0
- package/dist/client/angular-beta/__testfixtures__/input.component.d.ts +26 -0
- package/dist/client/angular-beta/__testfixtures__/input.component.js +67 -0
- package/dist/client/angular-beta/__testfixtures__/test.module.d.ts +2 -0
- package/dist/client/angular-beta/__testfixtures__/test.module.js +20 -0
- package/dist/client/angular-beta/utils/NgComponentAnalyzer.d.ts +29 -0
- package/dist/client/angular-beta/utils/NgComponentAnalyzer.js +100 -0
- package/dist/client/angular-beta/utils/NgComponentAnalyzer.test.d.ts +1 -0
- package/dist/client/angular-beta/utils/NgComponentAnalyzer.test.js +374 -0
- package/dist/client/angular-beta/utils/NgModulesAnalyzer.d.ts +6 -0
- package/dist/client/angular-beta/utils/NgModulesAnalyzer.js +41 -0
- package/dist/client/angular-beta/utils/NgModulesAnalyzer.test.d.ts +1 -0
- package/dist/client/angular-beta/utils/NgModulesAnalyzer.test.js +23 -0
- package/dist/client/angular-beta/utils/PropertyExtractor.d.ts +32 -0
- package/dist/client/angular-beta/utils/PropertyExtractor.js +162 -0
- package/dist/client/angular-beta/utils/PropertyExtractor.test.d.ts +1 -0
- package/dist/client/angular-beta/utils/PropertyExtractor.test.js +142 -0
- package/dist/client/config.d.ts +6 -0
- package/dist/client/config.js +10 -0
- package/dist/client/decorateStory.d.ts +4 -0
- package/dist/client/decorateStory.js +49 -0
- package/dist/client/decorateStory.test.d.ts +1 -0
- package/dist/client/decorateStory.test.js +304 -0
- package/dist/client/decorators.d.ts +14 -0
- package/dist/client/decorators.js +70 -0
- package/dist/client/decorators.test.d.ts +1 -0
- package/dist/client/decorators.test.js +146 -0
- package/dist/client/docs/__testfixtures__/doc-button/input.d.ts +111 -0
- package/dist/client/docs/__testfixtures__/doc-button/input.js +207 -0
- package/dist/client/docs/__testfixtures__/doc-button/tsconfig.json +7 -0
- package/dist/client/docs/angular-properties.test.d.ts +1 -0
- package/dist/client/docs/angular-properties.test.js +62 -0
- package/dist/client/docs/compodoc.d.ts +12 -0
- package/dist/client/docs/compodoc.js +258 -0
- package/dist/client/docs/compodoc.test.d.ts +1 -0
- package/dist/client/docs/compodoc.test.js +131 -0
- package/dist/client/docs/config.d.ts +4 -0
- package/dist/client/docs/config.js +19 -0
- package/dist/client/docs/index.d.ts +1 -0
- package/dist/client/docs/index.js +17 -0
- package/dist/client/docs/sourceDecorator.d.ts +9 -0
- package/dist/client/docs/sourceDecorator.js +51 -0
- package/dist/client/docs/types.d.ts +102 -0
- package/dist/client/docs/types.js +2 -0
- package/dist/client/globals.d.ts +23 -0
- package/dist/client/globals.js +40 -0
- package/dist/client/index.d.ts +5 -0
- package/dist/client/index.js +30 -0
- package/dist/client/preview-prod.d.ts +1 -0
- package/dist/client/preview-prod.js +4 -0
- package/dist/client/public-api.d.ts +15 -0
- package/dist/client/public-api.js +36 -0
- package/dist/client/public-types.d.ts +37 -0
- package/dist/client/public-types.js +2 -0
- package/dist/client/render.d.ts +7 -0
- package/dist/client/render.js +19 -0
- package/dist/client/types.d.ts +46 -0
- package/dist/client/types.js +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +29 -0
- package/dist/index.mjs +13 -0
- package/dist/preset.d.ts +6 -0
- package/dist/preset.js +36 -0
- package/dist/preset.mjs +30 -0
- package/dist/renderer.d.ts +6 -0
- package/dist/renderer.js +15 -0
- package/dist/renderer.mjs +6 -0
- package/dist/server/__mocks-ng-workspace__/empty-projects-entry/angular.json +4 -0
- package/dist/server/__mocks-ng-workspace__/minimal-config/angular.json +18 -0
- package/dist/server/__mocks-ng-workspace__/minimal-config/src/main.d.ts +1 -0
- package/dist/server/__mocks-ng-workspace__/minimal-config/src/main.js +5 -0
- package/dist/server/__mocks-ng-workspace__/minimal-config/src/tsconfig.app.json +9 -0
- package/dist/server/__mocks-ng-workspace__/minimal-config/tsconfig.json +13 -0
- package/dist/server/__mocks-ng-workspace__/some-config/angular.json +19 -0
- package/dist/server/__mocks-ng-workspace__/some-config/src/main.d.ts +1 -0
- package/dist/server/__mocks-ng-workspace__/some-config/src/main.js +5 -0
- package/dist/server/__mocks-ng-workspace__/some-config/src/tsconfig.app.json +9 -0
- package/dist/server/__mocks-ng-workspace__/some-config/tsconfig.json +13 -0
- package/dist/server/__mocks-ng-workspace__/with-angularBrowserTarget/angular.json +64 -0
- package/dist/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/main.d.ts +1 -0
- package/dist/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/main.js +5 -0
- package/dist/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/tsconfig.app.json +9 -0
- package/dist/server/__mocks-ng-workspace__/with-angularBrowserTarget/tsconfig.json +13 -0
- package/dist/server/__mocks-ng-workspace__/with-lib/angular.json +28 -0
- package/dist/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/src/main.d.ts +1 -0
- package/dist/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/src/main.js +5 -0
- package/dist/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/tsconfig.lib.json +20 -0
- package/dist/server/__mocks-ng-workspace__/with-lib/tsconfig.json +13 -0
- package/dist/server/__mocks-ng-workspace__/with-nx/angular.json +18 -0
- package/dist/server/__mocks-ng-workspace__/with-nx/nx.json +3 -0
- package/dist/server/__mocks-ng-workspace__/with-nx/src/main.d.ts +1 -0
- package/dist/server/__mocks-ng-workspace__/with-nx/src/main.js +5 -0
- package/dist/server/__mocks-ng-workspace__/with-nx/src/tsconfig.app.json +8 -0
- package/dist/server/__mocks-ng-workspace__/with-nx/tsconfig.json +14 -0
- package/dist/server/__mocks-ng-workspace__/with-nx-workspace/nx.json +3 -0
- package/dist/server/__mocks-ng-workspace__/with-nx-workspace/src/main.d.ts +1 -0
- package/dist/server/__mocks-ng-workspace__/with-nx-workspace/src/main.js +5 -0
- package/dist/server/__mocks-ng-workspace__/with-nx-workspace/src/tsconfig.app.json +8 -0
- package/dist/server/__mocks-ng-workspace__/with-nx-workspace/tsconfig.json +14 -0
- package/dist/server/__mocks-ng-workspace__/with-nx-workspace/workspace.json +18 -0
- package/dist/server/__mocks-ng-workspace__/with-options-styles/angular.json +18 -0
- package/dist/server/__mocks-ng-workspace__/with-options-styles/src/main.d.ts +1 -0
- package/dist/server/__mocks-ng-workspace__/with-options-styles/src/main.js +5 -0
- package/dist/server/__mocks-ng-workspace__/with-options-styles/src/tsconfig.app.json +9 -0
- package/dist/server/__mocks-ng-workspace__/with-options-styles/tsconfig.json +13 -0
- package/dist/server/__mocks-ng-workspace__/without-architect-build/angular.json +5 -0
- package/dist/server/__mocks-ng-workspace__/without-architect-build-options/angular.json +11 -0
- package/dist/server/__mocks-ng-workspace__/without-compatible-projects/angular.json +7 -0
- package/dist/server/__mocks-ng-workspace__/without-projects-entry/angular.json +3 -0
- package/dist/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/src/main.d.ts +1 -0
- package/dist/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/src/main.js +5 -0
- package/dist/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/tsconfig.lib.json +20 -0
- package/dist/server/__mocks-ng-workspace__/without-projects-entry/tsconfig.json +13 -0
- package/dist/server/__mocks-ng-workspace__/without-tsConfig/angular.json +16 -0
- package/dist/server/__mocks-ng-workspace__/without-tsConfig/src/main.d.ts +1 -0
- package/dist/server/__mocks-ng-workspace__/without-tsConfig/src/main.js +5 -0
- package/dist/server/__mocks-ng-workspace__/without-tsConfig/src/tsconfig.app.json +9 -0
- package/dist/server/__mocks-ng-workspace__/without-tsConfig/tsconfig.json +13 -0
- package/dist/server/__tests__/angular.json +96 -0
- package/dist/server/angular-cli-webpack.d.ts +1 -0
- package/dist/server/angular-cli-webpack.js +99 -0
- package/dist/server/framework-preset-angular-cli.d.ts +4 -0
- package/dist/server/framework-preset-angular-cli.js +85 -0
- package/dist/server/framework-preset-angular-docs.d.ts +2 -0
- package/dist/server/framework-preset-angular-docs.js +10 -0
- package/dist/server/framework-preset-angular-ivy.d.ts +10 -0
- package/dist/server/framework-preset-angular-ivy.js +103 -0
- package/dist/server/plugins/storybook-normalize-angular-entry-plugin.d.ts +25 -0
- package/dist/server/plugins/storybook-normalize-angular-entry-plugin.js +48 -0
- package/dist/server/preset-options.d.ts +13 -0
- package/dist/server/preset-options.js +2 -0
- package/dist/server/utils/filter-out-styling-rules.d.ts +2 -0
- package/dist/server/utils/filter-out-styling-rules.js +17 -0
- package/dist/server/utils/module-is-available.d.ts +1 -0
- package/dist/server/utils/module-is-available.js +13 -0
- package/dist/types.d.ts +29 -0
- package/dist/types.js +2 -0
- package/dist/types.mjs +1 -0
- package/jest.config.js +31 -0
- package/package.json +126 -0
- package/preset.js +1 -0
- package/renderer.d.ts +1 -0
- package/renderer.js +1 -0
- package/src/server/angular-cli-webpack.d.ts +7 -0
- package/src/server/angular-cli-webpack.js +127 -0
- package/src/server/plugins/storybook-normalize-angular-entry-plugin.js +54 -0
- package/src/typings.d.ts +21 -0
- package/template/cli/.eslintrc.json +5 -0
- package/template/cli/Button.stories.ts +51 -0
- package/template/cli/Header.stories.ts +37 -0
- package/template/cli/Page.stories.ts +46 -0
- package/template/cli/User.ts +2 -0
- package/template/cli/button.component.ts +55 -0
- package/template/cli/header.component.ts +75 -0
- package/template/cli/page.component.ts +77 -0
- package/template/components/button.component.ts +54 -0
- package/template/components/button.css +30 -0
- package/template/components/form.component.ts +37 -0
- package/template/components/html.component.ts +22 -0
- package/template/components/index.js +8 -0
- package/template/components/pre.component.ts +29 -0
- package/template/stories/angular-mdx.stories.mdx +25 -0
- package/template/stories/argTypes/doc-button/doc-button.component.html +7 -0
- package/template/stories/argTypes/doc-button/doc-button.component.scss +3 -0
- package/template/stories/argTypes/doc-button/doc-button.component.ts +232 -0
- package/template/stories/argTypes/doc-button/doc-button.stories.ts +24 -0
- package/template/stories/argTypes/doc-directive/doc-directive.directive.ts +24 -0
- package/template/stories/argTypes/doc-directive/doc-directive.stories.ts +14 -0
- package/template/stories/argTypes/doc-injectable/doc-injectable.service.ts +27 -0
- package/template/stories/argTypes/doc-injectable/doc-injectable.stories.ts +17 -0
- package/template/stories/argTypes/doc-pipe/doc-pipe.pipe.ts +18 -0
- package/template/stories/argTypes/doc-pipe/doc-pipe.stories.ts +17 -0
- package/template/stories/basics/README.stories.mdx +7 -0
- package/template/stories/basics/angular-forms/customControlValueAccessor/custom-cva-component.stories.ts +27 -0
- package/template/stories/basics/angular-forms/customControlValueAccessor/custom-cva.component.ts +57 -0
- package/template/stories/basics/component-with-complex-selectors/attribute-selector.component.ts +19 -0
- package/template/stories/basics/component-with-complex-selectors/attribute-selectors.component.stories.ts +8 -0
- package/template/stories/basics/component-with-complex-selectors/class-selector.component.stories.ts +8 -0
- package/template/stories/basics/component-with-complex-selectors/class-selector.component.ts +19 -0
- package/template/stories/basics/component-with-complex-selectors/multiple-class-selector.component.stories.ts +8 -0
- package/template/stories/basics/component-with-complex-selectors/multiple-selector.component.stories.ts +8 -0
- package/template/stories/basics/component-with-complex-selectors/multiple-selector.component.ts +37 -0
- package/template/stories/basics/component-with-enums/enums.component.html +8 -0
- package/template/stories/basics/component-with-enums/enums.component.stories.ts +24 -0
- package/template/stories/basics/component-with-enums/enums.component.ts +53 -0
- package/template/stories/basics/component-with-inheritance/base-button.component.ts +10 -0
- package/template/stories/basics/component-with-inheritance/base-button.stories.ts +12 -0
- package/template/stories/basics/component-with-inheritance/icon-button.component.ts +11 -0
- package/template/stories/basics/component-with-inheritance/icon-button.stories.ts +13 -0
- package/template/stories/basics/component-with-ng-content/ng-content-about-parent.stories.ts +58 -0
- package/template/stories/basics/component-with-ng-content/ng-content-simple.stories.ts +29 -0
- package/template/stories/basics/component-with-ng-on-destroy/component-with-on-destroy.stories.ts +40 -0
- package/template/stories/basics/component-with-on-push/on-push-box.component.ts +21 -0
- package/template/stories/basics/component-with-on-push/on-push.stories.ts +21 -0
- package/template/stories/basics/component-with-pipe/custom-pipes.stories.ts +31 -0
- package/template/stories/basics/component-with-pipe/custom.pipe.ts +10 -0
- package/template/stories/basics/component-with-pipe/with-pipe.component.ts +10 -0
- package/template/stories/basics/component-with-provider/di.component.html +7 -0
- package/template/stories/basics/component-with-provider/di.component.stories.ts +26 -0
- package/template/stories/basics/component-with-provider/di.component.ts +28 -0
- package/template/stories/basics/component-with-style/styled.component.css +3 -0
- package/template/stories/basics/component-with-style/styled.component.html +5 -0
- package/template/stories/basics/component-with-style/styled.component.scss +5 -0
- package/template/stories/basics/component-with-style/styled.component.stories.ts +10 -0
- package/template/stories/basics/component-with-style/styled.component.ts +8 -0
- package/template/stories/basics/component-without-selector/without-selector-ng-component-outlet.stories.ts +73 -0
- package/template/stories/basics/component-without-selector/without-selector-ng-factory-resolver.stories.ts +71 -0
- package/template/stories/basics/component-without-selector/without-selector.component.ts +30 -0
- package/template/stories/basics/component-without-selector/without-selector.stories.ts +30 -0
- package/template/stories/basics/ng-module/angular-src/chip-color.token.ts +3 -0
- package/template/stories/basics/ng-module/angular-src/chip-text.pipe.ts +29 -0
- package/template/stories/basics/ng-module/angular-src/chip.component.ts +60 -0
- package/template/stories/basics/ng-module/angular-src/chips-group.component.ts +49 -0
- package/template/stories/basics/ng-module/angular-src/chips.module.ts +31 -0
- package/template/stories/basics/ng-module/import-module-chip.stories.ts +23 -0
- package/template/stories/basics/ng-module/import-module-for-root.stories.ts +50 -0
- package/template/stories/basics/ng-module/import-module.stories.ts +35 -0
- package/template/stories/button.component.ts +26 -0
- package/template/stories/core/README.stories.mdx +7 -0
- package/template/stories/core/applicationConfig/with-browser-animations.stories.ts +40 -0
- package/template/stories/core/applicationConfig/with-noop-browser-animations.stories.ts +35 -0
- package/template/stories/core/decorators/componentWrapperDecorator/child.component.ts +20 -0
- package/template/stories/core/decorators/componentWrapperDecorator/decorators.stories.ts +99 -0
- package/template/stories/core/decorators/componentWrapperDecorator/parent.component.ts +18 -0
- package/template/stories/core/decorators/theme-decorator/decorators.stories.ts +20 -0
- package/template/stories/core/moduleMetadata/angular-src/custom.pipe.ts +10 -0
- package/template/stories/core/moduleMetadata/angular-src/dummy.service.ts +14 -0
- package/template/stories/core/moduleMetadata/angular-src/open-close-component/open-close.component.css +13 -0
- package/template/stories/core/moduleMetadata/angular-src/open-close-component/open-close.component.html +7 -0
- package/template/stories/core/moduleMetadata/angular-src/open-close-component/open-close.component.ts +39 -0
- package/template/stories/core/moduleMetadata/angular-src/service.component.ts +24 -0
- package/template/stories/core/moduleMetadata/angular-src/token.component.ts +31 -0
- package/template/stories/core/moduleMetadata/in-export-default.stories.ts +38 -0
- package/template/stories/core/moduleMetadata/in-stories.stories.ts +46 -0
- package/template/stories/core/moduleMetadata/merge-default-and-story.stories.ts +35 -0
- package/template/stories/core/parameters/bootstrap-options.stories.ts +18 -0
- package/template/stories/core/styles/story-styles.stories.ts +50 -0
- package/template/stories/others/app-initializer-use-factory/app-initializer-use-factory.stories.ts +34 -0
- package/template/stories/others/issues/12009-unknown-component.stories.ts +14 -0
- package/template/stories/others/ngx-translate/README.stories.mdx +65 -0
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
|
+
"title": "Build Storybook",
|
|
4
|
+
"description": "Serve up storybook in development mode.",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"browserTarget": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "Build target to be served in project-name:builder:config format. Should generally target on the builder: '@angular-devkit/build-angular:browser'. Useful for Storybook to use options (styles, assets, ...).",
|
|
10
|
+
"pattern": "^[^:\\s]+:[^:\\s]+(:[^\\s]+)?$",
|
|
11
|
+
"default": null
|
|
12
|
+
},
|
|
13
|
+
"tsConfig": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"description": "The full path for the TypeScript configuration file, relative to the current workspace."
|
|
16
|
+
},
|
|
17
|
+
"outputDir": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"description": "Directory where to store built files.",
|
|
20
|
+
"default": "storybook-static"
|
|
21
|
+
},
|
|
22
|
+
"configDir": {
|
|
23
|
+
"type": "string",
|
|
24
|
+
"description": "Directory where to load Storybook configurations from.",
|
|
25
|
+
"default": ".storybook"
|
|
26
|
+
},
|
|
27
|
+
"loglevel": {
|
|
28
|
+
"type": "string",
|
|
29
|
+
"description": "Controls level of logging during build. Can be one of: [silly, verbose, info (default), warn, error, silent].",
|
|
30
|
+
"pattern": "(silly|verbose|info|warn|silent)"
|
|
31
|
+
},
|
|
32
|
+
"enableProdMode": {
|
|
33
|
+
"type": "boolean",
|
|
34
|
+
"description": "Disable Angular's development mode, which turns off assertions and other checks within the framework.",
|
|
35
|
+
"default": true
|
|
36
|
+
},
|
|
37
|
+
"quiet": {
|
|
38
|
+
"type": "boolean",
|
|
39
|
+
"description": "Suppress verbose build output.",
|
|
40
|
+
"default": false
|
|
41
|
+
},
|
|
42
|
+
"docs": {
|
|
43
|
+
"type": "boolean",
|
|
44
|
+
"description": "Starts Storybook in documentation mode. Learn more about it : https://storybook.js.org/docs/react/writing-docs/build-documentation#preview-storybooks-documentation.",
|
|
45
|
+
"default": false
|
|
46
|
+
},
|
|
47
|
+
"compodoc": {
|
|
48
|
+
"type": "boolean",
|
|
49
|
+
"description": "Execute compodoc before.",
|
|
50
|
+
"default": true
|
|
51
|
+
},
|
|
52
|
+
"compodocArgs": {
|
|
53
|
+
"type": "array",
|
|
54
|
+
"description": "Compodoc options : https://compodoc.app/guides/options.html. Options `-p` with tsconfig path and `-d` with workspace root is always given.",
|
|
55
|
+
"default": ["-e", "json"],
|
|
56
|
+
"items": {
|
|
57
|
+
"type": "string"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"webpackStatsJson": {
|
|
61
|
+
"type": ["boolean", "string"],
|
|
62
|
+
"description": "Write Webpack Stats JSON to disk",
|
|
63
|
+
"default": false
|
|
64
|
+
},
|
|
65
|
+
"styles": {
|
|
66
|
+
"type": "array",
|
|
67
|
+
"description": "Global styles to be included in the build.",
|
|
68
|
+
"items": {
|
|
69
|
+
"$ref": "#/definitions/styleElement"
|
|
70
|
+
},
|
|
71
|
+
"default": ""
|
|
72
|
+
},
|
|
73
|
+
"stylePreprocessorOptions": {
|
|
74
|
+
"description": "Options to pass to style preprocessors.",
|
|
75
|
+
"type": "object",
|
|
76
|
+
"properties": {
|
|
77
|
+
"includePaths": {
|
|
78
|
+
"description": "Paths to include. Paths will be resolved to workspace root.",
|
|
79
|
+
"type": "array",
|
|
80
|
+
"items": {
|
|
81
|
+
"type": "string"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"additionalProperties": false,
|
|
86
|
+
"default": ""
|
|
87
|
+
},
|
|
88
|
+
"assets": {
|
|
89
|
+
"type": "array",
|
|
90
|
+
"description": "List of static application assets.",
|
|
91
|
+
"default": [],
|
|
92
|
+
"items": {
|
|
93
|
+
"$ref": "#/definitions/assetPattern"
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
"additionalProperties": false,
|
|
98
|
+
"definitions": {
|
|
99
|
+
"assetPattern": {
|
|
100
|
+
"oneOf": [
|
|
101
|
+
{
|
|
102
|
+
"type": "object",
|
|
103
|
+
"properties": {
|
|
104
|
+
"followSymlinks": {
|
|
105
|
+
"type": "boolean",
|
|
106
|
+
"default": false,
|
|
107
|
+
"description": "Allow glob patterns to follow symlink directories. This allows subdirectories of the symlink to be searched."
|
|
108
|
+
},
|
|
109
|
+
"glob": {
|
|
110
|
+
"type": "string",
|
|
111
|
+
"description": "The pattern to match."
|
|
112
|
+
},
|
|
113
|
+
"input": {
|
|
114
|
+
"type": "string",
|
|
115
|
+
"description": "The input directory path in which to apply 'glob'. Defaults to the project root."
|
|
116
|
+
},
|
|
117
|
+
"ignore": {
|
|
118
|
+
"description": "An array of globs to ignore.",
|
|
119
|
+
"type": "array",
|
|
120
|
+
"items": {
|
|
121
|
+
"type": "string"
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
"output": {
|
|
125
|
+
"type": "string",
|
|
126
|
+
"description": "Absolute path within the output."
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
"additionalProperties": false,
|
|
130
|
+
"required": ["glob", "input", "output"]
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"type": "string"
|
|
134
|
+
}
|
|
135
|
+
]
|
|
136
|
+
},
|
|
137
|
+
"styleElement": {
|
|
138
|
+
"oneOf": [
|
|
139
|
+
{
|
|
140
|
+
"type": "object",
|
|
141
|
+
"properties": {
|
|
142
|
+
"input": {
|
|
143
|
+
"type": "string",
|
|
144
|
+
"description": "The file to include."
|
|
145
|
+
},
|
|
146
|
+
"bundleName": {
|
|
147
|
+
"type": "string",
|
|
148
|
+
"pattern": "^[\\w\\-.]*$",
|
|
149
|
+
"description": "The bundle name for this extra entry point."
|
|
150
|
+
},
|
|
151
|
+
"inject": {
|
|
152
|
+
"type": "boolean",
|
|
153
|
+
"description": "If the bundle will be referenced in the HTML file.",
|
|
154
|
+
"default": true
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
"additionalProperties": false,
|
|
158
|
+
"required": ["input"]
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"type": "string",
|
|
162
|
+
"description": "The file to include."
|
|
163
|
+
}
|
|
164
|
+
]
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"builders": {
|
|
3
|
+
"build-storybook": {
|
|
4
|
+
"implementation": "./build-storybook",
|
|
5
|
+
"schema": "./build-storybook/schema.json",
|
|
6
|
+
"description": "Build storybook"
|
|
7
|
+
},
|
|
8
|
+
"start-storybook": {
|
|
9
|
+
"implementation": "./start-storybook",
|
|
10
|
+
"schema": "./start-storybook/schema.json",
|
|
11
|
+
"description": "Start storybook"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const architect_1 = require("@angular-devkit/architect");
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const find_up_1 = require("find-up");
|
|
7
|
+
const read_pkg_up_1 = require("read-pkg-up");
|
|
8
|
+
const cli_1 = require("@storybook/cli");
|
|
9
|
+
const telemetry_1 = require("@storybook/telemetry");
|
|
10
|
+
const core_server_1 = require("@storybook/core-server");
|
|
11
|
+
const run_compodoc_1 = require("../utils/run-compodoc");
|
|
12
|
+
const error_handler_1 = require("../utils/error-handler");
|
|
13
|
+
(0, telemetry_1.addToGlobalContext)('cliVersion', cli_1.versions.storybook);
|
|
14
|
+
const commandBuilder = (options, context) => {
|
|
15
|
+
const builder = (0, rxjs_1.from)(setup(options, context)).pipe((0, operators_1.switchMap)(({ tsConfig }) => {
|
|
16
|
+
const runCompodoc$ = options.compodoc
|
|
17
|
+
? (0, run_compodoc_1.runCompodoc)({
|
|
18
|
+
compodocArgs: [...options.compodocArgs, ...(options.quiet ? ['--silent'] : [])],
|
|
19
|
+
tsconfig: tsConfig,
|
|
20
|
+
}, context).pipe((0, operators_1.mapTo)({ tsConfig }))
|
|
21
|
+
: (0, rxjs_1.of)({});
|
|
22
|
+
return runCompodoc$.pipe((0, operators_1.mapTo)({ tsConfig }));
|
|
23
|
+
}), (0, operators_1.map)(({ tsConfig }) => {
|
|
24
|
+
(0, cli_1.getEnvConfig)(options, {
|
|
25
|
+
port: 'SBCONFIG_PORT',
|
|
26
|
+
host: 'SBCONFIG_HOSTNAME',
|
|
27
|
+
staticDir: 'SBCONFIG_STATIC_DIR',
|
|
28
|
+
configDir: 'SBCONFIG_CONFIG_DIR',
|
|
29
|
+
ci: 'CI',
|
|
30
|
+
});
|
|
31
|
+
// eslint-disable-next-line no-param-reassign
|
|
32
|
+
options.port = parseInt(`${options.port}`, 10);
|
|
33
|
+
const { browserTarget, stylePreprocessorOptions, styles, ci, configDir, docs, host, https, port, quiet, enableProdMode = false, smokeTest, sslCa, sslCert, sslKey, disableTelemetry, assets, initialPath, open, } = options;
|
|
34
|
+
const standaloneOptions = {
|
|
35
|
+
packageJson: (0, read_pkg_up_1.sync)({ cwd: __dirname }).packageJson,
|
|
36
|
+
ci,
|
|
37
|
+
configDir,
|
|
38
|
+
...(docs ? { docs } : {}),
|
|
39
|
+
host,
|
|
40
|
+
https,
|
|
41
|
+
port,
|
|
42
|
+
quiet,
|
|
43
|
+
enableProdMode,
|
|
44
|
+
smokeTest,
|
|
45
|
+
sslCa,
|
|
46
|
+
sslCert,
|
|
47
|
+
sslKey,
|
|
48
|
+
disableTelemetry,
|
|
49
|
+
angularBrowserTarget: browserTarget,
|
|
50
|
+
angularBuilderContext: context,
|
|
51
|
+
angularBuilderOptions: {
|
|
52
|
+
...(stylePreprocessorOptions ? { stylePreprocessorOptions } : {}),
|
|
53
|
+
...(styles ? { styles } : {}),
|
|
54
|
+
...(assets ? { assets } : {}),
|
|
55
|
+
},
|
|
56
|
+
tsConfig,
|
|
57
|
+
initialPath,
|
|
58
|
+
open,
|
|
59
|
+
};
|
|
60
|
+
return standaloneOptions;
|
|
61
|
+
}), (0, operators_1.switchMap)((standaloneOptions) => runInstance(standaloneOptions)), (0, operators_1.map)((port) => {
|
|
62
|
+
return { success: true, info: { port } };
|
|
63
|
+
}));
|
|
64
|
+
return builder;
|
|
65
|
+
};
|
|
66
|
+
exports.default = (0, architect_1.createBuilder)(commandBuilder);
|
|
67
|
+
async function setup(options, context) {
|
|
68
|
+
let browserOptions;
|
|
69
|
+
let browserTarget;
|
|
70
|
+
if (options.browserTarget) {
|
|
71
|
+
browserTarget = (0, architect_1.targetFromTargetString)(options.browserTarget);
|
|
72
|
+
browserOptions = await context.validateOptions(await context.getTargetOptions(browserTarget), await context.getBuilderNameForTarget(browserTarget));
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
75
|
+
tsConfig: options.tsConfig ??
|
|
76
|
+
(0, find_up_1.sync)('tsconfig.json', { cwd: options.configDir }) ??
|
|
77
|
+
browserOptions.tsConfig,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function runInstance(options) {
|
|
81
|
+
return new rxjs_1.Observable((observer) => {
|
|
82
|
+
// This Observable intentionally never complete, leaving the process running ;)
|
|
83
|
+
(0, core_server_1.withTelemetry)('dev', {
|
|
84
|
+
cliOptions: options,
|
|
85
|
+
presetOptions: { ...options, corePresets: [], overridePresets: [] },
|
|
86
|
+
printError: error_handler_1.printErrorDetails,
|
|
87
|
+
}, () => (0, core_server_1.buildDevStandalone)(options))
|
|
88
|
+
.then(({ port }) => observer.next(port))
|
|
89
|
+
.catch((error) => {
|
|
90
|
+
observer.error((0, error_handler_1.errorSummary)(error));
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* @jest-environment node
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const architect_1 = require("@angular-devkit/architect");
|
|
30
|
+
const testing_1 = require("@angular-devkit/architect/testing");
|
|
31
|
+
const core_1 = require("@angular-devkit/core");
|
|
32
|
+
const path = __importStar(require("path"));
|
|
33
|
+
const buildDevStandaloneMock = jest.fn();
|
|
34
|
+
const buildStaticStandaloneMock = jest.fn();
|
|
35
|
+
const buildMock = {
|
|
36
|
+
buildDevStandalone: buildDevStandaloneMock,
|
|
37
|
+
buildStaticStandalone: buildStaticStandaloneMock,
|
|
38
|
+
withTelemetry: (_, __, fn) => fn(),
|
|
39
|
+
};
|
|
40
|
+
jest.doMock('@storybook/core-server', () => buildMock);
|
|
41
|
+
jest.doMock('find-up', () => ({ sync: () => './storybook/tsconfig.ts' }));
|
|
42
|
+
const mockRunScript = jest.fn();
|
|
43
|
+
jest.mock('@storybook/cli', () => ({
|
|
44
|
+
getEnvConfig: (options) => options,
|
|
45
|
+
versions: {
|
|
46
|
+
storybook: 'x.x.x',
|
|
47
|
+
},
|
|
48
|
+
JsPackageManagerFactory: {
|
|
49
|
+
getPackageManager: () => ({
|
|
50
|
+
runPackageCommand: mockRunScript,
|
|
51
|
+
}),
|
|
52
|
+
},
|
|
53
|
+
}));
|
|
54
|
+
// Randomly fails on CI. TODO: investigate why
|
|
55
|
+
// eslint-disable-next-line jest/no-disabled-tests
|
|
56
|
+
describe.skip('Start Storybook Builder', () => {
|
|
57
|
+
let architect;
|
|
58
|
+
let architectHost;
|
|
59
|
+
beforeEach(async () => {
|
|
60
|
+
const registry = new core_1.schema.CoreSchemaRegistry();
|
|
61
|
+
registry.addPostTransform(core_1.schema.transforms.addUndefinedDefaults);
|
|
62
|
+
architectHost = new testing_1.TestingArchitectHost();
|
|
63
|
+
architect = new architect_1.Architect(architectHost, registry);
|
|
64
|
+
architectHost.addBuilder('@angular-devkit/build-angular:browser', (0, architect_1.createBuilder)(() => {
|
|
65
|
+
return { success: true };
|
|
66
|
+
}));
|
|
67
|
+
architectHost.addTarget({ project: 'angular-cli', target: 'build-2' }, '@angular-devkit/build-angular:browser', {
|
|
68
|
+
outputPath: 'dist/angular-cli',
|
|
69
|
+
index: 'src/index.html',
|
|
70
|
+
main: 'src/main.ts',
|
|
71
|
+
polyfills: 'src/polyfills.ts',
|
|
72
|
+
tsConfig: 'src/tsconfig.app.json',
|
|
73
|
+
assets: ['src/favicon.ico', 'src/assets'],
|
|
74
|
+
styles: ['src/styles.css'],
|
|
75
|
+
scripts: [],
|
|
76
|
+
});
|
|
77
|
+
// This will either take a Node package name, or a path to the directory
|
|
78
|
+
// for the package.json file.
|
|
79
|
+
await architectHost.addBuilderFromPackage(path.join(__dirname, '../../..'));
|
|
80
|
+
});
|
|
81
|
+
beforeEach(() => {
|
|
82
|
+
buildDevStandaloneMock.mockImplementation((_options) => Promise.resolve(_options));
|
|
83
|
+
});
|
|
84
|
+
afterEach(() => {
|
|
85
|
+
jest.clearAllMocks();
|
|
86
|
+
});
|
|
87
|
+
it('should start storybook with angularBrowserTarget', async () => {
|
|
88
|
+
const run = await architect.scheduleBuilder('@storybook/angular:start-storybook', {
|
|
89
|
+
browserTarget: 'angular-cli:build-2',
|
|
90
|
+
port: 4400,
|
|
91
|
+
compodoc: false,
|
|
92
|
+
});
|
|
93
|
+
const output = await run.result;
|
|
94
|
+
await run.stop();
|
|
95
|
+
expect(output.success).toBeTruthy();
|
|
96
|
+
expect(mockRunScript).not.toHaveBeenCalledWith();
|
|
97
|
+
expect(buildDevStandaloneMock).toHaveBeenCalledWith(expect.objectContaining({
|
|
98
|
+
angularBrowserTarget: 'angular-cli:build-2',
|
|
99
|
+
angularBuilderContext: expect.any(Object),
|
|
100
|
+
ci: false,
|
|
101
|
+
configDir: '.storybook',
|
|
102
|
+
disableTelemetry: undefined,
|
|
103
|
+
host: 'localhost',
|
|
104
|
+
https: false,
|
|
105
|
+
packageJson: expect.any(Object),
|
|
106
|
+
port: 4400,
|
|
107
|
+
quiet: false,
|
|
108
|
+
smokeTest: false,
|
|
109
|
+
sslCa: undefined,
|
|
110
|
+
sslCert: undefined,
|
|
111
|
+
sslKey: undefined,
|
|
112
|
+
tsConfig: './storybook/tsconfig.ts',
|
|
113
|
+
}));
|
|
114
|
+
});
|
|
115
|
+
it('should start storybook with tsConfig', async () => {
|
|
116
|
+
const run = await architect.scheduleBuilder('@storybook/angular:start-storybook', {
|
|
117
|
+
tsConfig: 'path/to/tsConfig.json',
|
|
118
|
+
port: 4400,
|
|
119
|
+
compodoc: false,
|
|
120
|
+
});
|
|
121
|
+
const output = await run.result;
|
|
122
|
+
await run.stop();
|
|
123
|
+
expect(output.success).toBeTruthy();
|
|
124
|
+
expect(mockRunScript).not.toHaveBeenCalledWith();
|
|
125
|
+
expect(buildDevStandaloneMock).toHaveBeenCalledWith(expect.objectContaining({
|
|
126
|
+
angularBrowserTarget: null,
|
|
127
|
+
angularBuilderContext: expect.any(Object),
|
|
128
|
+
ci: false,
|
|
129
|
+
configDir: '.storybook',
|
|
130
|
+
disableTelemetry: undefined,
|
|
131
|
+
host: 'localhost',
|
|
132
|
+
https: false,
|
|
133
|
+
packageJson: expect.any(Object),
|
|
134
|
+
port: 4400,
|
|
135
|
+
quiet: false,
|
|
136
|
+
smokeTest: false,
|
|
137
|
+
sslCa: undefined,
|
|
138
|
+
sslCert: undefined,
|
|
139
|
+
sslKey: undefined,
|
|
140
|
+
tsConfig: 'path/to/tsConfig.json',
|
|
141
|
+
}));
|
|
142
|
+
});
|
|
143
|
+
it('should throw error', async () => {
|
|
144
|
+
buildDevStandaloneMock.mockRejectedValue(true);
|
|
145
|
+
const run = await architect.scheduleBuilder('@storybook/angular:start-storybook', {
|
|
146
|
+
browserTarget: 'angular-cli:build-2',
|
|
147
|
+
port: 4400,
|
|
148
|
+
compodoc: false,
|
|
149
|
+
});
|
|
150
|
+
try {
|
|
151
|
+
await run.result;
|
|
152
|
+
expect(false).toEqual('Throw expected');
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
// eslint-disable-next-line jest/no-try-expect, jest/no-conditional-expect
|
|
156
|
+
expect(error).toEqual('Broken build, fix the error above.\nYou may need to refresh the browser.');
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
it('should run compodoc', async () => {
|
|
160
|
+
const run = await architect.scheduleBuilder('@storybook/angular:start-storybook', {
|
|
161
|
+
browserTarget: 'angular-cli:build-2',
|
|
162
|
+
});
|
|
163
|
+
const output = await run.result;
|
|
164
|
+
await run.stop();
|
|
165
|
+
expect(output.success).toBeTruthy();
|
|
166
|
+
expect(mockRunScript).toHaveBeenCalledWith('compodoc', ['-p', './storybook/tsconfig.ts', '-d', '.', '-e', 'json'], '');
|
|
167
|
+
expect(buildDevStandaloneMock).toHaveBeenCalledWith(expect.objectContaining({
|
|
168
|
+
angularBrowserTarget: 'angular-cli:build-2',
|
|
169
|
+
angularBuilderContext: expect.any(Object),
|
|
170
|
+
ci: false,
|
|
171
|
+
disableTelemetry: undefined,
|
|
172
|
+
configDir: '.storybook',
|
|
173
|
+
host: 'localhost',
|
|
174
|
+
https: false,
|
|
175
|
+
packageJson: expect.any(Object),
|
|
176
|
+
port: 9009,
|
|
177
|
+
quiet: false,
|
|
178
|
+
smokeTest: false,
|
|
179
|
+
sslCa: undefined,
|
|
180
|
+
sslCert: undefined,
|
|
181
|
+
sslKey: undefined,
|
|
182
|
+
tsConfig: './storybook/tsconfig.ts',
|
|
183
|
+
}));
|
|
184
|
+
});
|
|
185
|
+
it('should start storybook with styles options', async () => {
|
|
186
|
+
const run = await architect.scheduleBuilder('@storybook/angular:start-storybook', {
|
|
187
|
+
tsConfig: 'path/to/tsConfig.json',
|
|
188
|
+
port: 4400,
|
|
189
|
+
compodoc: false,
|
|
190
|
+
styles: ['src/styles.css'],
|
|
191
|
+
});
|
|
192
|
+
const output = await run.result;
|
|
193
|
+
await run.stop();
|
|
194
|
+
expect(output.success).toBeTruthy();
|
|
195
|
+
expect(mockRunScript).not.toHaveBeenCalledWith();
|
|
196
|
+
expect(buildDevStandaloneMock).toHaveBeenCalledWith({
|
|
197
|
+
angularBrowserTarget: null,
|
|
198
|
+
angularBuilderContext: expect.any(Object),
|
|
199
|
+
angularBuilderOptions: { assets: [], styles: ['src/styles.css'] },
|
|
200
|
+
disableTelemetry: undefined,
|
|
201
|
+
ci: false,
|
|
202
|
+
configDir: '.storybook',
|
|
203
|
+
host: 'localhost',
|
|
204
|
+
https: false,
|
|
205
|
+
port: 4400,
|
|
206
|
+
packageJson: expect.any(Object),
|
|
207
|
+
quiet: false,
|
|
208
|
+
smokeTest: false,
|
|
209
|
+
sslCa: undefined,
|
|
210
|
+
sslCert: undefined,
|
|
211
|
+
sslKey: undefined,
|
|
212
|
+
tsConfig: 'path/to/tsConfig.json',
|
|
213
|
+
});
|
|
214
|
+
});
|
|
215
|
+
});
|