@storybook/angular 7.0.0-alpha.8 → 7.0.0-beta.1
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 +1 -1
- package/dist/{types/builders → builders}/build-storybook/index.d.ts +3 -3
- package/dist/{types/builders → builders}/build-storybook/index.js +0 -0
- package/dist/builders/build-storybook/index.spec.d.ts +1 -0
- package/dist/builders/build-storybook/index.spec.js +218 -0
- package/dist/{types/builders → builders}/build-storybook/schema.json +0 -0
- package/dist/{types/builders → builders}/builders.json +0 -0
- package/dist/{types/builders → builders}/start-storybook/index.d.ts +3 -3
- package/dist/{types/builders → builders}/start-storybook/index.js +0 -0
- package/dist/builders/start-storybook/index.spec.d.ts +1 -0
- package/dist/builders/start-storybook/index.spec.js +214 -0
- package/dist/{types/builders → builders}/start-storybook/schema.json +0 -0
- package/dist/{types/builders → builders}/utils/build-standalone-errors-handler.d.ts +0 -0
- package/dist/{types/builders → builders}/utils/build-standalone-errors-handler.js +3 -6
- package/dist/{types/builders → builders}/utils/run-compodoc.d.ts +0 -0
- package/dist/{types/builders → builders}/utils/run-compodoc.js +0 -1
- package/dist/builders/utils/run-compodoc.spec.d.ts +1 -0
- package/dist/builders/utils/run-compodoc.spec.js +59 -0
- package/dist/{types/builders → builders}/utils/standalone-options.d.ts +3 -3
- package/dist/{types/builders → builders}/utils/standalone-options.js +0 -0
- package/dist/{types/client → client}/angular/app.component.d.ts +1 -1
- package/dist/{types/client → client}/angular/app.component.js +0 -1
- package/dist/{types/client → client}/angular/app.token.d.ts +0 -0
- package/dist/{types/client → client}/angular/app.token.js +0 -0
- package/dist/{types/client → client}/angular/helpers.d.ts +3 -3
- package/dist/{types/client → client}/angular/helpers.js +1 -2
- package/dist/{types/client → client}/angular-beta/AbstractRenderer.d.ts +1 -1
- package/dist/{types/client → client}/angular-beta/AbstractRenderer.js +13 -13
- package/dist/{types/client → client}/angular-beta/CanvasRenderer.d.ts +0 -0
- package/dist/{types/client → client}/angular-beta/CanvasRenderer.js +0 -0
- package/dist/{types/client → client}/angular-beta/ComputesTemplateFromComponent.d.ts +3 -3
- package/dist/{types/client → client}/angular-beta/ComputesTemplateFromComponent.js +3 -3
- package/dist/client/angular-beta/ComputesTemplateFromComponent.test.d.ts +1 -0
- package/dist/client/angular-beta/ComputesTemplateFromComponent.test.js +390 -0
- package/dist/{types/client → client}/angular-beta/DocsRenderer.d.ts +0 -0
- package/dist/{types/client → client}/angular-beta/DocsRenderer.js +5 -8
- package/dist/{types/client → client}/angular-beta/RendererFactory.d.ts +1 -1
- package/dist/{types/client → client}/angular-beta/RendererFactory.js +3 -3
- package/dist/client/angular-beta/RendererFactory.test.d.ts +1 -0
- package/dist/client/angular-beta/RendererFactory.test.js +297 -0
- package/dist/{types/client → client}/angular-beta/StorybookModule.d.ts +2 -2
- package/dist/{types/client → client}/angular-beta/StorybookModule.js +4 -23
- package/dist/client/angular-beta/StorybookModule.test.d.ts +1 -0
- package/dist/client/angular-beta/StorybookModule.test.js +279 -0
- package/dist/{types/client → client}/angular-beta/StorybookProvider.d.ts +1 -1
- package/dist/{types/client → client}/angular-beta/StorybookProvider.js +0 -0
- package/dist/{types/client → client}/angular-beta/StorybookWrapperComponent.d.ts +0 -0
- package/dist/{types/client → client}/angular-beta/StorybookWrapperComponent.js +0 -1
- 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/{types/client → client}/angular-beta/utils/NgComponentAnalyzer.d.ts +2 -2
- package/dist/{types/client → client}/angular-beta/utils/NgComponentAnalyzer.js +0 -0
- package/dist/client/angular-beta/utils/NgComponentAnalyzer.test.d.ts +1 -0
- package/dist/client/angular-beta/utils/NgComponentAnalyzer.test.js +340 -0
- package/dist/{types/client → client}/angular-beta/utils/NgModulesAnalyzer.d.ts +0 -0
- package/dist/{types/client → client}/angular-beta/utils/NgModulesAnalyzer.js +0 -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/config.d.ts +6 -0
- package/dist/client/config.js +10 -0
- package/dist/client/decorateStory.d.ts +4 -0
- package/dist/{types/client → client}/decorateStory.js +3 -3
- package/dist/client/decorateStory.test.d.ts +1 -0
- package/dist/client/decorateStory.test.js +335 -0
- package/dist/client/decorators.d.ts +5 -0
- package/dist/{types/client → client}/decorators.js +0 -0
- package/dist/client/decorators.test.d.ts +1 -0
- package/dist/client/decorators.test.js +106 -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 +56 -0
- package/dist/{types/client → client}/docs/compodoc.d.ts +5 -11
- package/dist/{types/client → client}/docs/compodoc.js +7 -7
- 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/{types/client → client}/docs/config.js +0 -0
- package/dist/{types/client → client}/docs/index.d.ts +0 -0
- package/dist/{types/client → client}/docs/index.js +0 -0
- package/dist/{types/client → client}/docs/sourceDecorator.d.ts +3 -3
- package/dist/{types/client → client}/docs/sourceDecorator.js +3 -3
- package/dist/{types/client → client}/docs/types.d.ts +1 -1
- package/dist/{types/client → client}/docs/types.js +0 -0
- package/dist/{types/client → client}/globals.d.ts +0 -0
- package/dist/{types/client → client}/globals.js +0 -0
- package/dist/{types/client → client}/index.d.ts +0 -0
- package/dist/{types/client → client}/index.js +3 -0
- package/dist/client/public-api.d.ts +15 -0
- package/dist/{types/client → client}/public-api.js +2 -9
- package/dist/client/public-types.d.ts +36 -0
- package/dist/{types/client → client}/public-types.js +0 -0
- package/dist/client/render.d.ts +6 -0
- package/dist/{types/client → client}/render.js +3 -3
- package/dist/{types/client → client}/types.d.ts +9 -13
- package/dist/{types/client → client}/types.js +0 -0
- package/dist/{types/index.d.ts → index.d.ts} +0 -0
- package/dist/{types/index.js → index.js} +0 -0
- package/dist/{types/preset.d.ts → preset.d.ts} +1 -1
- package/dist/{types/preset.js → preset.js} +0 -1
- package/dist/{types/renderer.d.ts → renderer.d.ts} +0 -0
- package/dist/{types/renderer.js → renderer.js} +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/empty-projects-entry/angular.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/minimal-config/angular.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/minimal-config/src/main.d.ts +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/minimal-config/src/main.js +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/minimal-config/src/tsconfig.app.json +0 -0
- package/dist/{types/server/__mocks-ng-workspace__/some-config → server/__mocks-ng-workspace__/minimal-config}/tsconfig.json +1 -4
- package/dist/{types/server → server}/__mocks-ng-workspace__/some-config/angular.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/some-config/src/main.d.ts +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/some-config/src/main.js +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/some-config/src/tsconfig.app.json +0 -0
- package/dist/{types/server/__mocks-ng-workspace__/with-angularBrowserTarget → server/__mocks-ng-workspace__/some-config}/tsconfig.json +1 -4
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-angularBrowserTarget/angular.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-angularBrowserTarget/src/main.d.ts +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-angularBrowserTarget/src/main.js +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-angularBrowserTarget/src/tsconfig.app.json +0 -0
- package/dist/{types/server/__mocks-ng-workspace__/minimal-config → server/__mocks-ng-workspace__/with-angularBrowserTarget}/tsconfig.json +1 -4
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-lib/angular.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-lib/projects/pattern-lib/src/main.d.ts +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-lib/projects/pattern-lib/src/main.js +0 -0
- package/dist/{types/server/__mocks-ng-workspace__/without-projects-entry → server/__mocks-ng-workspace__/with-lib}/projects/pattern-lib/tsconfig.lib.json +2 -8
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-lib/tsconfig.json +1 -4
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-nx/angular.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-nx/nx.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-nx/src/main.d.ts +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-nx/src/main.js +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-nx/src/tsconfig.app.json +0 -0
- package/dist/server/__mocks-ng-workspace__/with-nx/tsconfig.json +14 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-nx-workspace/nx.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-nx-workspace/src/main.d.ts +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-nx-workspace/src/main.js +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-nx-workspace/src/tsconfig.app.json +0 -0
- package/dist/server/__mocks-ng-workspace__/with-nx-workspace/tsconfig.json +14 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-nx-workspace/workspace.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-options-styles/angular.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-options-styles/src/main.d.ts +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-options-styles/src/main.js +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/with-options-styles/src/tsconfig.app.json +0 -0
- package/dist/server/__mocks-ng-workspace__/with-options-styles/tsconfig.json +13 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/without-architect-build/angular.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/without-architect-build-options/angular.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/without-compatible-projects/angular.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/without-projects-entry/angular.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/src/main.d.ts +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/src/main.js +0 -0
- package/dist/{types/server/__mocks-ng-workspace__/with-lib → server/__mocks-ng-workspace__/without-projects-entry}/projects/pattern-lib/tsconfig.lib.json +2 -8
- package/dist/server/__mocks-ng-workspace__/without-projects-entry/tsconfig.json +13 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/without-tsConfig/angular.json +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/without-tsConfig/src/main.d.ts +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/without-tsConfig/src/main.js +0 -0
- package/dist/{types/server → server}/__mocks-ng-workspace__/without-tsConfig/src/tsconfig.app.json +0 -0
- package/dist/server/__mocks-ng-workspace__/without-tsConfig/tsconfig.json +13 -0
- package/dist/server/__tests__/angular.json +96 -0
- package/dist/{types/server/angular-cli-webpack-12.2.x.d.ts → server/angular-cli-webpack.d.ts} +0 -0
- package/dist/{types/server/angular-cli-webpack-13.x.x.js → server/angular-cli-webpack.js} +6 -1
- package/dist/{types/server → server}/angular-read-workspace.d.ts +0 -0
- package/dist/{types/server → server}/angular-read-workspace.js +1 -1
- package/dist/{types/server → server}/framework-preset-angular-cli.d.ts +1 -1
- package/dist/{types/server → server}/framework-preset-angular-cli.js +5 -24
- package/dist/server/framework-preset-angular-cli.test.d.ts +1 -0
- package/dist/server/framework-preset-angular-cli.test.js +698 -0
- package/dist/{types/server → server}/framework-preset-angular-docs.d.ts +1 -1
- package/dist/{types/server → server}/framework-preset-angular-docs.js +1 -1
- package/dist/{types/server → server}/framework-preset-angular-ivy.d.ts +1 -1
- package/dist/{types/server → server}/framework-preset-angular-ivy.js +4 -2
- package/dist/server/plugins/storybook-normalize-angular-entry-plugin.d.ts +25 -0
- package/dist/server/plugins/storybook-normalize-angular-entry-plugin.js +46 -0
- package/dist/{types/server → server}/preset-options.d.ts +2 -2
- package/dist/{types/server → server}/preset-options.js +0 -0
- package/dist/{types/server → server}/utils/filter-out-styling-rules.d.ts +1 -1
- package/dist/{types/server → server}/utils/filter-out-styling-rules.js +0 -0
- package/dist/{types/server → server}/utils/module-is-available.d.ts +0 -0
- package/dist/{types/server → server}/utils/module-is-available.js +0 -0
- package/dist/{types/server → server}/utils/normalize-asset-patterns.d.ts +1 -1
- package/dist/{types/server → server}/utils/normalize-asset-patterns.js +0 -0
- package/dist/{types/server → server}/utils/normalize-optimization.d.ts +0 -0
- package/dist/{types/server → server}/utils/normalize-optimization.js +0 -0
- package/dist/types.d.ts +29 -0
- package/dist/{types/types.js → types.js} +0 -0
- package/jest.config.js +8 -1
- package/package.json +49 -54
- package/preset.js +1 -1
- package/renderer.d.ts +1 -1
- package/renderer.js +1 -1
- 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 +53 -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 +233 -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 +42 -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-for-root.stories.ts +50 -0
- package/template/stories/basics/ng-module/import-module.stories.ts +46 -0
- package/template/stories/button.component.ts +26 -0
- package/template/stories/core/README.stories.mdx +7 -0
- package/template/stories/core/decorators/componentWrapperDecorator/child.component.ts +20 -0
- package/template/stories/core/decorators/componentWrapperDecorator/decorators.stories.ts +117 -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/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 +22 -0
- package/template/stories/core/styles/story-styles.stories.ts +50 -0
- package/template/stories/others/issues/12009-unknown-component.stories.ts +14 -0
- package/template/stories/others/ngx-translate/README.stories.mdx +58 -0
- package/LICENSE +0 -21
- package/dist/types/client/config.d.ts +0 -6
- package/dist/types/client/config.js +0 -10
- package/dist/types/client/decorateStory.d.ts +0 -4
- package/dist/types/client/decorators.d.ts +0 -5
- package/dist/types/client/docs/config.d.ts +0 -14
- package/dist/types/client/public-api.d.ts +0 -23
- package/dist/types/client/public-types.d.ts +0 -27
- package/dist/types/client/render.d.ts +0 -7
- package/dist/types/server/__mocks-ng-workspace__/with-nx/tsconfig.json +0 -19
- package/dist/types/server/__mocks-ng-workspace__/with-nx-workspace/tsconfig.json +0 -19
- package/dist/types/server/__mocks-ng-workspace__/with-options-styles/tsconfig.json +0 -16
- package/dist/types/server/__mocks-ng-workspace__/without-projects-entry/tsconfig.json +0 -16
- package/dist/types/server/__mocks-ng-workspace__/without-tsConfig/tsconfig.json +0 -16
- package/dist/types/server/angular-cli-webpack-12.2.x.js +0 -66
- package/dist/types/server/angular-cli-webpack-13.x.x.d.ts +0 -1
- package/dist/types/server/angular-cli-webpack-older.d.ts +0 -6
- package/dist/types/server/angular-cli-webpack-older.js +0 -111
- package/dist/types/server/angular-devkit-build-webpack.d.ts +0 -30
- package/dist/types/server/angular-devkit-build-webpack.js +0 -164
- package/dist/types/server/create-fork-ts-checker-plugin.d.ts +0 -3
- package/dist/types/server/create-fork-ts-checker-plugin.js +0 -19
- package/dist/types/server/framework-preset-angular.d.ts +0 -5
- package/dist/types/server/framework-preset-angular.js +0 -103
- package/dist/types/server/ngx-template-loader/index.d.ts +0 -1
- package/dist/types/server/ngx-template-loader/index.js +0 -46
- package/dist/types/server/ts_config.d.ts +0 -2
- package/dist/types/server/ts_config.js +0 -28
- package/dist/types/types.d.ts +0 -28
package/.eslintrc.js
ADDED
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BuilderOutput } from '@angular-devkit/architect';
|
|
2
2
|
import { JsonObject } from '@angular-devkit/core';
|
|
3
|
-
import
|
|
3
|
+
import { CLIOptions } from '@storybook/types';
|
|
4
4
|
import { ExtraEntryPoint, StylePreprocessorOptions } from '@angular-devkit/build-angular';
|
|
5
|
-
export
|
|
5
|
+
export type StorybookBuilderOptions = JsonObject & {
|
|
6
6
|
browserTarget?: string | null;
|
|
7
7
|
tsConfig?: string;
|
|
8
8
|
compodoc: boolean;
|
|
@@ -10,6 +10,6 @@ export declare type StorybookBuilderOptions = JsonObject & {
|
|
|
10
10
|
styles?: ExtraEntryPoint[];
|
|
11
11
|
stylePreprocessorOptions?: StylePreprocessorOptions;
|
|
12
12
|
} & Pick<CLIOptions, 'outputDir' | 'configDir' | 'loglevel' | 'quiet' | 'docs' | 'webpackStatsJson'>;
|
|
13
|
-
export
|
|
13
|
+
export type StorybookBuilderOutput = JsonObject & BuilderOutput & {};
|
|
14
14
|
declare const _default: import("@angular-devkit/architect/src/internal").Builder<any>;
|
|
15
15
|
export default _default;
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const architect_1 = require("@angular-devkit/architect");
|
|
27
|
+
const testing_1 = require("@angular-devkit/architect/testing");
|
|
28
|
+
const core_1 = require("@angular-devkit/core");
|
|
29
|
+
const path = __importStar(require("path"));
|
|
30
|
+
const buildDevStandaloneMock = jest.fn();
|
|
31
|
+
const buildStaticStandaloneMock = jest.fn();
|
|
32
|
+
const buildMock = {
|
|
33
|
+
buildDevStandalone: buildDevStandaloneMock,
|
|
34
|
+
buildStaticStandalone: buildStaticStandaloneMock,
|
|
35
|
+
};
|
|
36
|
+
jest.doMock('@storybook/core-server', () => buildMock);
|
|
37
|
+
jest.doMock('find-up', () => ({ sync: () => './storybook/tsconfig.ts' }));
|
|
38
|
+
const cpSpawnMock = {
|
|
39
|
+
spawn: jest.fn(),
|
|
40
|
+
};
|
|
41
|
+
jest.doMock('child_process', () => cpSpawnMock);
|
|
42
|
+
describe('Build Storybook Builder', () => {
|
|
43
|
+
let architect;
|
|
44
|
+
let architectHost;
|
|
45
|
+
beforeEach(async () => {
|
|
46
|
+
const registry = new core_1.schema.CoreSchemaRegistry();
|
|
47
|
+
registry.addPostTransform(core_1.schema.transforms.addUndefinedDefaults);
|
|
48
|
+
architectHost = new testing_1.TestingArchitectHost();
|
|
49
|
+
architect = new architect_1.Architect(architectHost, registry);
|
|
50
|
+
architectHost.addBuilder('@angular-devkit/build-angular:browser', (0, architect_1.createBuilder)(() => {
|
|
51
|
+
return { success: true };
|
|
52
|
+
}));
|
|
53
|
+
architectHost.addTarget({ project: 'angular-cli', target: 'build-2' }, '@angular-devkit/build-angular:browser', {
|
|
54
|
+
outputPath: 'dist/angular-cli',
|
|
55
|
+
index: 'src/index.html',
|
|
56
|
+
main: 'src/main.ts',
|
|
57
|
+
polyfills: 'src/polyfills.ts',
|
|
58
|
+
tsConfig: 'src/tsconfig.app.json',
|
|
59
|
+
assets: ['src/favicon.ico', 'src/assets'],
|
|
60
|
+
styles: ['src/styles.css'],
|
|
61
|
+
scripts: [],
|
|
62
|
+
});
|
|
63
|
+
// This will either take a Node package name, or a path to the directory
|
|
64
|
+
// for the package.json file.
|
|
65
|
+
await architectHost.addBuilderFromPackage(path.join(__dirname, '../../..'));
|
|
66
|
+
});
|
|
67
|
+
beforeEach(() => {
|
|
68
|
+
buildStaticStandaloneMock.mockImplementation((_options) => Promise.resolve());
|
|
69
|
+
cpSpawnMock.spawn.mockImplementation(() => ({
|
|
70
|
+
stdout: { on: () => { } },
|
|
71
|
+
stderr: { on: () => { } },
|
|
72
|
+
on: (_event, cb) => cb(0),
|
|
73
|
+
}));
|
|
74
|
+
});
|
|
75
|
+
afterEach(() => {
|
|
76
|
+
jest.clearAllMocks();
|
|
77
|
+
});
|
|
78
|
+
it('should start storybook with angularBrowserTarget', async () => {
|
|
79
|
+
const run = await architect.scheduleBuilder('@storybook/angular:build-storybook', {
|
|
80
|
+
browserTarget: 'angular-cli:build-2',
|
|
81
|
+
compodoc: false,
|
|
82
|
+
});
|
|
83
|
+
const output = await run.result;
|
|
84
|
+
await run.stop();
|
|
85
|
+
expect(output.success).toBeTruthy();
|
|
86
|
+
expect(cpSpawnMock.spawn).not.toHaveBeenCalledWith();
|
|
87
|
+
expect(buildStaticStandaloneMock).toHaveBeenCalledWith({
|
|
88
|
+
angularBrowserTarget: 'angular-cli:build-2',
|
|
89
|
+
angularBuilderContext: expect.any(Object),
|
|
90
|
+
angularBuilderOptions: {},
|
|
91
|
+
configDir: '.storybook',
|
|
92
|
+
docs: undefined,
|
|
93
|
+
loglevel: undefined,
|
|
94
|
+
quiet: false,
|
|
95
|
+
outputDir: 'storybook-static',
|
|
96
|
+
packageJson: expect.any(Object),
|
|
97
|
+
mode: 'static',
|
|
98
|
+
tsConfig: './storybook/tsconfig.ts',
|
|
99
|
+
webpackStatsJson: false,
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
it('should start storybook with tsConfig', async () => {
|
|
103
|
+
const run = await architect.scheduleBuilder('@storybook/angular:build-storybook', {
|
|
104
|
+
tsConfig: 'path/to/tsConfig.json',
|
|
105
|
+
compodoc: false,
|
|
106
|
+
});
|
|
107
|
+
const output = await run.result;
|
|
108
|
+
await run.stop();
|
|
109
|
+
expect(output.success).toBeTruthy();
|
|
110
|
+
expect(cpSpawnMock.spawn).not.toHaveBeenCalledWith();
|
|
111
|
+
expect(buildStaticStandaloneMock).toHaveBeenCalledWith({
|
|
112
|
+
angularBrowserTarget: null,
|
|
113
|
+
angularBuilderContext: expect.any(Object),
|
|
114
|
+
angularBuilderOptions: {},
|
|
115
|
+
configDir: '.storybook',
|
|
116
|
+
docs: undefined,
|
|
117
|
+
loglevel: undefined,
|
|
118
|
+
quiet: false,
|
|
119
|
+
outputDir: 'storybook-static',
|
|
120
|
+
packageJson: expect.any(Object),
|
|
121
|
+
mode: 'static',
|
|
122
|
+
tsConfig: 'path/to/tsConfig.json',
|
|
123
|
+
webpackStatsJson: false,
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
it('should build storybook with webpack stats.json', async () => {
|
|
127
|
+
const run = await architect.scheduleBuilder('@storybook/angular:build-storybook', {
|
|
128
|
+
tsConfig: 'path/to/tsConfig.json',
|
|
129
|
+
compodoc: false,
|
|
130
|
+
webpackStatsJson: true,
|
|
131
|
+
});
|
|
132
|
+
const output = await run.result;
|
|
133
|
+
await run.stop();
|
|
134
|
+
expect(output.success).toBeTruthy();
|
|
135
|
+
expect(cpSpawnMock.spawn).not.toHaveBeenCalledWith();
|
|
136
|
+
expect(buildStaticStandaloneMock).toHaveBeenCalledWith({
|
|
137
|
+
angularBrowserTarget: null,
|
|
138
|
+
angularBuilderContext: expect.any(Object),
|
|
139
|
+
angularBuilderOptions: {},
|
|
140
|
+
configDir: '.storybook',
|
|
141
|
+
docs: undefined,
|
|
142
|
+
loglevel: undefined,
|
|
143
|
+
quiet: false,
|
|
144
|
+
outputDir: 'storybook-static',
|
|
145
|
+
packageJson: expect.any(Object),
|
|
146
|
+
mode: 'static',
|
|
147
|
+
tsConfig: 'path/to/tsConfig.json',
|
|
148
|
+
webpackStatsJson: true,
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
it('should throw error', async () => {
|
|
152
|
+
buildStaticStandaloneMock.mockRejectedValue(true);
|
|
153
|
+
const run = await architect.scheduleBuilder('@storybook/angular:start-storybook', {
|
|
154
|
+
browserTarget: 'angular-cli:build-2',
|
|
155
|
+
port: 4400,
|
|
156
|
+
compodoc: false,
|
|
157
|
+
});
|
|
158
|
+
try {
|
|
159
|
+
await run.result;
|
|
160
|
+
expect(false).toEqual('Throw expected');
|
|
161
|
+
}
|
|
162
|
+
catch (error) {
|
|
163
|
+
// eslint-disable-next-line jest/no-try-expect, jest/no-conditional-expect
|
|
164
|
+
expect(error).toEqual('Broken build, fix the error above.\nYou may need to refresh the browser.');
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
it('should run compodoc', async () => {
|
|
168
|
+
const run = await architect.scheduleBuilder('@storybook/angular:build-storybook', {
|
|
169
|
+
browserTarget: 'angular-cli:build-2',
|
|
170
|
+
});
|
|
171
|
+
const output = await run.result;
|
|
172
|
+
await run.stop();
|
|
173
|
+
expect(output.success).toBeTruthy();
|
|
174
|
+
expect(cpSpawnMock.spawn).toHaveBeenCalledWith('npx', ['compodoc', '-p', './storybook/tsconfig.ts', '-d', '', '-e', 'json'], {
|
|
175
|
+
cwd: '',
|
|
176
|
+
shell: true,
|
|
177
|
+
});
|
|
178
|
+
expect(buildStaticStandaloneMock).toHaveBeenCalledWith({
|
|
179
|
+
angularBrowserTarget: 'angular-cli:build-2',
|
|
180
|
+
angularBuilderContext: expect.any(Object),
|
|
181
|
+
angularBuilderOptions: {},
|
|
182
|
+
configDir: '.storybook',
|
|
183
|
+
docs: undefined,
|
|
184
|
+
loglevel: undefined,
|
|
185
|
+
quiet: false,
|
|
186
|
+
outputDir: 'storybook-static',
|
|
187
|
+
packageJson: expect.any(Object),
|
|
188
|
+
mode: 'static',
|
|
189
|
+
tsConfig: './storybook/tsconfig.ts',
|
|
190
|
+
webpackStatsJson: false,
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
it('should start storybook with styles options', async () => {
|
|
194
|
+
const run = await architect.scheduleBuilder('@storybook/angular:build-storybook', {
|
|
195
|
+
tsConfig: 'path/to/tsConfig.json',
|
|
196
|
+
compodoc: false,
|
|
197
|
+
styles: ['style.scss'],
|
|
198
|
+
});
|
|
199
|
+
const output = await run.result;
|
|
200
|
+
await run.stop();
|
|
201
|
+
expect(output.success).toBeTruthy();
|
|
202
|
+
expect(cpSpawnMock.spawn).not.toHaveBeenCalledWith();
|
|
203
|
+
expect(buildStaticStandaloneMock).toHaveBeenCalledWith({
|
|
204
|
+
angularBrowserTarget: null,
|
|
205
|
+
angularBuilderContext: expect.any(Object),
|
|
206
|
+
angularBuilderOptions: { styles: ['style.scss'] },
|
|
207
|
+
configDir: '.storybook',
|
|
208
|
+
docs: undefined,
|
|
209
|
+
loglevel: undefined,
|
|
210
|
+
quiet: false,
|
|
211
|
+
outputDir: 'storybook-static',
|
|
212
|
+
packageJson: expect.any(Object),
|
|
213
|
+
mode: 'static',
|
|
214
|
+
tsConfig: 'path/to/tsConfig.json',
|
|
215
|
+
webpackStatsJson: false,
|
|
216
|
+
});
|
|
217
|
+
});
|
|
218
|
+
});
|
|
File without changes
|
|
File without changes
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BuilderOutput } from '@angular-devkit/architect';
|
|
2
2
|
import { JsonObject } from '@angular-devkit/core';
|
|
3
3
|
import { ExtraEntryPoint, StylePreprocessorOptions } from '@angular-devkit/build-angular';
|
|
4
|
-
import
|
|
5
|
-
export
|
|
4
|
+
import { CLIOptions } from '@storybook/types';
|
|
5
|
+
export type StorybookBuilderOptions = JsonObject & {
|
|
6
6
|
browserTarget?: string | null;
|
|
7
7
|
tsConfig?: string;
|
|
8
8
|
compodoc: boolean;
|
|
@@ -10,6 +10,6 @@ export declare type StorybookBuilderOptions = JsonObject & {
|
|
|
10
10
|
styles?: ExtraEntryPoint[];
|
|
11
11
|
stylePreprocessorOptions?: StylePreprocessorOptions;
|
|
12
12
|
} & Pick<CLIOptions, 'port' | 'host' | 'configDir' | 'https' | 'sslCa' | 'sslCert' | 'sslKey' | 'smokeTest' | 'ci' | 'quiet' | 'docs'>;
|
|
13
|
-
export
|
|
13
|
+
export type StorybookBuilderOutput = JsonObject & BuilderOutput & {};
|
|
14
14
|
declare const _default: import("@angular-devkit/architect/src/internal").Builder<any>;
|
|
15
15
|
export default _default;
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const architect_1 = require("@angular-devkit/architect");
|
|
27
|
+
const testing_1 = require("@angular-devkit/architect/testing");
|
|
28
|
+
const core_1 = require("@angular-devkit/core");
|
|
29
|
+
const path = __importStar(require("path"));
|
|
30
|
+
const buildDevStandaloneMock = jest.fn();
|
|
31
|
+
const buildStaticStandaloneMock = jest.fn();
|
|
32
|
+
const buildMock = {
|
|
33
|
+
buildDevStandalone: buildDevStandaloneMock,
|
|
34
|
+
buildStaticStandalone: buildStaticStandaloneMock,
|
|
35
|
+
};
|
|
36
|
+
jest.doMock('@storybook/core-server', () => buildMock);
|
|
37
|
+
jest.doMock('find-up', () => ({ sync: () => './storybook/tsconfig.ts' }));
|
|
38
|
+
const cpSpawnMock = {
|
|
39
|
+
spawn: jest.fn(),
|
|
40
|
+
};
|
|
41
|
+
jest.doMock('child_process', () => cpSpawnMock);
|
|
42
|
+
describe('Start Storybook Builder', () => {
|
|
43
|
+
let architect;
|
|
44
|
+
let architectHost;
|
|
45
|
+
beforeEach(async () => {
|
|
46
|
+
const registry = new core_1.schema.CoreSchemaRegistry();
|
|
47
|
+
registry.addPostTransform(core_1.schema.transforms.addUndefinedDefaults);
|
|
48
|
+
architectHost = new testing_1.TestingArchitectHost();
|
|
49
|
+
architect = new architect_1.Architect(architectHost, registry);
|
|
50
|
+
architectHost.addBuilder('@angular-devkit/build-angular:browser', (0, architect_1.createBuilder)(() => {
|
|
51
|
+
return { success: true };
|
|
52
|
+
}));
|
|
53
|
+
architectHost.addTarget({ project: 'angular-cli', target: 'build-2' }, '@angular-devkit/build-angular:browser', {
|
|
54
|
+
outputPath: 'dist/angular-cli',
|
|
55
|
+
index: 'src/index.html',
|
|
56
|
+
main: 'src/main.ts',
|
|
57
|
+
polyfills: 'src/polyfills.ts',
|
|
58
|
+
tsConfig: 'src/tsconfig.app.json',
|
|
59
|
+
assets: ['src/favicon.ico', 'src/assets'],
|
|
60
|
+
styles: ['src/styles.css'],
|
|
61
|
+
scripts: [],
|
|
62
|
+
});
|
|
63
|
+
// This will either take a Node package name, or a path to the directory
|
|
64
|
+
// for the package.json file.
|
|
65
|
+
await architectHost.addBuilderFromPackage(path.join(__dirname, '../../..'));
|
|
66
|
+
});
|
|
67
|
+
beforeEach(() => {
|
|
68
|
+
buildDevStandaloneMock.mockImplementation((_options) => Promise.resolve());
|
|
69
|
+
cpSpawnMock.spawn.mockImplementation(() => ({
|
|
70
|
+
stdout: { on: () => { } },
|
|
71
|
+
stderr: { on: () => { } },
|
|
72
|
+
on: (_event, cb) => cb(0),
|
|
73
|
+
}));
|
|
74
|
+
});
|
|
75
|
+
afterEach(() => {
|
|
76
|
+
jest.clearAllMocks();
|
|
77
|
+
});
|
|
78
|
+
it('should start storybook with angularBrowserTarget', async () => {
|
|
79
|
+
const run = await architect.scheduleBuilder('@storybook/angular:start-storybook', {
|
|
80
|
+
browserTarget: 'angular-cli:build-2',
|
|
81
|
+
port: 4400,
|
|
82
|
+
compodoc: false,
|
|
83
|
+
});
|
|
84
|
+
const output = await run.result;
|
|
85
|
+
await run.stop();
|
|
86
|
+
expect(output.success).toBeTruthy();
|
|
87
|
+
expect(cpSpawnMock.spawn).not.toHaveBeenCalledWith();
|
|
88
|
+
expect(buildDevStandaloneMock).toHaveBeenCalledWith({
|
|
89
|
+
angularBrowserTarget: 'angular-cli:build-2',
|
|
90
|
+
angularBuilderContext: expect.any(Object),
|
|
91
|
+
angularBuilderOptions: {},
|
|
92
|
+
ci: false,
|
|
93
|
+
configDir: '.storybook',
|
|
94
|
+
docs: undefined,
|
|
95
|
+
host: 'localhost',
|
|
96
|
+
https: false,
|
|
97
|
+
packageJson: expect.any(Object),
|
|
98
|
+
port: 4400,
|
|
99
|
+
quiet: false,
|
|
100
|
+
smokeTest: false,
|
|
101
|
+
sslCa: undefined,
|
|
102
|
+
sslCert: undefined,
|
|
103
|
+
sslKey: undefined,
|
|
104
|
+
tsConfig: './storybook/tsconfig.ts',
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
it('should start storybook with tsConfig', async () => {
|
|
108
|
+
const run = await architect.scheduleBuilder('@storybook/angular:start-storybook', {
|
|
109
|
+
tsConfig: 'path/to/tsConfig.json',
|
|
110
|
+
port: 4400,
|
|
111
|
+
compodoc: false,
|
|
112
|
+
});
|
|
113
|
+
const output = await run.result;
|
|
114
|
+
await run.stop();
|
|
115
|
+
expect(output.success).toBeTruthy();
|
|
116
|
+
expect(cpSpawnMock.spawn).not.toHaveBeenCalledWith();
|
|
117
|
+
expect(buildDevStandaloneMock).toHaveBeenCalledWith({
|
|
118
|
+
angularBrowserTarget: null,
|
|
119
|
+
angularBuilderContext: expect.any(Object),
|
|
120
|
+
angularBuilderOptions: {},
|
|
121
|
+
ci: false,
|
|
122
|
+
configDir: '.storybook',
|
|
123
|
+
docs: undefined,
|
|
124
|
+
host: 'localhost',
|
|
125
|
+
https: false,
|
|
126
|
+
packageJson: expect.any(Object),
|
|
127
|
+
port: 4400,
|
|
128
|
+
quiet: false,
|
|
129
|
+
smokeTest: false,
|
|
130
|
+
sslCa: undefined,
|
|
131
|
+
sslCert: undefined,
|
|
132
|
+
sslKey: undefined,
|
|
133
|
+
tsConfig: 'path/to/tsConfig.json',
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
it('should throw error', async () => {
|
|
137
|
+
buildDevStandaloneMock.mockRejectedValue(true);
|
|
138
|
+
const run = await architect.scheduleBuilder('@storybook/angular:start-storybook', {
|
|
139
|
+
browserTarget: 'angular-cli:build-2',
|
|
140
|
+
port: 4400,
|
|
141
|
+
compodoc: false,
|
|
142
|
+
});
|
|
143
|
+
try {
|
|
144
|
+
await run.result;
|
|
145
|
+
expect(false).toEqual('Throw expected');
|
|
146
|
+
}
|
|
147
|
+
catch (error) {
|
|
148
|
+
// eslint-disable-next-line jest/no-try-expect, jest/no-conditional-expect
|
|
149
|
+
expect(error).toEqual('Broken build, fix the error above.\nYou may need to refresh the browser.');
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
it('should run compodoc', async () => {
|
|
153
|
+
const run = await architect.scheduleBuilder('@storybook/angular:start-storybook', {
|
|
154
|
+
browserTarget: 'angular-cli:build-2',
|
|
155
|
+
});
|
|
156
|
+
const output = await run.result;
|
|
157
|
+
await run.stop();
|
|
158
|
+
expect(output.success).toBeTruthy();
|
|
159
|
+
expect(cpSpawnMock.spawn).toHaveBeenCalledWith('npx', ['compodoc', '-p', './storybook/tsconfig.ts', '-d', '', '-e', 'json'], {
|
|
160
|
+
cwd: '',
|
|
161
|
+
shell: true,
|
|
162
|
+
});
|
|
163
|
+
expect(buildDevStandaloneMock).toHaveBeenCalledWith({
|
|
164
|
+
angularBrowserTarget: 'angular-cli:build-2',
|
|
165
|
+
angularBuilderContext: expect.any(Object),
|
|
166
|
+
angularBuilderOptions: {},
|
|
167
|
+
ci: false,
|
|
168
|
+
configDir: '.storybook',
|
|
169
|
+
docs: undefined,
|
|
170
|
+
host: 'localhost',
|
|
171
|
+
https: false,
|
|
172
|
+
packageJson: expect.any(Object),
|
|
173
|
+
port: 9009,
|
|
174
|
+
quiet: false,
|
|
175
|
+
smokeTest: false,
|
|
176
|
+
sslCa: undefined,
|
|
177
|
+
sslCert: undefined,
|
|
178
|
+
sslKey: undefined,
|
|
179
|
+
tsConfig: './storybook/tsconfig.ts',
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
it('should start storybook with styles options', async () => {
|
|
183
|
+
const run = await architect.scheduleBuilder('@storybook/angular:start-storybook', {
|
|
184
|
+
tsConfig: 'path/to/tsConfig.json',
|
|
185
|
+
port: 4400,
|
|
186
|
+
compodoc: false,
|
|
187
|
+
styles: ['src/styles.css'],
|
|
188
|
+
});
|
|
189
|
+
const output = await run.result;
|
|
190
|
+
await run.stop();
|
|
191
|
+
expect(output.success).toBeTruthy();
|
|
192
|
+
expect(cpSpawnMock.spawn).not.toHaveBeenCalledWith();
|
|
193
|
+
expect(buildDevStandaloneMock).toHaveBeenCalledWith({
|
|
194
|
+
angularBrowserTarget: null,
|
|
195
|
+
angularBuilderContext: expect.any(Object),
|
|
196
|
+
angularBuilderOptions: {
|
|
197
|
+
styles: ['src/styles.css'],
|
|
198
|
+
},
|
|
199
|
+
ci: false,
|
|
200
|
+
configDir: '.storybook',
|
|
201
|
+
docs: undefined,
|
|
202
|
+
host: 'localhost',
|
|
203
|
+
https: false,
|
|
204
|
+
port: 4400,
|
|
205
|
+
packageJson: expect.any(Object),
|
|
206
|
+
quiet: false,
|
|
207
|
+
smokeTest: false,
|
|
208
|
+
sslCa: undefined,
|
|
209
|
+
sslCert: undefined,
|
|
210
|
+
sslKey: undefined,
|
|
211
|
+
tsConfig: 'path/to/tsConfig.json',
|
|
212
|
+
});
|
|
213
|
+
});
|
|
214
|
+
});
|
|
File without changes
|
|
File without changes
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.buildStandaloneErrorHandler = void 0;
|
|
7
4
|
const node_logger_1 = require("@storybook/node-logger");
|
|
8
|
-
const ts_dedent_1 =
|
|
5
|
+
const ts_dedent_1 = require("ts-dedent");
|
|
9
6
|
const buildStandaloneErrorHandler = (error) => {
|
|
10
7
|
// Duplicate code for Standalone error handling
|
|
11
8
|
// Source: https://github.com/storybookjs/storybook/blob/39c7ba09ad84fbd466f9c25d5b92791a5450b9f6/lib/core-server/src/build-dev.ts#L136
|
|
@@ -26,11 +23,11 @@ const buildStandaloneErrorHandler = (error) => {
|
|
|
26
23
|
}
|
|
27
24
|
node_logger_1.logger.line();
|
|
28
25
|
return error.close
|
|
29
|
-
? (0, ts_dedent_1.
|
|
26
|
+
? (0, ts_dedent_1.dedent) `
|
|
30
27
|
FATAL broken build!, will close the process,
|
|
31
28
|
Fix the error below and restart storybook.
|
|
32
29
|
`
|
|
33
|
-
: (0, ts_dedent_1.
|
|
30
|
+
: (0, ts_dedent_1.dedent) `
|
|
34
31
|
Broken build, fix the error above.
|
|
35
32
|
You may need to refresh the browser.
|
|
36
33
|
`;
|
|
File without changes
|
|
@@ -48,7 +48,6 @@ const runCompodoc = ({ compodocArgs, tsconfig }, context) => {
|
|
|
48
48
|
context.logger.info(finalCompodocArgs.join(' '));
|
|
49
49
|
const child = (0, child_process_1.spawn)('npx', finalCompodocArgs, {
|
|
50
50
|
cwd: context.workspaceRoot,
|
|
51
|
-
env: process.env,
|
|
52
51
|
shell: true,
|
|
53
52
|
});
|
|
54
53
|
child.stdout.on('data', (data) => {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const operators_1 = require("rxjs/operators");
|
|
4
|
+
const cpSpawnMock = {
|
|
5
|
+
spawn: jest.fn(),
|
|
6
|
+
};
|
|
7
|
+
jest.doMock('child_process', () => cpSpawnMock);
|
|
8
|
+
const { runCompodoc } = require('./run-compodoc');
|
|
9
|
+
const builderContextLoggerMock = {
|
|
10
|
+
createChild: jest.fn(),
|
|
11
|
+
log: jest.fn(),
|
|
12
|
+
debug: jest.fn(),
|
|
13
|
+
info: jest.fn(),
|
|
14
|
+
warn: jest.fn(),
|
|
15
|
+
error: jest.fn(),
|
|
16
|
+
fatal: jest.fn(),
|
|
17
|
+
};
|
|
18
|
+
describe('runCompodoc', () => {
|
|
19
|
+
beforeEach(() => {
|
|
20
|
+
cpSpawnMock.spawn.mockImplementation(() => ({
|
|
21
|
+
stdout: { on: () => { } },
|
|
22
|
+
stderr: { on: () => { } },
|
|
23
|
+
on: (_event, cb) => cb(0),
|
|
24
|
+
}));
|
|
25
|
+
});
|
|
26
|
+
afterEach(() => {
|
|
27
|
+
jest.clearAllMocks();
|
|
28
|
+
});
|
|
29
|
+
it('should run compodoc with tsconfig from context', async () => {
|
|
30
|
+
runCompodoc({
|
|
31
|
+
compodocArgs: [],
|
|
32
|
+
tsconfig: 'path/to/tsconfig.json',
|
|
33
|
+
}, {
|
|
34
|
+
workspaceRoot: 'path/to/project',
|
|
35
|
+
logger: builderContextLoggerMock,
|
|
36
|
+
})
|
|
37
|
+
.pipe((0, operators_1.take)(1))
|
|
38
|
+
.subscribe();
|
|
39
|
+
expect(cpSpawnMock.spawn).toHaveBeenCalledWith('npx', ['compodoc', '-p', 'path/to/tsconfig.json', '-d', 'path/to/project'], {
|
|
40
|
+
cwd: 'path/to/project',
|
|
41
|
+
shell: true,
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
it('should run compodoc with tsconfig from compodocArgs', async () => {
|
|
45
|
+
runCompodoc({
|
|
46
|
+
compodocArgs: ['-p', 'path/to/tsconfig.stories.json'],
|
|
47
|
+
tsconfig: 'path/to/tsconfig.json',
|
|
48
|
+
}, {
|
|
49
|
+
workspaceRoot: 'path/to/project',
|
|
50
|
+
logger: builderContextLoggerMock,
|
|
51
|
+
})
|
|
52
|
+
.pipe((0, operators_1.take)(1))
|
|
53
|
+
.subscribe();
|
|
54
|
+
expect(cpSpawnMock.spawn).toHaveBeenCalledWith('npx', ['compodoc', '-d', 'path/to/project', '-p', 'path/to/tsconfig.stories.json'], {
|
|
55
|
+
cwd: 'path/to/project',
|
|
56
|
+
shell: true,
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
export
|
|
1
|
+
import { BuilderContext } from '@angular-devkit/architect';
|
|
2
|
+
import { LoadOptions, CLIOptions, BuilderOptions } from '@storybook/types';
|
|
3
|
+
export type StandaloneOptions = Partial<CLIOptions & LoadOptions & BuilderOptions & {
|
|
4
4
|
mode?: 'static' | 'dev';
|
|
5
5
|
angularBrowserTarget?: string | null;
|
|
6
6
|
angularBuilderOptions?: Record<string, any> & {
|
|
File without changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ViewContainerRef, ChangeDetectorRef, OnInit, ComponentFactoryResolver, OnDestroy } from '@angular/core';
|
|
2
2
|
import { Observable, Subscription } from 'rxjs';
|
|
3
3
|
import { StoryFnAngularReturnType } from '../types';
|
|
4
4
|
export declare class AppComponent implements OnInit, OnDestroy {
|
|
@@ -13,7 +13,6 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.AppComponent = void 0;
|
|
16
|
-
/* eslint-disable no-useless-constructor */
|
|
17
16
|
// We could use NgComponentOutlet here but there's currently no easy way
|
|
18
17
|
// to provide @Inputs and subscribe to @Outputs, see
|
|
19
18
|
// https://github.com/angular/angular/issues/15360
|
|
File without changes
|
|
File without changes
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { PartialStoryFn } from '@storybook/types';
|
|
2
|
+
import { AngularRenderer } from '../types';
|
|
3
3
|
declare global {
|
|
4
4
|
interface Window {
|
|
5
5
|
NODE_ENV: 'string' | 'development' | undefined;
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
|
-
export declare const renderNgApp: (storyFn: PartialStoryFn<
|
|
8
|
+
export declare const renderNgApp: (storyFn: PartialStoryFn<AngularRenderer>, forced: boolean) => void;
|