diff --git a/code/frameworks/angular/package.json b/code/frameworks/angular/package.json index 22361553db82..52759d316db8 100644 --- a/code/frameworks/angular/package.json +++ b/code/frameworks/angular/package.json @@ -56,8 +56,12 @@ "@storybook/components": "workspace:*", "@storybook/core-webpack": "workspace:*", "@storybook/global": "^5.0.0", - "@storybook/preset-angular-webpack": "workspace:*", + "@storybook/manager-api": "workspace:*", + "@storybook/preview-api": "workspace:*", + "@storybook/theming": "workspace:*", "@types/node": "^22.0.0", + "@types/react": "^18.0.37", + "@types/react-dom": "^18.0.11", "@types/semver": "^7.3.4", "@types/webpack-env": "^1.18.0", "fd-package-json": "^1.2.0", @@ -65,20 +69,53 @@ "semver": "^7.3.7", "telejson": "^7.2.0", "ts-dedent": "^2.0.0", + "tsconfig-paths-webpack-plugin": "^4.0.1", "util-deprecate": "^1.0.2", "webpack": "5" }, "devDependencies": { "@analogjs/vite-plugin-angular": "^0.2.24", - "typescript": "^5.3.2" + "@angular-devkit/architect": "^0.1703.0", + "@angular-devkit/build-angular": "^17.3.0", + "@angular-devkit/core": "^17.3.0", + "@angular/animations": "^17.3.0", + "@angular/cli": "^17.3.0", + "@angular/common": "^17.3.0", + "@angular/compiler": "^17.3.0", + "@angular/compiler-cli": "^17.3.0", + "@angular/core": "^17.3.0", + "@angular/forms": "^17.3.0", + "@angular/platform-browser": "^17.3.0", + "@angular/platform-browser-dynamic": "^17.3.0", + "@types/cross-spawn": "^6.0.2", + "@types/tmp": "^0.2.3", + "cross-spawn": "^7.0.3", + "tmp": "^0.2.1", + "typescript": "^5.3.2", + "webpack": "5", + "zone.js": "^0.14.2" }, "peerDependencies": { "@angular-devkit/architect": ">=0.1500.0 < 0.2000.0", "@angular-devkit/build-angular": ">=15.0.0 < 20.0.0", "@angular-devkit/core": ">=15.0.0 < 20.0.0", + "@angular/cli": ">=15.0.0 < 20.0.0", + "@angular/common": ">=15.0.0 < 20.0.0", + "@angular/compiler": ">=15.0.0 < 20.0.0", + "@angular/compiler-cli": ">=15.0.0 < 20.0.0", + "@angular/core": ">=15.0.0 < 20.0.0", + "@angular/forms": ">=15.0.0 < 20.0.0", + "@angular/platform-browser": ">=15.0.0 < 20.0.0", + "@angular/platform-browser-dynamic": ">=15.0.0 < 20.0.0", "rxjs": "^6.0.0 || ^7.4.0", "storybook": "workspace:^", - "typescript": "^4.0.0 || ^5.0.0" + "typescript": "^4.0.0 || ^5.0.0", + "zone.js": ">= 0.11.1 < 1.0.0" + }, + "peerDependenciesMeta": { + "@angular/cli": { + "optional": true + } }, "engines": { "node": ">=18.0.0" @@ -92,7 +129,10 @@ "./src/index.ts", "./src/preset.ts", "./src/builders/build-storybook/index.ts", - "./src/builders/start-storybook/index.ts" + "./src/builders/start-storybook/index.ts", + "./src/server/framework-preset-angular-cli.ts", + "./src/server/framework-preset-angular-ivy.ts", + "./src/server/framework-preset-angular-docs.ts" ], "post": "./scripts/postbuild.js", "platform": "node" diff --git a/code/frameworks/angular/src/index.ts b/code/frameworks/angular/src/index.ts index b6d14b4eea5b..2877f331566d 100644 --- a/code/frameworks/angular/src/index.ts +++ b/code/frameworks/angular/src/index.ts @@ -1,4 +1,15 @@ // For backwarts compatibility export * from '@storybook/angular-renderer'; -export * from '@storybook/preset-angular-webpack'; export * from './types'; + +/* + * ATTENTION: + * - moduleMetadata + * - NgModuleMetadata + * - ICollection + * + * These typings are coped out of decorators.d.ts and types.d.ts in order to fix a bug with tsc + * It was imported out of dist before which was not the proper way of exporting public API + * + * This can be fixed by migrating app/angular to typescript + */ diff --git a/code/frameworks/angular/src/preset.ts b/code/frameworks/angular/src/preset.ts index e4d3f0e5f460..1182addf2afa 100644 --- a/code/frameworks/angular/src/preset.ts +++ b/code/frameworks/angular/src/preset.ts @@ -1,14 +1,23 @@ import { PresetProperty } from 'storybook/internal/types'; + import { dirname, join } from 'node:path'; -import { StorybookConfig } from './types'; const getAbsolutePath = (input: I): I => dirname(require.resolve(join(input, 'package.json'))) as any; export const addons: PresetProperty<'addons'> = [ - getAbsolutePath('@storybook/preset-angular-webpack'), + require.resolve('./server/framework-preset-angular-cli'), + require.resolve('./server/framework-preset-angular-ivy'), + require.resolve('./server/framework-preset-angular-docs'), ]; +export const typescript: PresetProperty<'typescript'> = async (config) => { + return { + ...config, + skipCompiler: true, + }; +}; + export const core: PresetProperty<'core'> = async (config, options) => { const framework = await options.presets.apply('framework'); diff --git a/code/presets/angular-webpack/src/server/__mocks-ng-workspace__/empty-projects-entry/angular.json b/code/frameworks/angular/src/server/__mocks-ng-workspace__/empty-projects-entry/angular.json similarity index 100% rename from code/presets/angular-webpack/src/server/__mocks-ng-workspace__/empty-projects-entry/angular.json rename to code/frameworks/angular/src/server/__mocks-ng-workspace__/empty-projects-entry/angular.json diff --git a/code/presets/angular-webpack/src/server/__mocks-ng-workspace__/minimal-config/angular.json b/code/frameworks/angular/src/server/__mocks-ng-workspace__/minimal-config/angular.json similarity index 100% rename from code/presets/angular-webpack/src/server/__mocks-ng-workspace__/minimal-config/angular.json rename to code/frameworks/angular/src/server/__mocks-ng-workspace__/minimal-config/angular.json diff --git a/code/presets/angular-webpack/src/server/__mocks-ng-workspace__/minimal-config/src/main.ts b/code/frameworks/angular/src/server/__mocks-ng-workspace__/minimal-config/src/main.ts similarity index 100% rename from code/presets/angular-webpack/src/server/__mocks-ng-workspace__/minimal-config/src/main.ts rename to code/frameworks/angular/src/server/__mocks-ng-workspace__/minimal-config/src/main.ts diff --git a/code/presets/angular-webpack/src/server/__mocks-ng-workspace__/minimal-config/src/tsconfig.app.json b/code/frameworks/angular/src/server/__mocks-ng-workspace__/minimal-config/src/tsconfig.app.json similarity index 100% rename from code/presets/angular-webpack/src/server/__mocks-ng-workspace__/minimal-config/src/tsconfig.app.json rename to code/frameworks/angular/src/server/__mocks-ng-workspace__/minimal-config/src/tsconfig.app.json diff --git a/code/presets/angular-webpack/src/server/__mocks-ng-workspace__/minimal-config/tsconfig.json b/code/frameworks/angular/src/server/__mocks-ng-workspace__/minimal-config/tsconfig.json similarity index 100% rename from code/presets/angular-webpack/src/server/__mocks-ng-workspace__/minimal-config/tsconfig.json rename to code/frameworks/angular/src/server/__mocks-ng-workspace__/minimal-config/tsconfig.json diff --git a/code/presets/angular-webpack/src/server/__mocks-ng-workspace__/some-config/angular.json b/code/frameworks/angular/src/server/__mocks-ng-workspace__/some-config/angular.json similarity index 100% rename from code/presets/angular-webpack/src/server/__mocks-ng-workspace__/some-config/angular.json rename to code/frameworks/angular/src/server/__mocks-ng-workspace__/some-config/angular.json diff --git a/code/presets/angular-webpack/src/server/__mocks-ng-workspace__/some-config/src/main.ts b/code/frameworks/angular/src/server/__mocks-ng-workspace__/some-config/src/main.ts similarity index 100% rename from code/presets/angular-webpack/src/server/__mocks-ng-workspace__/some-config/src/main.ts rename to code/frameworks/angular/src/server/__mocks-ng-workspace__/some-config/src/main.ts diff --git a/code/presets/angular-webpack/src/server/__mocks-ng-workspace__/some-config/src/tsconfig.app.json b/code/frameworks/angular/src/server/__mocks-ng-workspace__/some-config/src/tsconfig.app.json similarity index 100% rename from code/presets/angular-webpack/src/server/__mocks-ng-workspace__/some-config/src/tsconfig.app.json rename to code/frameworks/angular/src/server/__mocks-ng-workspace__/some-config/src/tsconfig.app.json diff --git a/code/presets/angular-webpack/src/server/__mocks-ng-workspace__/some-config/tsconfig.json b/code/frameworks/angular/src/server/__mocks-ng-workspace__/some-config/tsconfig.json similarity index 100% rename from code/presets/angular-webpack/src/server/__mocks-ng-workspace__/some-config/tsconfig.json rename to code/frameworks/angular/src/server/__mocks-ng-workspace__/some-config/tsconfig.json diff --git a/code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-angularBrowserTarget/angular.json b/code/frameworks/angular/src/server/__mocks-ng-workspace__/with-angularBrowserTarget/angular.json similarity index 100% rename from code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-angularBrowserTarget/angular.json rename to code/frameworks/angular/src/server/__mocks-ng-workspace__/with-angularBrowserTarget/angular.json diff --git a/code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/main.ts b/code/frameworks/angular/src/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/main.ts similarity index 100% rename from code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/main.ts rename to code/frameworks/angular/src/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/main.ts diff --git a/code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/styles.css b/code/frameworks/angular/src/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/styles.css similarity index 100% rename from code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/styles.css rename to code/frameworks/angular/src/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/styles.css diff --git a/code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/tsconfig.app.json b/code/frameworks/angular/src/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/tsconfig.app.json similarity index 100% rename from code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/tsconfig.app.json rename to code/frameworks/angular/src/server/__mocks-ng-workspace__/with-angularBrowserTarget/src/tsconfig.app.json diff --git a/code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-angularBrowserTarget/tsconfig.json b/code/frameworks/angular/src/server/__mocks-ng-workspace__/with-angularBrowserTarget/tsconfig.json similarity index 100% rename from code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-angularBrowserTarget/tsconfig.json rename to code/frameworks/angular/src/server/__mocks-ng-workspace__/with-angularBrowserTarget/tsconfig.json diff --git a/code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-lib/angular.json b/code/frameworks/angular/src/server/__mocks-ng-workspace__/with-lib/angular.json similarity index 100% rename from code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-lib/angular.json rename to code/frameworks/angular/src/server/__mocks-ng-workspace__/with-lib/angular.json diff --git a/code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/src/main.ts b/code/frameworks/angular/src/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/src/main.ts similarity index 100% rename from code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/src/main.ts rename to code/frameworks/angular/src/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/src/main.ts diff --git a/code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/tsconfig.lib.json b/code/frameworks/angular/src/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/tsconfig.lib.json similarity index 100% rename from code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/tsconfig.lib.json rename to code/frameworks/angular/src/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/tsconfig.lib.json diff --git a/code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-lib/tsconfig.json b/code/frameworks/angular/src/server/__mocks-ng-workspace__/with-lib/tsconfig.json similarity index 100% rename from code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-lib/tsconfig.json rename to code/frameworks/angular/src/server/__mocks-ng-workspace__/with-lib/tsconfig.json diff --git a/code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-nx-workspace/nx.json b/code/frameworks/angular/src/server/__mocks-ng-workspace__/with-nx-workspace/nx.json similarity index 100% rename from code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-nx-workspace/nx.json rename to code/frameworks/angular/src/server/__mocks-ng-workspace__/with-nx-workspace/nx.json diff --git a/code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-nx-workspace/src/main.ts b/code/frameworks/angular/src/server/__mocks-ng-workspace__/with-nx-workspace/src/main.ts similarity index 100% rename from code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-nx-workspace/src/main.ts rename to code/frameworks/angular/src/server/__mocks-ng-workspace__/with-nx-workspace/src/main.ts diff --git a/code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-nx-workspace/src/styles.css b/code/frameworks/angular/src/server/__mocks-ng-workspace__/with-nx-workspace/src/styles.css similarity index 100% rename from code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-nx-workspace/src/styles.css rename to code/frameworks/angular/src/server/__mocks-ng-workspace__/with-nx-workspace/src/styles.css diff --git a/code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-nx-workspace/src/styles.scss b/code/frameworks/angular/src/server/__mocks-ng-workspace__/with-nx-workspace/src/styles.scss similarity index 100% rename from code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-nx-workspace/src/styles.scss rename to code/frameworks/angular/src/server/__mocks-ng-workspace__/with-nx-workspace/src/styles.scss diff --git a/code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-nx-workspace/src/tsconfig.app.json b/code/frameworks/angular/src/server/__mocks-ng-workspace__/with-nx-workspace/src/tsconfig.app.json similarity index 100% rename from code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-nx-workspace/src/tsconfig.app.json rename to code/frameworks/angular/src/server/__mocks-ng-workspace__/with-nx-workspace/src/tsconfig.app.json diff --git a/code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-nx-workspace/tsconfig.json b/code/frameworks/angular/src/server/__mocks-ng-workspace__/with-nx-workspace/tsconfig.json similarity index 100% rename from code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-nx-workspace/tsconfig.json rename to code/frameworks/angular/src/server/__mocks-ng-workspace__/with-nx-workspace/tsconfig.json diff --git a/code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-nx-workspace/workspace.json b/code/frameworks/angular/src/server/__mocks-ng-workspace__/with-nx-workspace/workspace.json similarity index 100% rename from code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-nx-workspace/workspace.json rename to code/frameworks/angular/src/server/__mocks-ng-workspace__/with-nx-workspace/workspace.json diff --git a/code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-nx/angular.json b/code/frameworks/angular/src/server/__mocks-ng-workspace__/with-nx/angular.json similarity index 100% rename from code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-nx/angular.json rename to code/frameworks/angular/src/server/__mocks-ng-workspace__/with-nx/angular.json diff --git a/code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-nx/nx.json b/code/frameworks/angular/src/server/__mocks-ng-workspace__/with-nx/nx.json similarity index 100% rename from code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-nx/nx.json rename to code/frameworks/angular/src/server/__mocks-ng-workspace__/with-nx/nx.json diff --git a/code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-nx/src/main.ts b/code/frameworks/angular/src/server/__mocks-ng-workspace__/with-nx/src/main.ts similarity index 100% rename from code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-nx/src/main.ts rename to code/frameworks/angular/src/server/__mocks-ng-workspace__/with-nx/src/main.ts diff --git a/code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-nx/src/styles.css b/code/frameworks/angular/src/server/__mocks-ng-workspace__/with-nx/src/styles.css similarity index 100% rename from code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-nx/src/styles.css rename to code/frameworks/angular/src/server/__mocks-ng-workspace__/with-nx/src/styles.css diff --git a/code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-nx/src/styles.scss b/code/frameworks/angular/src/server/__mocks-ng-workspace__/with-nx/src/styles.scss similarity index 100% rename from code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-nx/src/styles.scss rename to code/frameworks/angular/src/server/__mocks-ng-workspace__/with-nx/src/styles.scss diff --git a/code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-nx/src/tsconfig.app.json b/code/frameworks/angular/src/server/__mocks-ng-workspace__/with-nx/src/tsconfig.app.json similarity index 100% rename from code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-nx/src/tsconfig.app.json rename to code/frameworks/angular/src/server/__mocks-ng-workspace__/with-nx/src/tsconfig.app.json diff --git a/code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-nx/tsconfig.json b/code/frameworks/angular/src/server/__mocks-ng-workspace__/with-nx/tsconfig.json similarity index 100% rename from code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-nx/tsconfig.json rename to code/frameworks/angular/src/server/__mocks-ng-workspace__/with-nx/tsconfig.json diff --git a/code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-options-styles/angular.json b/code/frameworks/angular/src/server/__mocks-ng-workspace__/with-options-styles/angular.json similarity index 100% rename from code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-options-styles/angular.json rename to code/frameworks/angular/src/server/__mocks-ng-workspace__/with-options-styles/angular.json diff --git a/code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-options-styles/src/main.ts b/code/frameworks/angular/src/server/__mocks-ng-workspace__/with-options-styles/src/main.ts similarity index 100% rename from code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-options-styles/src/main.ts rename to code/frameworks/angular/src/server/__mocks-ng-workspace__/with-options-styles/src/main.ts diff --git a/code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-options-styles/src/styles.css b/code/frameworks/angular/src/server/__mocks-ng-workspace__/with-options-styles/src/styles.css similarity index 100% rename from code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-options-styles/src/styles.css rename to code/frameworks/angular/src/server/__mocks-ng-workspace__/with-options-styles/src/styles.css diff --git a/code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-options-styles/src/styles.scss b/code/frameworks/angular/src/server/__mocks-ng-workspace__/with-options-styles/src/styles.scss similarity index 100% rename from code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-options-styles/src/styles.scss rename to code/frameworks/angular/src/server/__mocks-ng-workspace__/with-options-styles/src/styles.scss diff --git a/code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-options-styles/src/tsconfig.app.json b/code/frameworks/angular/src/server/__mocks-ng-workspace__/with-options-styles/src/tsconfig.app.json similarity index 100% rename from code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-options-styles/src/tsconfig.app.json rename to code/frameworks/angular/src/server/__mocks-ng-workspace__/with-options-styles/src/tsconfig.app.json diff --git a/code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-options-styles/tsconfig.json b/code/frameworks/angular/src/server/__mocks-ng-workspace__/with-options-styles/tsconfig.json similarity index 100% rename from code/presets/angular-webpack/src/server/__mocks-ng-workspace__/with-options-styles/tsconfig.json rename to code/frameworks/angular/src/server/__mocks-ng-workspace__/with-options-styles/tsconfig.json diff --git a/code/presets/angular-webpack/src/server/__mocks-ng-workspace__/without-architect-build-options/angular.json b/code/frameworks/angular/src/server/__mocks-ng-workspace__/without-architect-build-options/angular.json similarity index 100% rename from code/presets/angular-webpack/src/server/__mocks-ng-workspace__/without-architect-build-options/angular.json rename to code/frameworks/angular/src/server/__mocks-ng-workspace__/without-architect-build-options/angular.json diff --git a/code/presets/angular-webpack/src/server/__mocks-ng-workspace__/without-architect-build/angular.json b/code/frameworks/angular/src/server/__mocks-ng-workspace__/without-architect-build/angular.json similarity index 100% rename from code/presets/angular-webpack/src/server/__mocks-ng-workspace__/without-architect-build/angular.json rename to code/frameworks/angular/src/server/__mocks-ng-workspace__/without-architect-build/angular.json diff --git a/code/presets/angular-webpack/src/server/__mocks-ng-workspace__/without-compatible-projects/angular.json b/code/frameworks/angular/src/server/__mocks-ng-workspace__/without-compatible-projects/angular.json similarity index 100% rename from code/presets/angular-webpack/src/server/__mocks-ng-workspace__/without-compatible-projects/angular.json rename to code/frameworks/angular/src/server/__mocks-ng-workspace__/without-compatible-projects/angular.json diff --git a/code/presets/angular-webpack/src/server/__mocks-ng-workspace__/without-projects-entry/angular.json b/code/frameworks/angular/src/server/__mocks-ng-workspace__/without-projects-entry/angular.json similarity index 100% rename from code/presets/angular-webpack/src/server/__mocks-ng-workspace__/without-projects-entry/angular.json rename to code/frameworks/angular/src/server/__mocks-ng-workspace__/without-projects-entry/angular.json diff --git a/code/presets/angular-webpack/src/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/src/main.ts b/code/frameworks/angular/src/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/src/main.ts similarity index 100% rename from code/presets/angular-webpack/src/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/src/main.ts rename to code/frameworks/angular/src/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/src/main.ts diff --git a/code/presets/angular-webpack/src/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/tsconfig.lib.json b/code/frameworks/angular/src/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/tsconfig.lib.json similarity index 100% rename from code/presets/angular-webpack/src/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/tsconfig.lib.json rename to code/frameworks/angular/src/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/tsconfig.lib.json diff --git a/code/presets/angular-webpack/src/server/__mocks-ng-workspace__/without-projects-entry/tsconfig.json b/code/frameworks/angular/src/server/__mocks-ng-workspace__/without-projects-entry/tsconfig.json similarity index 100% rename from code/presets/angular-webpack/src/server/__mocks-ng-workspace__/without-projects-entry/tsconfig.json rename to code/frameworks/angular/src/server/__mocks-ng-workspace__/without-projects-entry/tsconfig.json diff --git a/code/presets/angular-webpack/src/server/__mocks-ng-workspace__/without-tsConfig/angular.json b/code/frameworks/angular/src/server/__mocks-ng-workspace__/without-tsConfig/angular.json similarity index 100% rename from code/presets/angular-webpack/src/server/__mocks-ng-workspace__/without-tsConfig/angular.json rename to code/frameworks/angular/src/server/__mocks-ng-workspace__/without-tsConfig/angular.json diff --git a/code/presets/angular-webpack/src/server/__mocks-ng-workspace__/without-tsConfig/src/main.ts b/code/frameworks/angular/src/server/__mocks-ng-workspace__/without-tsConfig/src/main.ts similarity index 100% rename from code/presets/angular-webpack/src/server/__mocks-ng-workspace__/without-tsConfig/src/main.ts rename to code/frameworks/angular/src/server/__mocks-ng-workspace__/without-tsConfig/src/main.ts diff --git a/code/presets/angular-webpack/src/server/__mocks-ng-workspace__/without-tsConfig/src/tsconfig.app.json b/code/frameworks/angular/src/server/__mocks-ng-workspace__/without-tsConfig/src/tsconfig.app.json similarity index 100% rename from code/presets/angular-webpack/src/server/__mocks-ng-workspace__/without-tsConfig/src/tsconfig.app.json rename to code/frameworks/angular/src/server/__mocks-ng-workspace__/without-tsConfig/src/tsconfig.app.json diff --git a/code/presets/angular-webpack/src/server/__mocks-ng-workspace__/without-tsConfig/tsconfig.json b/code/frameworks/angular/src/server/__mocks-ng-workspace__/without-tsConfig/tsconfig.json similarity index 100% rename from code/presets/angular-webpack/src/server/__mocks-ng-workspace__/without-tsConfig/tsconfig.json rename to code/frameworks/angular/src/server/__mocks-ng-workspace__/without-tsConfig/tsconfig.json diff --git a/code/presets/angular-webpack/src/server/__tests__/angular.json b/code/frameworks/angular/src/server/__tests__/angular.json similarity index 100% rename from code/presets/angular-webpack/src/server/__tests__/angular.json rename to code/frameworks/angular/src/server/__tests__/angular.json diff --git a/code/presets/angular-webpack/src/server/angular-cli-webpack.d.ts b/code/frameworks/angular/src/server/angular-cli-webpack.d.ts similarity index 100% rename from code/presets/angular-webpack/src/server/angular-cli-webpack.d.ts rename to code/frameworks/angular/src/server/angular-cli-webpack.d.ts diff --git a/code/presets/angular-webpack/src/server/angular-cli-webpack.js b/code/frameworks/angular/src/server/angular-cli-webpack.js similarity index 100% rename from code/presets/angular-webpack/src/server/angular-cli-webpack.js rename to code/frameworks/angular/src/server/angular-cli-webpack.js diff --git a/code/presets/angular-webpack/src/server/framework-preset-angular-cli.ts b/code/frameworks/angular/src/server/framework-preset-angular-cli.ts similarity index 87% rename from code/presets/angular-webpack/src/server/framework-preset-angular-cli.ts rename to code/frameworks/angular/src/server/framework-preset-angular-cli.ts index 6160e8d3960f..cd0a2012202e 100644 --- a/code/presets/angular-webpack/src/server/framework-preset-angular-cli.ts +++ b/code/frameworks/angular/src/server/framework-preset-angular-cli.ts @@ -1,18 +1,16 @@ import { logger } from 'storybook/internal/node-logger'; import { AngularLegacyBuildOptionsError } from 'storybook/internal/server-errors'; -import type { BuilderContext } from '@angular-devkit/architect'; -import { targetFromTargetString } from '@angular-devkit/architect'; -import type { JsonObject } from '@angular-devkit/core'; -import { logging } from '@angular-devkit/core'; +import { BuilderContext, targetFromTargetString } from '@angular-devkit/architect'; +import { JsonObject, logging } from '@angular-devkit/core'; import { sync as findUpSync } from 'find-up'; -import type { Configuration } from 'webpack'; +import webpack from 'webpack'; import { getWebpackConfig as getCustomWebpackConfig } from './angular-cli-webpack'; -import type { PresetOptions } from './preset-options'; +import { PresetOptions } from './preset-options'; import { moduleIsAvailable } from './utils/module-is-available'; -export const webpackFinal = async (baseConfig: Configuration, options: PresetOptions) => { +export async function webpackFinal(baseConfig: webpack.Configuration, options: PresetOptions) { if (!moduleIsAvailable('@angular-devkit/build-angular')) { logger.info('=> Using base config because "@angular-devkit/build-angular" is not installed'); return baseConfig; @@ -30,7 +28,7 @@ export const webpackFinal = async (baseConfig: Configuration, options: PresetOpt }, builderContext, }); -}; +} /** Get Builder Context If storybook is not start by angular builder create dumb BuilderContext */ function getBuilderContext(options: PresetOptions): BuilderContext { diff --git a/code/presets/angular-webpack/src/server/framework-preset-angular-docs.ts b/code/frameworks/angular/src/server/framework-preset-angular-docs.ts similarity index 67% rename from code/presets/angular-webpack/src/server/framework-preset-angular-docs.ts rename to code/frameworks/angular/src/server/framework-preset-angular-docs.ts index 39b61e24f1aa..b543a8ac8965 100644 --- a/code/presets/angular-webpack/src/server/framework-preset-angular-docs.ts +++ b/code/frameworks/angular/src/server/framework-preset-angular-docs.ts @@ -1,9 +1,7 @@ import { hasDocsOrControls } from 'storybook/internal/docs-tools'; -import type { PresetProperty } from 'storybook/internal/types'; +import { PresetProperty } from 'storybook/internal/types'; export const previewAnnotations: PresetProperty<'previewAnnotations'> = (entry = [], options) => { - if (!hasDocsOrControls(options)) { - return entry; - } + if (!hasDocsOrControls(options)) return entry; return [...entry, require.resolve('@storybook/angular-renderer/client/docs/config')]; }; diff --git a/code/presets/angular-webpack/src/server/framework-preset-angular-ivy.ts b/code/frameworks/angular/src/server/framework-preset-angular-ivy.ts similarity index 93% rename from code/presets/angular-webpack/src/server/framework-preset-angular-ivy.ts rename to code/frameworks/angular/src/server/framework-preset-angular-ivy.ts index 04bc2de619d2..57b5710e3982 100644 --- a/code/presets/angular-webpack/src/server/framework-preset-angular-ivy.ts +++ b/code/frameworks/angular/src/server/framework-preset-angular-ivy.ts @@ -1,12 +1,12 @@ import { readFileSync } from 'node:fs'; import { join } from 'node:path'; -import type { Preset } from 'storybook/internal/types'; +import { Preset } from 'storybook/internal/types'; -import type { Configuration } from 'webpack'; +import { Configuration } from 'webpack'; -import type { AngularOptions } from '../types'; -import type { PresetOptions } from './preset-options'; +import { AngularOptions } from '../types'; +import { PresetOptions } from './preset-options'; /** * Source : diff --git a/code/presets/angular-webpack/src/server/plugins/storybook-normalize-angular-entry-plugin.js b/code/frameworks/angular/src/server/plugins/storybook-normalize-angular-entry-plugin.js similarity index 100% rename from code/presets/angular-webpack/src/server/plugins/storybook-normalize-angular-entry-plugin.js rename to code/frameworks/angular/src/server/plugins/storybook-normalize-angular-entry-plugin.js diff --git a/code/presets/angular-webpack/src/server/preset-options.ts b/code/frameworks/angular/src/server/preset-options.ts similarity index 60% rename from code/presets/angular-webpack/src/server/preset-options.ts rename to code/frameworks/angular/src/server/preset-options.ts index 286b0a1857fd..4437ed5d8875 100644 --- a/code/presets/angular-webpack/src/server/preset-options.ts +++ b/code/frameworks/angular/src/server/preset-options.ts @@ -1,8 +1,8 @@ -import type { Options as CoreOptions } from 'storybook/internal/types'; +import { Options as CoreOptions } from 'storybook/internal/types'; -import type { BuilderContext } from '@angular-devkit/architect'; -import type { StylePreprocessorOptions } from '@angular-devkit/build-angular'; -import type { StyleElement } from '@angular-devkit/build-angular/src/builders/browser/schema'; +import { BuilderContext } from '@angular-devkit/architect'; +import { StylePreprocessorOptions } from '@angular-devkit/build-angular'; +import { StyleElement } from '@angular-devkit/build-angular/src/builders/browser/schema'; export type PresetOptions = CoreOptions & { /* Allow to get the options of a targeted "browser builder" */ diff --git a/code/presets/angular-webpack/src/server/utils/filter-out-styling-rules.ts b/code/frameworks/angular/src/server/utils/filter-out-styling-rules.ts similarity index 100% rename from code/presets/angular-webpack/src/server/utils/filter-out-styling-rules.ts rename to code/frameworks/angular/src/server/utils/filter-out-styling-rules.ts diff --git a/code/presets/angular-webpack/src/server/utils/module-is-available.ts b/code/frameworks/angular/src/server/utils/module-is-available.ts similarity index 100% rename from code/presets/angular-webpack/src/server/utils/module-is-available.ts rename to code/frameworks/angular/src/server/utils/module-is-available.ts diff --git a/code/frameworks/angular/src/types.ts b/code/frameworks/angular/src/types.ts index 8561765453c3..e6be5202f437 100644 --- a/code/frameworks/angular/src/types.ts +++ b/code/frameworks/angular/src/types.ts @@ -9,7 +9,6 @@ import { StorybookConfig as StorybookConfigBase, TypescriptOptions as TypescriptOptionsReact, } from '@storybook/core-webpack'; -import { AngularOptions } from '@storybook/preset-angular-webpack'; type FrameworkName = CompatibleString<'@storybook/angular'>; type BuilderName = CompatibleString<'@storybook/builder-webpack5'>; @@ -44,3 +43,8 @@ export type StorybookConfig = Omit< > & StorybookConfigWebpack & StorybookConfigFramework; + +export interface AngularOptions { + enableIvy?: boolean; + enableNgcc?: boolean; +} diff --git a/code/package.json b/code/package.json index 5fa1285de05d..c673b9d0bec9 100644 --- a/code/package.json +++ b/code/package.json @@ -139,7 +139,6 @@ "@storybook/preact": "workspace:*", "@storybook/preact-vite": "workspace:*", "@storybook/preact-webpack5": "workspace:*", - "@storybook/preset-angular-webpack": "workspace:*", "@storybook/preset-create-react-app": "workspace:*", "@storybook/preset-html-webpack": "workspace:*", "@storybook/preset-preact-webpack": "workspace:*", @@ -201,6 +200,7 @@ "happy-dom": "^14.12.0", "http-server": "^14.1.1", "husky": "^4.3.7", + "jiti": "^2.4.1", "lint-staged": "^13.2.2", "mock-require": "^3.0.3", "nx": "18.0.6", diff --git a/code/presets/angular-webpack/README.md b/code/presets/angular-webpack/README.md deleted file mode 100644 index 3fc39cf39603..000000000000 --- a/code/presets/angular-webpack/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# Storybook Webpack preset for Angular - -This package is a [preset](https://storybook.js.org/docs/addons/writing-presets?renderer=react) that configures Storybook's webpack settings for handling React. -It's an internal package that's not intended to be used directly by users. - -- More info on [Storybook for React](https://storybook.js.org/docs/get-started/install?renderer=react) diff --git a/code/presets/angular-webpack/package.json b/code/presets/angular-webpack/package.json deleted file mode 100644 index 6913c576db62..000000000000 --- a/code/presets/angular-webpack/package.json +++ /dev/null @@ -1,131 +0,0 @@ -{ - "name": "@storybook/preset-angular-webpack", - "version": "8.5.0-alpha.11", - "description": "Storybook for Angular: Develop Angular Component in isolation with Hot Reloading", - "keywords": [ - "storybook" - ], - "homepage": "https://github.com/storybookjs/storybook/tree/next/code/presets/angular-webpack", - "bugs": { - "url": "https://github.com/storybookjs/storybook/issues" - }, - "repository": { - "type": "git", - "url": "https://github.com/storybookjs/storybook.git", - "directory": "code/presets/angular-webpack" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/storybook" - }, - "license": "MIT", - "exports": { - ".": { - "types": "./dist/index.d.ts", - "node": "./dist/index.js", - "import": "./dist/index.mjs", - "require": "./dist/index.js" - }, - "./preset": { - "types": "./dist/index.d.ts", - "node": "./dist/index.js", - "import": "./dist/index.mjs", - "require": "./dist/index.js" - }, - "./dist/server/framework-preset-angular-cli": { - "types": "./dist/server/framework-preset-angular-cli.d.ts", - "import": "./dist/server/framework-preset-angular-cli.mjs", - "require": "./dist/server/framework-preset-angular-cli.js" - }, - "./dist/server/framework-preset-angular-docs": { - "types": "./dist/server/framework-preset-angular-docs.d.ts", - "import": "./dist/server/framework-preset-angular-docs.mjs", - "require": "./dist/server/framework-preset-angular-docs.js" - }, - "./dist/server/framework-preset-angular-ivy": { - "types": "./dist/server/framework-preset-angular-ivy.d.ts", - "import": "./dist/server/framework-preset-angular-ivy.mjs", - "require": "./dist/server/framework-preset-angular-ivy.js" - }, - "./package.json": "./package.json" - }, - "main": "dist/index.js", - "module": "dist/index.mjs", - "types": "dist/index.d.ts", - "files": [ - "dist/**/*", - "README.md", - "*.js", - "*.d.ts", - "!src/**/*" - ], - "scripts": { - "check": "jiti ../../../scripts/prepare/check.ts", - "prep": "jiti ../../../scripts/prepare/bundle.ts" - }, - "dependencies": { - "@storybook/angular-renderer": "workspace:*", - "@storybook/core-webpack": "workspace:*", - "@types/node": "^22.0.0", - "@types/semver": "^7.3.4", - "find-up": "^5.0.0", - "resolve": "^1.22.8", - "semver": "^7.3.7", - "tsconfig-paths": "^4.2.0", - "tsconfig-paths-webpack-plugin": "^4.0.1", - "webpack": "5" - }, - "devDependencies": { - "@angular-devkit/architect": "^0.1703.0", - "@angular-devkit/build-angular": "^17.3.0", - "@angular-devkit/core": "^17.3.0", - "@angular/animations": "^17.3.0", - "@angular/cli": "^17.3.0", - "@angular/common": "^17.3.0", - "@angular/compiler": "^17.3.0", - "@angular/compiler-cli": "^17.3.0", - "@angular/core": "^17.3.0", - "@angular/forms": "^17.3.0", - "@angular/platform-browser": "^17.3.0", - "@angular/platform-browser-dynamic": "^17.3.0", - "typescript": "^5.3.2" - }, - "peerDependencies": { - "@angular-devkit/architect": ">=0.1500.0 < 0.2000.0", - "@angular-devkit/build-angular": ">=15.0.0 < 20.0.0", - "@angular-devkit/core": ">=15.0.0 < 20.0.0", - "@angular/cli": ">=15.0.0 < 20.0.0", - "@angular/common": ">=15.0.0 < 20.0.0", - "@angular/compiler": ">=15.0.0 < 20.0.0", - "@angular/compiler-cli": ">=15.0.0 < 20.0.0", - "@angular/core": ">=15.0.0 < 20.0.0", - "@angular/forms": ">=15.0.0 < 20.0.0", - "@angular/platform-browser": ">=15.0.0 < 20.0.0", - "@angular/platform-browser-dynamic": ">=15.0.0 < 20.0.0", - "rxjs": "^6.0.0 || ^7.4.0", - "storybook": "workspace:^", - "typescript": "^4.0.0 || ^5.0.0", - "zone.js": ">= 0.11.1 < 1.0.0" - }, - "peerDependenciesMeta": { - "typescript": { - "optional": true - } - }, - "engines": { - "node": ">=18.0.0" - }, - "publishConfig": { - "access": "public" - }, - "bundler": { - "entries": [ - "./src/index.ts", - "./src/server/framework-preset-angular-cli.ts", - "./src/server/framework-preset-angular-ivy.ts", - "./src/server/framework-preset-angular-docs.ts" - ], - "platform": "node" - }, - "gitHead": "e6a7fd8a655c69780bc20b9749c2699e44beae16" -} diff --git a/code/presets/angular-webpack/preset.js b/code/presets/angular-webpack/preset.js deleted file mode 100644 index f4f0e998846b..000000000000 --- a/code/presets/angular-webpack/preset.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./dist/index'); diff --git a/code/presets/angular-webpack/project.json b/code/presets/angular-webpack/project.json deleted file mode 100644 index 0e05df249ad3..000000000000 --- a/code/presets/angular-webpack/project.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "angular-webpack", - "$schema": "../../node_modules/nx/schemas/project-schema.json", - "projectType": "library", - "targets": { - "build": {} - } -} diff --git a/code/presets/angular-webpack/src/index.ts b/code/presets/angular-webpack/src/index.ts deleted file mode 100644 index 8b0869e00ae5..000000000000 --- a/code/presets/angular-webpack/src/index.ts +++ /dev/null @@ -1,9 +0,0 @@ -import type { PresetProperty } from 'storybook/internal/types'; - -export * from './types'; - -export const addons: PresetProperty<'addons'> = [ - require.resolve('@storybook/preset-angular-webpack/dist/server/framework-preset-angular-cli'), - require.resolve('@storybook/preset-angular-webpack/dist/server/framework-preset-angular-ivy'), - require.resolve('@storybook/preset-angular-webpack/dist/server/framework-preset-angular-docs'), -]; diff --git a/code/presets/angular-webpack/src/types.ts b/code/presets/angular-webpack/src/types.ts deleted file mode 100644 index 2e2601711f59..000000000000 --- a/code/presets/angular-webpack/src/types.ts +++ /dev/null @@ -1,4 +0,0 @@ -export interface AngularOptions { - enableIvy?: boolean; - enableNgcc?: boolean; -} diff --git a/code/presets/angular-webpack/tsconfig.json b/code/presets/angular-webpack/tsconfig.json deleted file mode 100644 index 73a65ef2ef6e..000000000000 --- a/code/presets/angular-webpack/tsconfig.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": {}, - "include": ["src/**/*"] -} diff --git a/code/yarn.lock b/code/yarn.lock index 936a2e10bf44..f429b09e5dfc 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -6996,15 +6996,29 @@ __metadata: "@angular/platform-browser-dynamic": "npm:^17.3.0" "@storybook/angular-renderer": "workspace:*" "@storybook/core-webpack": "workspace:*" + "@storybook/global": "npm:^5.0.0" + "@storybook/manager-api": "workspace:*" + "@storybook/preview-api": "workspace:*" + "@storybook/theming": "workspace:*" + "@types/cross-spawn": "npm:^6.0.2" "@types/node": "npm:^22.0.0" + "@types/react": "npm:^18.0.37" + "@types/react-dom": "npm:^18.0.11" "@types/semver": "npm:^7.3.4" + "@types/tmp": "npm:^0.2.3" + "@types/webpack-env": "npm:^1.18.0" + cross-spawn: "npm:^7.0.3" + fd-package-json: "npm:^1.2.0" find-up: "npm:^5.0.0" - resolve: "npm:^1.22.8" semver: "npm:^7.3.7" - tsconfig-paths: "npm:^4.2.0" + telejson: "npm:^7.2.0" + tmp: "npm:^0.2.1" + ts-dedent: "npm:^2.0.0" tsconfig-paths-webpack-plugin: "npm:^4.0.1" typescript: "npm:^5.3.2" + util-deprecate: "npm:^1.0.2" webpack: "npm:5" + zone.js: "npm:^0.14.2" peerDependencies: "@angular-devkit/architect": ">=0.1500.0 < 0.2000.0" "@angular-devkit/build-angular": ">=15.0.0 < 20.0.0" @@ -7429,6 +7443,7 @@ __metadata: happy-dom: "npm:^14.12.0" http-server: "npm:^14.1.1" husky: "npm:^4.3.7" + jiti: "npm:^2.4.1" lint-staged: "npm:^13.2.2" mock-require: "npm:^3.0.3" nx: "npm:18.0.6" @@ -18986,6 +19001,15 @@ __metadata: languageName: node linkType: hard +"jiti@npm:^2.4.1": + version: 2.4.1 + resolution: "jiti@npm:2.4.1" + bin: + jiti: lib/jiti-cli.mjs + checksum: 10c0/3cf67d1b952a9e8cffbb4f96527880da6cdb58a1eae2a6d2deb4645621dfc8b766d21549f71c6153a2094a40bb635ffafed4cd0dd42f3b3263b187d1ee846225 + languageName: node + linkType: hard + "jju@npm:^1.4.0": version: 1.4.0 resolution: "jju@npm:1.4.0"