From 548633a5985e8e1f0d3dd68cddeb286c6e186a4b Mon Sep 17 00:00:00 2001 From: Olivier Combe Date: Thu, 28 Sep 2023 11:13:42 +0200 Subject: [PATCH] chore: explain react deps in angular host dependencies --- angular/devkit/preview/preview/angular-preview.ts | 5 +++++ angular/envs/base-env/preview/host-dependencies.ts | 5 +++-- angular/examples/my-angular-env/preview/host-dependencies.ts | 5 +++-- .../examples/my-angular-v12-env/preview/host-dependencies.ts | 5 +++-- .../examples/my-angular-v13-env/preview/host-dependencies.ts | 5 +++-- .../examples/my-angular-v14-env/preview/host-dependencies.ts | 5 +++-- .../examples/my-angular-v15-env/preview/host-dependencies.ts | 5 +++-- .../examples/my-angular-v16-env/preview/host-dependencies.ts | 5 +++-- .../generators/ng-env/files/preview/host-dependencies.ts | 3 ++- 9 files changed, 28 insertions(+), 15 deletions(-) diff --git a/angular/devkit/preview/preview/angular-preview.ts b/angular/devkit/preview/preview/angular-preview.ts index b6ab4bbd..3b55bee3 100644 --- a/angular/devkit/preview/preview/angular-preview.ts +++ b/angular/devkit/preview/preview/angular-preview.ts @@ -109,6 +109,11 @@ export class AngularPreview implements Preview { return this.bundlerProvider(context); } + /** + * Dependencies to be bundled only once, in the env preview template, and not in each component preview. + * most of your peer dependencies should be listed here to avoid duplications in the preview. + * React, ReactDOM, and MDX are included as they are part of the preview ui. + */ getHostDependencies(): string[] { return ( this.hostDependencies || [ diff --git a/angular/envs/base-env/preview/host-dependencies.ts b/angular/envs/base-env/preview/host-dependencies.ts index 1e705939..6f6a9bb7 100644 --- a/angular/envs/base-env/preview/host-dependencies.ts +++ b/angular/envs/base-env/preview/host-dependencies.ts @@ -1,10 +1,11 @@ /** - * dependencies to be bundled only once, in the env preview template, and not in each component preview. + * Dependencies to be bundled only once, in the env preview template, and not in each component preview. * most of your peer dependencies should be listed here to avoid duplications in the preview. + * React, ReactDOM, and MDX are included as they are part of the preview ui. */ export default [ '@teambit/mdx.ui.mdx-scope-context', '@mdx-js/react', 'react', 'react-dom', -]; \ No newline at end of file +]; diff --git a/angular/examples/my-angular-env/preview/host-dependencies.ts b/angular/examples/my-angular-env/preview/host-dependencies.ts index 1e705939..6f6a9bb7 100644 --- a/angular/examples/my-angular-env/preview/host-dependencies.ts +++ b/angular/examples/my-angular-env/preview/host-dependencies.ts @@ -1,10 +1,11 @@ /** - * dependencies to be bundled only once, in the env preview template, and not in each component preview. + * Dependencies to be bundled only once, in the env preview template, and not in each component preview. * most of your peer dependencies should be listed here to avoid duplications in the preview. + * React, ReactDOM, and MDX are included as they are part of the preview ui. */ export default [ '@teambit/mdx.ui.mdx-scope-context', '@mdx-js/react', 'react', 'react-dom', -]; \ No newline at end of file +]; diff --git a/angular/examples/my-angular-v12-env/preview/host-dependencies.ts b/angular/examples/my-angular-v12-env/preview/host-dependencies.ts index 1e705939..6f6a9bb7 100644 --- a/angular/examples/my-angular-v12-env/preview/host-dependencies.ts +++ b/angular/examples/my-angular-v12-env/preview/host-dependencies.ts @@ -1,10 +1,11 @@ /** - * dependencies to be bundled only once, in the env preview template, and not in each component preview. + * Dependencies to be bundled only once, in the env preview template, and not in each component preview. * most of your peer dependencies should be listed here to avoid duplications in the preview. + * React, ReactDOM, and MDX are included as they are part of the preview ui. */ export default [ '@teambit/mdx.ui.mdx-scope-context', '@mdx-js/react', 'react', 'react-dom', -]; \ No newline at end of file +]; diff --git a/angular/examples/my-angular-v13-env/preview/host-dependencies.ts b/angular/examples/my-angular-v13-env/preview/host-dependencies.ts index 1e705939..6f6a9bb7 100644 --- a/angular/examples/my-angular-v13-env/preview/host-dependencies.ts +++ b/angular/examples/my-angular-v13-env/preview/host-dependencies.ts @@ -1,10 +1,11 @@ /** - * dependencies to be bundled only once, in the env preview template, and not in each component preview. + * Dependencies to be bundled only once, in the env preview template, and not in each component preview. * most of your peer dependencies should be listed here to avoid duplications in the preview. + * React, ReactDOM, and MDX are included as they are part of the preview ui. */ export default [ '@teambit/mdx.ui.mdx-scope-context', '@mdx-js/react', 'react', 'react-dom', -]; \ No newline at end of file +]; diff --git a/angular/examples/my-angular-v14-env/preview/host-dependencies.ts b/angular/examples/my-angular-v14-env/preview/host-dependencies.ts index 1e705939..6f6a9bb7 100644 --- a/angular/examples/my-angular-v14-env/preview/host-dependencies.ts +++ b/angular/examples/my-angular-v14-env/preview/host-dependencies.ts @@ -1,10 +1,11 @@ /** - * dependencies to be bundled only once, in the env preview template, and not in each component preview. + * Dependencies to be bundled only once, in the env preview template, and not in each component preview. * most of your peer dependencies should be listed here to avoid duplications in the preview. + * React, ReactDOM, and MDX are included as they are part of the preview ui. */ export default [ '@teambit/mdx.ui.mdx-scope-context', '@mdx-js/react', 'react', 'react-dom', -]; \ No newline at end of file +]; diff --git a/angular/examples/my-angular-v15-env/preview/host-dependencies.ts b/angular/examples/my-angular-v15-env/preview/host-dependencies.ts index 1e705939..6f6a9bb7 100644 --- a/angular/examples/my-angular-v15-env/preview/host-dependencies.ts +++ b/angular/examples/my-angular-v15-env/preview/host-dependencies.ts @@ -1,10 +1,11 @@ /** - * dependencies to be bundled only once, in the env preview template, and not in each component preview. + * Dependencies to be bundled only once, in the env preview template, and not in each component preview. * most of your peer dependencies should be listed here to avoid duplications in the preview. + * React, ReactDOM, and MDX are included as they are part of the preview ui. */ export default [ '@teambit/mdx.ui.mdx-scope-context', '@mdx-js/react', 'react', 'react-dom', -]; \ No newline at end of file +]; diff --git a/angular/examples/my-angular-v16-env/preview/host-dependencies.ts b/angular/examples/my-angular-v16-env/preview/host-dependencies.ts index 1e705939..6f6a9bb7 100644 --- a/angular/examples/my-angular-v16-env/preview/host-dependencies.ts +++ b/angular/examples/my-angular-v16-env/preview/host-dependencies.ts @@ -1,10 +1,11 @@ /** - * dependencies to be bundled only once, in the env preview template, and not in each component preview. + * Dependencies to be bundled only once, in the env preview template, and not in each component preview. * most of your peer dependencies should be listed here to avoid duplications in the preview. + * React, ReactDOM, and MDX are included as they are part of the preview ui. */ export default [ '@teambit/mdx.ui.mdx-scope-context', '@mdx-js/react', 'react', 'react-dom', -]; \ No newline at end of file +]; diff --git a/angular/templates/generators/ng-env/files/preview/host-dependencies.ts b/angular/templates/generators/ng-env/files/preview/host-dependencies.ts index eb75176f..bc1b1575 100644 --- a/angular/templates/generators/ng-env/files/preview/host-dependencies.ts +++ b/angular/templates/generators/ng-env/files/preview/host-dependencies.ts @@ -2,8 +2,9 @@ export const hostDependenciesFile = () => { return { relativePath: './preview/host-dependencies.ts', content: `/** - * dependencies to be bundled only once, in the env preview template, and not in each component preview. + * Dependencies to be bundled only once, in the env preview template, and not in each component preview. * most of your peer dependencies should be listed here to avoid duplications in the preview. + * React, ReactDOM, and MDX are included as they are part of the preview ui. */ export default [ '@teambit/mdx.ui.mdx-scope-context',