diff --git a/.circleci/config.yml b/.circleci/config.yml index cd947ee9c6e0..6dcb72899d0d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -265,32 +265,31 @@ jobs: steps: - git-shallow-clone/checkout_advanced: clone_options: '--depth 1 --verbose' - # TODO: we disabled this one because it keeps failing, we should fix it, and enable it again! - # - attach_workspace: - # at: . - # - run: - # name: Running local registry - # command: yarn local-registry --port 6000 --open - # background: true - # - run: - # name: Wait for registry - # command: yarn wait-on http://localhost:6000 - # - run: - # name: run e2e tests cra - # command: yarn test:e2e-framework --pnp cra + - attach_workspace: + at: . + - run: + name: Running local registry + command: yarn local-registry --port 6000 --open + background: true + - run: + name: Wait for registry + command: yarn wait-on http://localhost:6000 + - run: + name: run e2e tests cra + command: yarn test:e2e-framework --pnp cra # - run: # name: run e2e tests vue # command: yarn test:e2e-framework --pnp sfcVue - # - run: - # name: prep artifacts - # when: always - # command: zip -r /tmp/storybook-e2e-testing-out.zip /tmp/storybook-e2e-testing - # - store_artifacts: - # path: /tmp/cypress-record - # destination: cypress - # - store_artifacts: - # path: /tmp/storybook-e2e-testing-out.zip - # destination: e2e + - run: + name: prep artifacts + when: always + command: zip -r /tmp/storybook-e2e-testing-out.zip /tmp/storybook-e2e-testing + - store_artifacts: + path: /tmp/cypress-record + destination: cypress + - store_artifacts: + path: /tmp/storybook-e2e-testing-out.zip + destination: e2e e2e-tests-examples: executor: class: small diff --git a/README.md b/README.md index 0472ab5a1acf..df9b875b9e3f 100644 --- a/README.md +++ b/README.md @@ -51,8 +51,8 @@ It allows you to browse a component library, view the different states of each c
## Table of contents @@ -92,19 +92,19 @@ For additional help, join us in the [Storybook Discord](https://discord.gg/story ### Supported Frameworks -| Framework | Demo | | -| -------------------------------------------------------------- | ------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | -| [React](app/react) | [v6.4.x](https://storybookjs.netlify.com/official-storybook/?path=/story/*) | [](app/react) | -| [Vue](app/vue) | [v6.4.x](https://storybookjs.netlify.com/vue-kitchen-sink/) | [](app/vue) | -| [Angular](app/angular) | [v6.4.x](https://storybookjs.netlify.com/angular-cli/) | [](app/angular) | -| [Web components](app/web-components) | [v6.4.x](https://storybookjs.netlify.com/web-components-kitchen-sink/) | [](app/web-components) | -| [React Native](https://github.com/storybookjs/react-native) | - | [](https://github.com/storybookjs/react-native) | -| [HTML](app/html) | [v6.4.x](https://storybookjs.netlify.com/html-kitchen-sink/) | [](app/html) | -| [Ember](app/ember) | [v6.4.x](https://storybookjs.netlify.com/ember-cli/) | [](app/ember) | -| [Svelte](app/svelte) | [v6.4.x](https://storybookjs.netlify.com/svelte-kitchen-sink/) | [](app/svelte) | -| [Preact](app/preact) | [v6.4.x](https://storybookjs.netlify.com/preact-kitchen-sink/) | [](app/preact) | -| [Marionette.js](https://github.com/storybookjs/marionette) | - | [](https://github.com/storybookjs/marionette) | -| [Android, iOS, Flutter](https://github.com/storybookjs/native) | [v6.4.x](https://storybookjs.github.io/native/@storybook/native-flutter-example/index.html) | [](https://github.com/storybookjs/native) | +| Framework | Demo | | +| -------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | +| [React](app/react) | [](https://storybookjs.netlify.com/official-storybook/?path=/story/*) | [](app/react) | +| [Vue](app/vue) | [](https://storybookjs.netlify.com/vue-kitchen-sink/) | [](app/vue) | +| [Angular](app/angular) | [](https://storybookjs.netlify.com/angular-cli/) | [](app/angular) | +| [Web components](app/web-components) | [](https://storybookjs.netlify.com/web-components-kitchen-sink/) | [](app/web-components) | +| [React Native](https://github.com/storybookjs/react-native) | - | [](https://github.com/storybookjs/react-native) | +| [HTML](app/html) | [](https://storybookjs.netlify.com/html-kitchen-sink/) | [](app/html) | +| [Ember](app/ember) | [](https://storybookjs.netlify.com/ember-cli/) | [](app/ember) | +| [Svelte](app/svelte) | [](https://storybookjs.netlify.com/svelte-kitchen-sink/) | [](app/svelte) | +| [Preact](app/preact) | [](https://storybookjs.netlify.com/preact-kitchen-sink/) | [](app/preact) | +| [Marionette.js](https://github.com/storybookjs/marionette) | - | [](https://github.com/storybookjs/marionette) | +| [Android, iOS, Flutter](https://github.com/storybookjs/native) | [](https://storybookjs.github.io/native/@storybook/native-flutter-example/index.html) | [](https://github.com/storybookjs/native) | ### Sub Projects diff --git a/SECURITY.md b/SECURITY.md index 721021f54540..04845f5bf4a8 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -2,9 +2,9 @@ ## Supported Versions -| Version | Supported | -| ---------- | ------------------ | -| 6.3, 6.4 | :white_check_mark: | +| Version | Supported | +| --------------- | ------------------ | +| 6.3, 6.4, 6.5 | :white_check_mark: | ## Reporting a Vulnerability diff --git a/app/angular/src/client/preview/angular-beta/StorybookModule.ts b/app/angular/src/client/preview/angular-beta/StorybookModule.ts index 68c443375a83..275b490c18bc 100644 --- a/app/angular/src/client/preview/angular-beta/StorybookModule.ts +++ b/app/angular/src/client/preview/angular-beta/StorybookModule.ts @@ -7,7 +7,7 @@ import deprecate from 'util-deprecate'; import { ICollection, StoryFnAngularReturnType } from '../types'; import { storyPropsProvider } from './StorybookProvider'; import { isComponentAlreadyDeclaredInModules } from './utils/NgModulesAnalyzer'; -import { isDeclarable } from './utils/NgComponentAnalyzer'; +import { isDeclarable, isStandaloneComponent } from './utils/NgComponentAnalyzer'; import { createStorybookWrapperComponent } from './StorybookWrapperComponent'; import { computesTemplateFromComponent } from './ComputesTemplateFromComponent'; @@ -61,6 +61,7 @@ export const getStorybookModuleMetadata = ( props ); + const isStandalone = isStandaloneComponent(component); // Look recursively (deep) if the component is not already declared by an import module const requiresComponentDeclaration = isDeclarable(component) && @@ -68,7 +69,8 @@ export const getStorybookModuleMetadata = ( component, moduleMetadata.declarations, moduleMetadata.imports - ); + ) && + !isStandalone; return { declarations: [ @@ -76,7 +78,11 @@ export const getStorybookModuleMetadata = ( ComponentToInject, ...(moduleMetadata.declarations ?? []), ], - imports: [BrowserModule, ...(moduleMetadata.imports ?? [])], + imports: [ + BrowserModule, + ...(isStandalone ? [component] : []), + ...(moduleMetadata.imports ?? []), + ], providers: [storyPropsProvider(storyProps$), ...(moduleMetadata.providers ?? [])], entryComponents: [...(moduleMetadata.entryComponents ?? [])], schemas: [...(moduleMetadata.schemas ?? [])], diff --git a/app/angular/src/client/preview/angular-beta/utils/NgComponentAnalyzer.test.ts b/app/angular/src/client/preview/angular-beta/utils/NgComponentAnalyzer.test.ts index 03eba18a7236..faa7cdce09ff 100644 --- a/app/angular/src/client/preview/angular-beta/utils/NgComponentAnalyzer.test.ts +++ b/app/angular/src/client/preview/angular-beta/utils/NgComponentAnalyzer.test.ts @@ -19,6 +19,7 @@ import { isComponent, isDeclarable, getComponentDecoratorMetadata, + isStandaloneComponent, } from './NgComponentAnalyzer'; describe('getComponentInputsOutputs', () => { @@ -235,6 +236,46 @@ describe('isComponent', () => { }); }); +describe('isStandaloneComponent', () => { + it('should return true with a Component with "standalone: true"', () => { + // TODO: `standalone` is only available in Angular v14. Remove cast to `any` once + // Angular deps are updated to v14.x.x. + @Component({ standalone: true } as any) + class FooComponent {} + + expect(isStandaloneComponent(FooComponent)).toEqual(true); + }); + + it('should return false with a Component with "standalone: false"', () => { + // TODO: `standalone` is only available in Angular v14. Remove cast to `any` once + // Angular deps are updated to v14.x.x. + @Component({ standalone: false } as any) + class FooComponent {} + + expect(isStandaloneComponent(FooComponent)).toEqual(false); + }); + + it('should return false with a Component without the "standalone" property', () => { + @Component({}) + class FooComponent {} + + expect(isStandaloneComponent(FooComponent)).toEqual(false); + }); + + it('should return false with simple class', () => { + class FooPipe {} + + expect(isStandaloneComponent(FooPipe)).toEqual(false); + }); + + it('should return false with Directive', () => { + @Directive() + class FooDirective {} + + expect(isStandaloneComponent(FooDirective)).toEqual(false); + }); +}); + describe('getComponentDecoratorMetadata', () => { it('should return Component with a Component', () => { @Component({ selector: 'foo' }) diff --git a/app/angular/src/client/preview/angular-beta/utils/NgComponentAnalyzer.ts b/app/angular/src/client/preview/angular-beta/utils/NgComponentAnalyzer.ts index ae88972dfe26..36bd036631e3 100644 --- a/app/angular/src/client/preview/angular-beta/utils/NgComponentAnalyzer.ts +++ b/app/angular/src/client/preview/angular-beta/utils/NgComponentAnalyzer.ts @@ -108,6 +108,18 @@ export const isComponent = (component: any): component is Type