diff --git a/app/angular/src/server/framework-preset-angular-cli.ts b/app/angular/src/server/framework-preset-angular-cli.ts index 6f6b0601cf73..9b46c9059127 100644 --- a/app/angular/src/server/framework-preset-angular-cli.ts +++ b/app/angular/src/server/framework-preset-angular-cli.ts @@ -3,6 +3,7 @@ import { logger } from '@storybook/node-logger'; import { targetFromTargetString, BuilderContext, Target } from '@angular-devkit/architect'; import { sync as findUpSync } from 'find-up'; import semver from '@storybook/semver'; +import dedent from 'ts-dedent'; import { logging, JsonObject } from '@angular-devkit/core'; import { moduleIsAvailable } from './utils/module-is-available'; @@ -142,8 +143,12 @@ async function getLegacyDefaultBuildOptions(options: PresetOptions) { return {}; } - // TODO ~ legacy way to get default options - // TODO ~ Add deprecation warning and ex for builder use ? `); + logger.warn(dedent`Your Storybook startup uses a solution that will not be supported in version 7.0. + You must use angular builder to have an explicit configuration on the project used in angular.json + Read more at: + - https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#sb-angular-builder) + - https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#angular13) + `); const dirToSearch = process.cwd(); // Read angular workspace diff --git a/app/angular/src/server/framework-preset-angular.ts b/app/angular/src/server/framework-preset-angular.ts index 34d4357befad..798f72bc81bc 100644 --- a/app/angular/src/server/framework-preset-angular.ts +++ b/app/angular/src/server/framework-preset-angular.ts @@ -7,7 +7,7 @@ import createForkTsCheckerInstance from './create-fork-ts-checker-plugin'; export async function webpack( config: Configuration, - { configDir }: { configDir: string } + { configDir, angularBuilderContext }: { configDir: string; angularBuilderContext: any } ): Promise { try { // Disable all this webpack stuff if we use angular-cli >= 12 @@ -15,7 +15,7 @@ export async function webpack( const angularCliVersion = await import('@angular/cli').then((m) => semver.coerce(m.VERSION.full) ); - if (semver.satisfies(angularCliVersion, '>=12.0.0')) { + if (semver.satisfies(angularCliVersion, '12.2.x') && angularBuilderContext) { return config; } } catch (error) {