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/*) | [![React](https://img.shields.io/npm/dm/@storybook/react.svg)](app/react) | -| [Vue](app/vue) | [v6.4.x](https://storybookjs.netlify.com/vue-kitchen-sink/) | [![Vue](https://img.shields.io/npm/dm/@storybook/vue.svg)](app/vue) | -| [Angular](app/angular) | [v6.4.x](https://storybookjs.netlify.com/angular-cli/) | [![Angular](https://img.shields.io/npm/dm/@storybook/angular.svg)](app/angular) | -| [Web components](app/web-components) | [v6.4.x](https://storybookjs.netlify.com/web-components-kitchen-sink/) | [![Svelte](https://img.shields.io/npm/dm/@storybook/web-components.svg)](app/web-components) | -| [React Native](https://github.com/storybookjs/react-native) | - | [![React Native](https://img.shields.io/npm/dm/@storybook/react-native.svg)](https://github.com/storybookjs/react-native) | -| [HTML](app/html) | [v6.4.x](https://storybookjs.netlify.com/html-kitchen-sink/) | [![HTML](https://img.shields.io/npm/dm/@storybook/html.svg)](app/html) | -| [Ember](app/ember) | [v6.4.x](https://storybookjs.netlify.com/ember-cli/) | [![Ember](https://img.shields.io/npm/dm/@storybook/ember.svg)](app/ember) | -| [Svelte](app/svelte) | [v6.4.x](https://storybookjs.netlify.com/svelte-kitchen-sink/) | [![Svelte](https://img.shields.io/npm/dm/@storybook/svelte.svg)](app/svelte) | -| [Preact](app/preact) | [v6.4.x](https://storybookjs.netlify.com/preact-kitchen-sink/) | [![Preact](https://img.shields.io/npm/dm/@storybook/preact.svg)](app/preact) | -| [Marionette.js](https://github.com/storybookjs/marionette) | - | [![Marionette.js](https://img.shields.io/npm/dm/@storybook/marionette.svg)](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) | [![Native](https://img.shields.io/npm/dm/@storybook/native.svg)](https://github.com/storybookjs/native) | +| Framework | Demo | | +| -------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | +| [React](app/react) | [![Storybook demo](https://img.shields.io/npm/v/@storybook/react/latest?style=flat-square&color=blue&label)](https://storybookjs.netlify.com/official-storybook/?path=/story/*) | [![React](https://img.shields.io/npm/dm/@storybook/react?style=flat-square&color=eee)](app/react) | +| [Vue](app/vue) | [![Storybook demo](https://img.shields.io/npm/v/@storybook/vue/latest?style=flat-square&color=blue&label)](https://storybookjs.netlify.com/vue-kitchen-sink/) | [![Vue](https://img.shields.io/npm/dm/@storybook/vue?style=flat-square&color=eee)](app/vue) | +| [Angular](app/angular) | [![Storybook demo](https://img.shields.io/npm/v/@storybook/angular/latest?style=flat-square&color=blue&label)](https://storybookjs.netlify.com/angular-cli/) | [![Angular](https://img.shields.io/npm/dm/@storybook/angular?style=flat-square&color=eee)](app/angular) | +| [Web components](app/web-components) | [![Storybook demo](https://img.shields.io/npm/v/@storybook/web-components/latest?style=flat-square&color=blue&label)](https://storybookjs.netlify.com/web-components-kitchen-sink/) | [![Svelte](https://img.shields.io/npm/dm/@storybook/web-components?style=flat-square&color=eee)](app/web-components) | +| [React Native](https://github.com/storybookjs/react-native) | - | [![React Native](https://img.shields.io/npm/dm/@storybook/react-native?style=flat-square&color=eee)](https://github.com/storybookjs/react-native) | +| [HTML](app/html) | [![Storybook demo](https://img.shields.io/npm/v/@storybook/html/latest?style=flat-square&color=blue&label)](https://storybookjs.netlify.com/html-kitchen-sink/) | [![HTML](https://img.shields.io/npm/dm/@storybook/html?style=flat-square&color=eee)](app/html) | +| [Ember](app/ember) | [![Storybook demo](https://img.shields.io/npm/v/@storybook/ember/latest?style=flat-square&color=blue&label)](https://storybookjs.netlify.com/ember-cli/) | [![Ember](https://img.shields.io/npm/dm/@storybook/ember?style=flat-square&color=eee)](app/ember) | +| [Svelte](app/svelte) | [![Storybook demo](https://img.shields.io/npm/v/@storybook/svelte/latest?style=flat-square&color=blue&label)](https://storybookjs.netlify.com/svelte-kitchen-sink/) | [![Svelte](https://img.shields.io/npm/dm/@storybook/svelte?style=flat-square&color=eee)](app/svelte) | +| [Preact](app/preact) | [![Storybook demo](https://img.shields.io/npm/v/@storybook/preact/latest?style=flat-square&color=blue&label)](https://storybookjs.netlify.com/preact-kitchen-sink/) | [![Preact](https://img.shields.io/npm/dm/@storybook/preact?style=flat-square&color=eee)](app/preact) | +| [Marionette.js](https://github.com/storybookjs/marionette) | - | [![Marionette.js](https://img.shields.io/npm/dm/@storybook/marionette?style=flat-square&color=eee)](https://github.com/storybookjs/marionette) | +| [Android, iOS, Flutter](https://github.com/storybookjs/native) | [![Storybook demo](https://img.shields.io/npm/v/@storybook/native/latest?style=flat-square&color=blue&label)](https://storybookjs.github.io/native/@storybook/native-flutter-example/index.html) | [![Native](https://img.shields.io/npm/dm/@storybook/native?style=flat-square&color=eee)](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