Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
ddf43fc
Have the angular framework be bundled by TSup
ndelangen Jun 6, 2025
d3375d8
Merge branch 'next' into norbert/angular-bundled
ndelangen Jun 6, 2025
060f355
cleanup
ndelangen Jun 6, 2025
b3b741b
bundle in core-webpack
ndelangen Jun 6, 2025
9d8ee0b
make import of types with type directive
ndelangen Jun 6, 2025
9952d34
no more webpack-env
ndelangen Jun 6, 2025
864df58
fix type check
ndelangen Jun 6, 2025
f6b3b87
Update previewProd path resolution in Angular preset to use getAbsolu…
ndelangen Jun 6, 2025
67e62fb
Fix ElementRef import in doc-directive.directive.ts to ensure proper …
ndelangen Jun 6, 2025
be821f2
Fix ElementRef imports in multiple components to ensure proper depend…
ndelangen Jun 6, 2025
6082fe8
Enhance dependency injection in di.component.ts by adding missing Inj…
ndelangen Jun 6, 2025
bc20ea3
Merge branch 'next' into norbert/angular-bundled
ndelangen Jun 10, 2025
e515e1e
Merge branch 'next' into norbert/angular-bundled
ndelangen Jun 10, 2025
ff80503
Refactor import statement for DomSanitizer in html.component.ts to co…
ndelangen Jun 10, 2025
32ad973
Merge branch 'next' into norbert/angular-bundled
ndelangen Jun 10, 2025
b28d212
Refactor import statements in Angular components to ensure proper dep…
ndelangen Jun 10, 2025
6810f6a
Merge branch 'next' into norbert/angular-bundled
ndelangen Jun 10, 2025
c0b0e86
Merge branch 'next' into norbert/angular-bundled
ndelangen Jun 11, 2025
5135c20
Merge branch 'next' into norbert/angular-bundled
ndelangen Jun 11, 2025
eef4990
Merge branch 'next' into norbert/angular-bundled
ndelangen Jun 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions code/frameworks/angular/.eslintrc.json

This file was deleted.

14 changes: 14 additions & 0 deletions code/frameworks/angular/builders.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"builders": {
"build-storybook": {
"implementation": "./dist/builders/build-storybook",
"schema": "./build-schema.json",
"description": "Build storybook"
},
"start-storybook": {
"implementation": "./dist/builders/start-storybook",
"schema": "./start-schema.json",
"description": "Start storybook"
}
}
}
65 changes: 56 additions & 9 deletions code/frameworks/angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,23 @@
"require": "./dist/index.js"
},
"./preset": "./preset.js",
"./server/framework-preset-angular-ivy": "./server/framework-preset-angular-ivy.js",
"./server/framework-preset-angular-cli": "./server/framework-preset-angular-cli.js",
"./client/config": {
"types": "./dist/client/config.d.ts",
"import": "./dist/client/config.mjs",
"require": "./dist/client/config.js"
},
"./client/preview-prod": {
"types": "./dist/client/preview-prod.d.ts",
"import": "./dist/client/preview-prod.mjs",
"require": "./dist/client/preview-prod.js"
},
"./client/docs/config": {
"types": "./dist/client/docs/config.d.ts",
"import": "./dist/client/docs/config.mjs",
"require": "./dist/client/docs/config.js"
},
"./node": {
"types": "./dist/node/index.d.ts",
"import": "./dist/node/index.js",
Expand All @@ -38,7 +55,26 @@
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"typesVersions": {
"*": {
"*": [
"dist/index.d.ts"
],
"client/config": [
"dist/client/config.d.ts"
],
"client/preview-prod": [
"dist/client/preview-prod.d.ts"
],
"client/docs/config": [
"dist/client/docs/config.d.ts"
]
}
},
"files": [
"builders.json",
"build-schema.json",
"start-schema.json",
"dist/**/*",
"template/cli/**/*",
"README.md",
Expand All @@ -48,16 +84,12 @@
"!src/**/*"
],
"scripts": {
"check": "yarn run -T tsc",
"prep": "rimraf dist && jiti ../../../scripts/prepare/tsc.ts"
"check": "jiti ../../../scripts/prepare/check.ts",
"prep": "jiti ../../../scripts/prepare/addon-bundle.ts"
Comment on lines +87 to +88

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for future reference, this is the main change

Comment thread
ndelangen marked this conversation as resolved.
},
"dependencies": {
"@storybook/builder-webpack5": "workspace:*",
"@storybook/core-webpack": "workspace:*",
"@storybook/global": "^5.0.0",
"@types/webpack-env": "^1.18.0",
"fd-package-json": "^1.2.0",
"find-up": "^7.0.0",
"telejson": "8.0.0",
"ts-dedent": "^2.0.0",
"tsconfig-paths-webpack-plugin": "^4.0.1",
Expand All @@ -76,7 +108,10 @@
"@angular/forms": "^19.1.1",
"@angular/platform-browser": "^19.1.1",
"@angular/platform-browser-dynamic": "^19.1.1",
"@storybook/core-webpack": "workspace:*",
"@types/node": "^22.0.0",
"fd-package-json": "^1.2.0",
"find-up": "^7.0.0",
"rimraf": "^6.0.1",
"typescript": "^5.8.3",
"webpack": "5",
Expand Down Expand Up @@ -117,10 +152,22 @@
"publishConfig": {
"access": "public"
},
"builders": "dist/builders/builders.json",
"builders": "builders.json",
"bundler": {
"post": "./scripts/postbuild.js",
"tsConfig": "tsconfig.build.json"
"previewEntries": [
"./src/index.ts",
"./src/client/index.ts",
"./src/client/config.ts",
"./src/client/preview-prod.ts",
"./src/client/docs/config.ts"
],
"nodeEntries": [
"./src/preset.ts",
"./src/server/framework-preset-angular-ivy.ts",
"./src/server/framework-preset-angular-cli.ts",
"./src/builders/start-storybook/index.ts",
"./src/builders/build-storybook/index.ts"
]
},
"gitHead": "e6a7fd8a655c69780bc20b9749c2699e44beae16"
}
17 changes: 0 additions & 17 deletions code/frameworks/angular/scripts/postbuild.js

This file was deleted.

18 changes: 10 additions & 8 deletions code/frameworks/angular/src/builders/build-storybook/index.ts
Original file line number Diff line number Diff line change
@@ -1,33 +1,35 @@
import { getEnvConfig, getProjectRoot, versions } from 'storybook/internal/common';
import { buildStaticStandalone, withTelemetry } from 'storybook/internal/core-server';
import { addToGlobalContext } from 'storybook/internal/telemetry';
import { CLIOptions } from 'storybook/internal/types';
import type { CLIOptions } from 'storybook/internal/types';

import {
import type {
BuilderContext,
BuilderHandlerFn,
BuilderOutput,
BuilderOutputLike,
Target,
createBuilder,
targetFromTargetString,
Builder as DevkitBuilder,
} from '@angular-devkit/architect';
import { BrowserBuilderOptions, StylePreprocessorOptions } from '@angular-devkit/build-angular';
import {
import { createBuilder, targetFromTargetString } from '@angular-devkit/architect';
import type {
BrowserBuilderOptions,
StylePreprocessorOptions,
} from '@angular-devkit/build-angular';
import type {
AssetPattern,
SourceMapUnion,
StyleElement,
} from '@angular-devkit/build-angular/src/builders/browser/schema';
import { JsonObject } from '@angular-devkit/core';
import type { JsonObject } from '@angular-devkit/core';
import { findPackageSync } from 'fd-package-json';
import { findUpSync } from 'find-up';
import { from, of, throwError } from 'rxjs';
import { catchError, map, mapTo, switchMap } from 'rxjs/operators';

import { errorSummary, printErrorDetails } from '../utils/error-handler';
import { runCompodoc } from '../utils/run-compodoc';
import { StandaloneOptions } from '../utils/standalone-options';
import type { StandaloneOptions } from '../utils/standalone-options';

addToGlobalContext('cliVersion', versions.storybook);

Expand Down
14 changes: 0 additions & 14 deletions code/frameworks/angular/src/builders/builders.json

This file was deleted.

18 changes: 10 additions & 8 deletions code/frameworks/angular/src/builders/start-storybook/index.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,34 @@
import { getEnvConfig, getProjectRoot, versions } from 'storybook/internal/common';
import { buildDevStandalone, withTelemetry } from 'storybook/internal/core-server';
import { addToGlobalContext } from 'storybook/internal/telemetry';
import { CLIOptions } from 'storybook/internal/types';
import type { CLIOptions } from 'storybook/internal/types';

import {
import type {
BuilderContext,
BuilderHandlerFn,
BuilderOutput,
Target,
createBuilder,
targetFromTargetString,
Builder as DevkitBuilder,
} from '@angular-devkit/architect';
import { BrowserBuilderOptions, StylePreprocessorOptions } from '@angular-devkit/build-angular';
import {
import { createBuilder, targetFromTargetString } from '@angular-devkit/architect';
import type {
BrowserBuilderOptions,
StylePreprocessorOptions,
} from '@angular-devkit/build-angular';
import type {
AssetPattern,
SourceMapUnion,
StyleElement,
} from '@angular-devkit/build-angular/src/builders/browser/schema';
import { JsonObject } from '@angular-devkit/core';
import type { JsonObject } from '@angular-devkit/core';
import { findPackageSync } from 'fd-package-json';
import { findUpSync } from 'find-up';
import { Observable, from, of } from 'rxjs';
import { map, mapTo, switchMap } from 'rxjs/operators';

import { errorSummary, printErrorDetails } from '../utils/error-handler';
import { runCompodoc } from '../utils/run-compodoc';
import { StandaloneOptions } from '../utils/standalone-options';
import type { StandaloneOptions } from '../utils/standalone-options';

addToGlobalContext('cliVersion', versions.storybook);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { BuilderContext } from '@angular-devkit/architect';
import type { BuilderContext } from '@angular-devkit/architect';
// @ts-expect-error (TODO)
import { LoggerApi } from '@angular-devkit/core/src/logger';
import type { LoggerApi } from '@angular-devkit/core/src/logger';
import { take } from 'rxjs/operators';
import { afterEach, describe, expect, it, vi } from 'vitest';

Expand Down
2 changes: 1 addition & 1 deletion code/frameworks/angular/src/builders/utils/run-compodoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { isAbsolute, relative } from 'node:path';

import { JsPackageManagerFactory } from 'storybook/internal/common';

import { BuilderContext } from '@angular-devkit/architect';
import type { BuilderContext } from '@angular-devkit/architect';
import { Observable } from 'rxjs';

const hasTsConfigArg = (args: string[]) => args.indexOf('-p') !== -1;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { BuilderOptions, CLIOptions, LoadOptions } from 'storybook/internal/types';
import type { BuilderOptions, CLIOptions, LoadOptions } from 'storybook/internal/types';

import { BuilderContext } from '@angular-devkit/architect';
import {
import type { BuilderContext } from '@angular-devkit/architect';
import type {
AssetPattern,
SourceMapUnion,
StyleElement,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { ApplicationRef, NgModule } from '@angular/core';
import type { ApplicationRef, NgModule } from '@angular/core';
import { bootstrapApplication } from '@angular/platform-browser';
import { BehaviorSubject, Subject } from 'rxjs';
import type { Subject } from 'rxjs';
import { BehaviorSubject } from 'rxjs';
import { stringify } from 'telejson';

import { ICollection, StoryFnAngularReturnType } from '../types';
import type { ICollection, StoryFnAngularReturnType } from '../types';
import { getApplication } from './StorybookModule';
import { storyPropsProvider } from './StorybookProvider';
import { queueBootstrapping } from './utils/BootstrapQueue';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Parameters, StoryFnAngularReturnType } from '../types';
import type { Parameters, StoryFnAngularReturnType } from '../types';
import { AbstractRenderer } from './AbstractRenderer';

export class CanvasRenderer extends AbstractRenderer {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { Component } from '@angular/core';
import { ArgTypes } from 'storybook/internal/types';
import type { ArgTypes } from 'storybook/internal/types';
import { describe, it, expect } from 'vitest';
import {
computesTemplateFromComponent,
computesTemplateSourceFromComponent,
} from './ComputesTemplateFromComponent';
import { ISomeInterface, ButtonAccent, InputComponent } from './__testfixtures__/input.component';
import type { ISomeInterface } from './__testfixtures__/input.component';
import { ButtonAccent, InputComponent } from './__testfixtures__/input.component';

describe('angular template decorator', () => {
it('with props should generate tag with properties', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { ArgTypes } from 'storybook/internal/types';
import type { ArgTypes } from 'storybook/internal/types';

import { Type } from '@angular/core';
import type { Type } from '@angular/core';

import { ICollection } from '../types';
import type { ICollection } from '../types';
import type { ComponentInputsOutputs } from './utils/NgComponentAnalyzer';
import {
ComponentInputsOutputs,
getComponentDecoratorMetadata,
getComponentInputsOutputs,
} from './utils/NgComponentAnalyzer';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { DOCS_RENDERED, STORY_CHANGED } from 'storybook/internal/core-events';
import { addons } from 'storybook/preview-api';

import { Parameters, StoryFnAngularReturnType } from '../types';
import type { Parameters, StoryFnAngularReturnType } from '../types';
import { AbstractRenderer, STORY_UID_ATTRIBUTE } from './AbstractRenderer';
import { getNextStoryUID } from './utils/StoryUID';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// @vitest-environment happy-dom

import { NgModule, Component, EventEmitter, Input, Output } from '@angular/core';
import type { NgModule } from '@angular/core';
import { Component, EventEmitter, Input, Output } from '@angular/core';
import { describe, expect, it } from 'vitest';

import { TestBed } from '@angular/core/testing';
import { BehaviorSubject } from 'rxjs';
import { ICollection } from '../types';
import type { ICollection } from '../types';
import { getApplication } from './StorybookModule';
import { storyPropsProvider } from './StorybookProvider';
import { PropertyExtractor } from './utils/PropertyExtractor';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { StoryFnAngularReturnType } from '../types';
import type { StoryFnAngularReturnType } from '../types';
import { computesTemplateFromComponent } from './ComputesTemplateFromComponent';
import { createStorybookWrapperComponent } from './StorybookWrapperComponent';
import { PropertyExtractor } from './utils/PropertyExtractor';
import type { PropertyExtractor } from './utils/PropertyExtractor';

export const getApplication = ({
storyFnAngular,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { InjectionToken, NgZone, Provider } from '@angular/core';
import { Observable, Subject, Subscriber } from 'rxjs';
import type { Provider } from '@angular/core';
import { InjectionToken, NgZone } from '@angular/core';
import type { Subject, Subscriber } from 'rxjs';
import { Observable } from 'rxjs';

import { ICollection } from '../types';
import type { ICollection } from '../types';

export const STORY_PROPS = new InjectionToken<Subject<ICollection | undefined>>('STORY_PROPS');

Expand Down
Loading