@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.
Files changed (280) hide show
  1. package/.eslintrc.js +8 -0
  2. package/README.md +322 -0
  3. package/dist/builders/build-storybook/index.js +72 -0
  4. package/dist/builders/build-storybook/index.spec.d.ts +1 -0
  5. package/dist/builders/build-storybook/index.spec.js +216 -0
  6. package/dist/builders/build-storybook/schema.json +167 -0
  7. package/dist/builders/builders.json +14 -0
  8. package/dist/builders/start-storybook/index.js +93 -0
  9. package/dist/builders/start-storybook/index.spec.d.ts +1 -0
  10. package/dist/builders/start-storybook/index.spec.js +215 -0
  11. package/dist/builders/start-storybook/schema.json +198 -0
  12. package/dist/builders/utils/error-handler.d.ts +2 -0
  13. package/dist/builders/utils/error-handler.js +38 -0
  14. package/dist/builders/utils/run-compodoc.d.ts +6 -0
  15. package/dist/builders/utils/run-compodoc.js +58 -0
  16. package/dist/builders/utils/run-compodoc.spec.d.ts +1 -0
  17. package/dist/builders/utils/run-compodoc.spec.js +86 -0
  18. package/dist/builders/utils/standalone-options.d.ts +15 -0
  19. package/dist/builders/utils/standalone-options.js +2 -0
  20. package/dist/client/angular-beta/AbstractRenderer.d.ts +53 -0
  21. package/dist/client/angular-beta/AbstractRenderer.js +180 -0
  22. package/dist/client/angular-beta/CanvasRenderer.d.ts +13 -0
  23. package/dist/client/angular-beta/CanvasRenderer.js +16 -0
  24. package/dist/client/angular-beta/ComputesTemplateFromComponent.d.ts +17 -0
  25. package/dist/client/angular-beta/ComputesTemplateFromComponent.js +132 -0
  26. package/dist/client/angular-beta/ComputesTemplateFromComponent.test.d.ts +1 -0
  27. package/dist/client/angular-beta/ComputesTemplateFromComponent.test.js +403 -0
  28. package/dist/client/angular-beta/DocsRenderer.d.ts +13 -0
  29. package/dist/client/angular-beta/DocsRenderer.js +40 -0
  30. package/dist/client/angular-beta/RendererFactory.d.ts +11 -0
  31. package/dist/client/angular-beta/RendererFactory.js +56 -0
  32. package/dist/client/angular-beta/RendererFactory.test.d.ts +1 -0
  33. package/dist/client/angular-beta/RendererFactory.test.js +164 -0
  34. package/dist/client/angular-beta/StorybookModule.d.ts +8 -0
  35. package/dist/client/angular-beta/StorybookModule.js +29 -0
  36. package/dist/client/angular-beta/StorybookModule.test.d.ts +1 -0
  37. package/dist/client/angular-beta/StorybookModule.test.js +311 -0
  38. package/dist/client/angular-beta/StorybookProvider.d.ts +5 -0
  39. package/dist/client/angular-beta/StorybookProvider.js +26 -0
  40. package/dist/client/angular-beta/StorybookWrapperComponent.d.ts +16 -0
  41. package/dist/client/angular-beta/StorybookWrapperComponent.js +140 -0
  42. package/dist/client/angular-beta/__testfixtures__/input.component.d.ts +26 -0
  43. package/dist/client/angular-beta/__testfixtures__/input.component.js +67 -0
  44. package/dist/client/angular-beta/__testfixtures__/test.module.d.ts +2 -0
  45. package/dist/client/angular-beta/__testfixtures__/test.module.js +20 -0
  46. package/dist/client/angular-beta/utils/NgComponentAnalyzer.d.ts +29 -0
  47. package/dist/client/angular-beta/utils/NgComponentAnalyzer.js +100 -0
  48. package/dist/client/angular-beta/utils/NgComponentAnalyzer.test.d.ts +1 -0
  49. package/dist/client/angular-beta/utils/NgComponentAnalyzer.test.js +374 -0
  50. package/dist/client/angular-beta/utils/NgModulesAnalyzer.d.ts +6 -0
  51. package/dist/client/angular-beta/utils/NgModulesAnalyzer.js +41 -0
  52. package/dist/client/angular-beta/utils/NgModulesAnalyzer.test.d.ts +1 -0
  53. package/dist/client/angular-beta/utils/NgModulesAnalyzer.test.js +23 -0
  54. package/dist/client/angular-beta/utils/PropertyExtractor.d.ts +32 -0
  55. package/dist/client/angular-beta/utils/PropertyExtractor.js +162 -0
  56. package/dist/client/angular-beta/utils/PropertyExtractor.test.d.ts +1 -0
  57. package/dist/client/angular-beta/utils/PropertyExtractor.test.js +142 -0
  58. package/dist/client/config.d.ts +6 -0
  59. package/dist/client/config.js +10 -0
  60. package/dist/client/decorateStory.d.ts +4 -0
  61. package/dist/client/decorateStory.js +49 -0
  62. package/dist/client/decorateStory.test.d.ts +1 -0
  63. package/dist/client/decorateStory.test.js +304 -0
  64. package/dist/client/decorators.d.ts +14 -0
  65. package/dist/client/decorators.js +70 -0
  66. package/dist/client/decorators.test.d.ts +1 -0
  67. package/dist/client/decorators.test.js +146 -0
  68. package/dist/client/docs/__testfixtures__/doc-button/input.d.ts +111 -0
  69. package/dist/client/docs/__testfixtures__/doc-button/input.js +207 -0
  70. package/dist/client/docs/__testfixtures__/doc-button/tsconfig.json +7 -0
  71. package/dist/client/docs/angular-properties.test.d.ts +1 -0
  72. package/dist/client/docs/angular-properties.test.js +62 -0
  73. package/dist/client/docs/compodoc.d.ts +12 -0
  74. package/dist/client/docs/compodoc.js +258 -0
  75. package/dist/client/docs/compodoc.test.d.ts +1 -0
  76. package/dist/client/docs/compodoc.test.js +131 -0
  77. package/dist/client/docs/config.d.ts +4 -0
  78. package/dist/client/docs/config.js +19 -0
  79. package/dist/client/docs/index.d.ts +1 -0
  80. package/dist/client/docs/index.js +17 -0
  81. package/dist/client/docs/sourceDecorator.d.ts +9 -0
  82. package/dist/client/docs/sourceDecorator.js +51 -0
  83. package/dist/client/docs/types.d.ts +102 -0
  84. package/dist/client/docs/types.js +2 -0
  85. package/dist/client/globals.d.ts +23 -0
  86. package/dist/client/globals.js +40 -0
  87. package/dist/client/index.d.ts +5 -0
  88. package/dist/client/index.js +30 -0
  89. package/dist/client/preview-prod.d.ts +1 -0
  90. package/dist/client/preview-prod.js +4 -0
  91. package/dist/client/public-api.d.ts +15 -0
  92. package/dist/client/public-api.js +36 -0
  93. package/dist/client/public-types.d.ts +37 -0
  94. package/dist/client/public-types.js +2 -0
  95. package/dist/client/render.d.ts +7 -0
  96. package/dist/client/render.js +19 -0
  97. package/dist/client/types.d.ts +46 -0
  98. package/dist/client/types.js +2 -0
  99. package/dist/index.d.ts +2 -0
  100. package/dist/index.js +29 -0
  101. package/dist/index.mjs +13 -0
  102. package/dist/preset.d.ts +6 -0
  103. package/dist/preset.js +36 -0
  104. package/dist/preset.mjs +30 -0
  105. package/dist/renderer.d.ts +6 -0
  106. package/dist/renderer.js +15 -0
  107. package/dist/renderer.mjs +6 -0
  108. package/dist/server/__mocks-ng-workspace__/empty-projects-entry/angular.json +4 -0
  109. package/dist/server/__mocks-ng-workspace__/minimal-config/angular.json +18 -0
  110. package/dist/server/__mocks-ng-workspace__/minimal-config/src/main.d.ts +1 -0
  111. package/dist/server/__mocks-ng-workspace__/minimal-config/src/main.js +5 -0
  112. package/dist/server/__mocks-ng-workspace__/minimal-config/src/tsconfig.app.json +9 -0
  113. package/dist/server/__mocks-ng-workspace__/minimal-config/tsconfig.json +13 -0
  114. package/dist/server/__mocks-ng-workspace__/some-config/angular.json +19 -0
  115. package/dist/server/__mocks-ng-workspace__/some-config/src/main.d.ts +1 -0
  116. package/dist/server/__mocks-ng-workspace__/some-config/src/main.js +5 -0
  117. package/dist/server/__mocks-ng-workspace__/some-config/src/tsconfig.app.json +9 -0
  118. package/dist/server/__mocks-ng-workspace__/some-config/tsconfig.json +13 -0
  119. package/dist/server/__mocks-ng-workspace__/with-angularBrowserTarget/angular.json +64 -0
  120. package/dist/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/main.d.ts +1 -0
  121. package/dist/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/main.js +5 -0
  122. package/dist/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/tsconfig.app.json +9 -0
  123. package/dist/server/__mocks-ng-workspace__/with-angularBrowserTarget/tsconfig.json +13 -0
  124. package/dist/server/__mocks-ng-workspace__/with-lib/angular.json +28 -0
  125. package/dist/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/src/main.d.ts +1 -0
  126. package/dist/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/src/main.js +5 -0
  127. package/dist/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/tsconfig.lib.json +20 -0
  128. package/dist/server/__mocks-ng-workspace__/with-lib/tsconfig.json +13 -0
  129. package/dist/server/__mocks-ng-workspace__/with-nx/angular.json +18 -0
  130. package/dist/server/__mocks-ng-workspace__/with-nx/nx.json +3 -0
  131. package/dist/server/__mocks-ng-workspace__/with-nx/src/main.d.ts +1 -0
  132. package/dist/server/__mocks-ng-workspace__/with-nx/src/main.js +5 -0
  133. package/dist/server/__mocks-ng-workspace__/with-nx/src/tsconfig.app.json +8 -0
  134. package/dist/server/__mocks-ng-workspace__/with-nx/tsconfig.json +14 -0
  135. package/dist/server/__mocks-ng-workspace__/with-nx-workspace/nx.json +3 -0
  136. package/dist/server/__mocks-ng-workspace__/with-nx-workspace/src/main.d.ts +1 -0
  137. package/dist/server/__mocks-ng-workspace__/with-nx-workspace/src/main.js +5 -0
  138. package/dist/server/__mocks-ng-workspace__/with-nx-workspace/src/tsconfig.app.json +8 -0
  139. package/dist/server/__mocks-ng-workspace__/with-nx-workspace/tsconfig.json +14 -0
  140. package/dist/server/__mocks-ng-workspace__/with-nx-workspace/workspace.json +18 -0
  141. package/dist/server/__mocks-ng-workspace__/with-options-styles/angular.json +18 -0
  142. package/dist/server/__mocks-ng-workspace__/with-options-styles/src/main.d.ts +1 -0
  143. package/dist/server/__mocks-ng-workspace__/with-options-styles/src/main.js +5 -0
  144. package/dist/server/__mocks-ng-workspace__/with-options-styles/src/tsconfig.app.json +9 -0
  145. package/dist/server/__mocks-ng-workspace__/with-options-styles/tsconfig.json +13 -0
  146. package/dist/server/__mocks-ng-workspace__/without-architect-build/angular.json +5 -0
  147. package/dist/server/__mocks-ng-workspace__/without-architect-build-options/angular.json +11 -0
  148. package/dist/server/__mocks-ng-workspace__/without-compatible-projects/angular.json +7 -0
  149. package/dist/server/__mocks-ng-workspace__/without-projects-entry/angular.json +3 -0
  150. package/dist/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/src/main.d.ts +1 -0
  151. package/dist/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/src/main.js +5 -0
  152. package/dist/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/tsconfig.lib.json +20 -0
  153. package/dist/server/__mocks-ng-workspace__/without-projects-entry/tsconfig.json +13 -0
  154. package/dist/server/__mocks-ng-workspace__/without-tsConfig/angular.json +16 -0
  155. package/dist/server/__mocks-ng-workspace__/without-tsConfig/src/main.d.ts +1 -0
  156. package/dist/server/__mocks-ng-workspace__/without-tsConfig/src/main.js +5 -0
  157. package/dist/server/__mocks-ng-workspace__/without-tsConfig/src/tsconfig.app.json +9 -0
  158. package/dist/server/__mocks-ng-workspace__/without-tsConfig/tsconfig.json +13 -0
  159. package/dist/server/__tests__/angular.json +96 -0
  160. package/dist/server/angular-cli-webpack.d.ts +1 -0
  161. package/dist/server/angular-cli-webpack.js +99 -0
  162. package/dist/server/framework-preset-angular-cli.d.ts +4 -0
  163. package/dist/server/framework-preset-angular-cli.js +85 -0
  164. package/dist/server/framework-preset-angular-docs.d.ts +2 -0
  165. package/dist/server/framework-preset-angular-docs.js +10 -0
  166. package/dist/server/framework-preset-angular-ivy.d.ts +10 -0
  167. package/dist/server/framework-preset-angular-ivy.js +103 -0
  168. package/dist/server/plugins/storybook-normalize-angular-entry-plugin.d.ts +25 -0
  169. package/dist/server/plugins/storybook-normalize-angular-entry-plugin.js +48 -0
  170. package/dist/server/preset-options.d.ts +13 -0
  171. package/dist/server/preset-options.js +2 -0
  172. package/dist/server/utils/filter-out-styling-rules.d.ts +2 -0
  173. package/dist/server/utils/filter-out-styling-rules.js +17 -0
  174. package/dist/server/utils/module-is-available.d.ts +1 -0
  175. package/dist/server/utils/module-is-available.js +13 -0
  176. package/dist/types.d.ts +29 -0
  177. package/dist/types.js +2 -0
  178. package/dist/types.mjs +1 -0
  179. package/jest.config.js +31 -0
  180. package/package.json +126 -0
  181. package/preset.js +1 -0
  182. package/renderer.d.ts +1 -0
  183. package/renderer.js +1 -0
  184. package/src/server/angular-cli-webpack.d.ts +7 -0
  185. package/src/server/angular-cli-webpack.js +127 -0
  186. package/src/server/plugins/storybook-normalize-angular-entry-plugin.js +54 -0
  187. package/src/typings.d.ts +21 -0
  188. package/template/cli/.eslintrc.json +5 -0
  189. package/template/cli/Button.stories.ts +51 -0
  190. package/template/cli/Header.stories.ts +37 -0
  191. package/template/cli/Page.stories.ts +46 -0
  192. package/template/cli/User.ts +2 -0
  193. package/template/cli/button.component.ts +55 -0
  194. package/template/cli/header.component.ts +75 -0
  195. package/template/cli/page.component.ts +77 -0
  196. package/template/components/button.component.ts +54 -0
  197. package/template/components/button.css +30 -0
  198. package/template/components/form.component.ts +37 -0
  199. package/template/components/html.component.ts +22 -0
  200. package/template/components/index.js +8 -0
  201. package/template/components/pre.component.ts +29 -0
  202. package/template/stories/angular-mdx.stories.mdx +25 -0
  203. package/template/stories/argTypes/doc-button/doc-button.component.html +7 -0
  204. package/template/stories/argTypes/doc-button/doc-button.component.scss +3 -0
  205. package/template/stories/argTypes/doc-button/doc-button.component.ts +232 -0
  206. package/template/stories/argTypes/doc-button/doc-button.stories.ts +24 -0
  207. package/template/stories/argTypes/doc-directive/doc-directive.directive.ts +24 -0
  208. package/template/stories/argTypes/doc-directive/doc-directive.stories.ts +14 -0
  209. package/template/stories/argTypes/doc-injectable/doc-injectable.service.ts +27 -0
  210. package/template/stories/argTypes/doc-injectable/doc-injectable.stories.ts +17 -0
  211. package/template/stories/argTypes/doc-pipe/doc-pipe.pipe.ts +18 -0
  212. package/template/stories/argTypes/doc-pipe/doc-pipe.stories.ts +17 -0
  213. package/template/stories/basics/README.stories.mdx +7 -0
  214. package/template/stories/basics/angular-forms/customControlValueAccessor/custom-cva-component.stories.ts +27 -0
  215. package/template/stories/basics/angular-forms/customControlValueAccessor/custom-cva.component.ts +57 -0
  216. package/template/stories/basics/component-with-complex-selectors/attribute-selector.component.ts +19 -0
  217. package/template/stories/basics/component-with-complex-selectors/attribute-selectors.component.stories.ts +8 -0
  218. package/template/stories/basics/component-with-complex-selectors/class-selector.component.stories.ts +8 -0
  219. package/template/stories/basics/component-with-complex-selectors/class-selector.component.ts +19 -0
  220. package/template/stories/basics/component-with-complex-selectors/multiple-class-selector.component.stories.ts +8 -0
  221. package/template/stories/basics/component-with-complex-selectors/multiple-selector.component.stories.ts +8 -0
  222. package/template/stories/basics/component-with-complex-selectors/multiple-selector.component.ts +37 -0
  223. package/template/stories/basics/component-with-enums/enums.component.html +8 -0
  224. package/template/stories/basics/component-with-enums/enums.component.stories.ts +24 -0
  225. package/template/stories/basics/component-with-enums/enums.component.ts +53 -0
  226. package/template/stories/basics/component-with-inheritance/base-button.component.ts +10 -0
  227. package/template/stories/basics/component-with-inheritance/base-button.stories.ts +12 -0
  228. package/template/stories/basics/component-with-inheritance/icon-button.component.ts +11 -0
  229. package/template/stories/basics/component-with-inheritance/icon-button.stories.ts +13 -0
  230. package/template/stories/basics/component-with-ng-content/ng-content-about-parent.stories.ts +58 -0
  231. package/template/stories/basics/component-with-ng-content/ng-content-simple.stories.ts +29 -0
  232. package/template/stories/basics/component-with-ng-on-destroy/component-with-on-destroy.stories.ts +40 -0
  233. package/template/stories/basics/component-with-on-push/on-push-box.component.ts +21 -0
  234. package/template/stories/basics/component-with-on-push/on-push.stories.ts +21 -0
  235. package/template/stories/basics/component-with-pipe/custom-pipes.stories.ts +31 -0
  236. package/template/stories/basics/component-with-pipe/custom.pipe.ts +10 -0
  237. package/template/stories/basics/component-with-pipe/with-pipe.component.ts +10 -0
  238. package/template/stories/basics/component-with-provider/di.component.html +7 -0
  239. package/template/stories/basics/component-with-provider/di.component.stories.ts +26 -0
  240. package/template/stories/basics/component-with-provider/di.component.ts +28 -0
  241. package/template/stories/basics/component-with-style/styled.component.css +3 -0
  242. package/template/stories/basics/component-with-style/styled.component.html +5 -0
  243. package/template/stories/basics/component-with-style/styled.component.scss +5 -0
  244. package/template/stories/basics/component-with-style/styled.component.stories.ts +10 -0
  245. package/template/stories/basics/component-with-style/styled.component.ts +8 -0
  246. package/template/stories/basics/component-without-selector/without-selector-ng-component-outlet.stories.ts +73 -0
  247. package/template/stories/basics/component-without-selector/without-selector-ng-factory-resolver.stories.ts +71 -0
  248. package/template/stories/basics/component-without-selector/without-selector.component.ts +30 -0
  249. package/template/stories/basics/component-without-selector/without-selector.stories.ts +30 -0
  250. package/template/stories/basics/ng-module/angular-src/chip-color.token.ts +3 -0
  251. package/template/stories/basics/ng-module/angular-src/chip-text.pipe.ts +29 -0
  252. package/template/stories/basics/ng-module/angular-src/chip.component.ts +60 -0
  253. package/template/stories/basics/ng-module/angular-src/chips-group.component.ts +49 -0
  254. package/template/stories/basics/ng-module/angular-src/chips.module.ts +31 -0
  255. package/template/stories/basics/ng-module/import-module-chip.stories.ts +23 -0
  256. package/template/stories/basics/ng-module/import-module-for-root.stories.ts +50 -0
  257. package/template/stories/basics/ng-module/import-module.stories.ts +35 -0
  258. package/template/stories/button.component.ts +26 -0
  259. package/template/stories/core/README.stories.mdx +7 -0
  260. package/template/stories/core/applicationConfig/with-browser-animations.stories.ts +40 -0
  261. package/template/stories/core/applicationConfig/with-noop-browser-animations.stories.ts +35 -0
  262. package/template/stories/core/decorators/componentWrapperDecorator/child.component.ts +20 -0
  263. package/template/stories/core/decorators/componentWrapperDecorator/decorators.stories.ts +99 -0
  264. package/template/stories/core/decorators/componentWrapperDecorator/parent.component.ts +18 -0
  265. package/template/stories/core/decorators/theme-decorator/decorators.stories.ts +20 -0
  266. package/template/stories/core/moduleMetadata/angular-src/custom.pipe.ts +10 -0
  267. package/template/stories/core/moduleMetadata/angular-src/dummy.service.ts +14 -0
  268. package/template/stories/core/moduleMetadata/angular-src/open-close-component/open-close.component.css +13 -0
  269. package/template/stories/core/moduleMetadata/angular-src/open-close-component/open-close.component.html +7 -0
  270. package/template/stories/core/moduleMetadata/angular-src/open-close-component/open-close.component.ts +39 -0
  271. package/template/stories/core/moduleMetadata/angular-src/service.component.ts +24 -0
  272. package/template/stories/core/moduleMetadata/angular-src/token.component.ts +31 -0
  273. package/template/stories/core/moduleMetadata/in-export-default.stories.ts +38 -0
  274. package/template/stories/core/moduleMetadata/in-stories.stories.ts +46 -0
  275. package/template/stories/core/moduleMetadata/merge-default-and-story.stories.ts +35 -0
  276. package/template/stories/core/parameters/bootstrap-options.stories.ts +18 -0
  277. package/template/stories/core/styles/story-styles.stories.ts +50 -0
  278. package/template/stories/others/app-initializer-use-factory/app-initializer-use-factory.stories.ts +34 -0
  279. package/template/stories/others/issues/12009-unknown-component.stories.ts +14 -0
  280. 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
+ });