Skip to content

Commit

Permalink
Merge pull request #24466 from storybookjs/valentin/angular-add-sourc…
Browse files Browse the repository at this point in the history
…e-map-support

Angular: Add source-map option to builder
  • Loading branch information
valentinpalkovic authored Oct 19, 2023
2 parents a5a7747 + 8fdfcf9 commit d996aaf
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions code/frameworks/angular/src/builders/build-storybook/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { addToGlobalContext } from '@storybook/telemetry';
import { buildStaticStandalone, withTelemetry } from '@storybook/core-server';
import {
AssetPattern,
SourceMapUnion,
StyleElement,
} from '@angular-devkit/build-angular/src/builders/browser/schema';
import { StandaloneOptions } from '../utils/standalone-options';
Expand All @@ -39,6 +40,7 @@ export type StorybookBuilderOptions = JsonObject & {
styles?: StyleElement[];
stylePreprocessorOptions?: StylePreprocessorOptions;
assets?: AssetPattern[];
sourceMap?: SourceMapUnion;
} & Pick<
// makes sure the option exists
CLIOptions,
Expand Down Expand Up @@ -92,6 +94,7 @@ const commandBuilder: BuilderHandlerFn<StorybookBuilderOptions> = (
disableTelemetry,
assets,
previewUrl,
sourceMap = false,
} = options;

const standaloneOptions: StandaloneBuildOptions = {
Expand All @@ -109,6 +112,7 @@ const commandBuilder: BuilderHandlerFn<StorybookBuilderOptions> = (
...(stylePreprocessorOptions ? { stylePreprocessorOptions } : {}),
...(styles ? { styles } : {}),
...(assets ? { assets } : {}),
sourceMap,
},
tsConfig,
webpackStatsJson,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@
"items": {
"$ref": "#/definitions/assetPattern"
}
},
"sourceMap": {
"type": ["boolean", "object"],
"description": "Configure sourcemaps. See: https://angular.io/guide/workspace-config#source-map-configuration",
"default": false
}
},
"additionalProperties": false,
Expand Down
4 changes: 4 additions & 0 deletions code/frameworks/angular/src/builders/start-storybook/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { addToGlobalContext } from '@storybook/telemetry';
import { buildDevStandalone, withTelemetry } from '@storybook/core-server';
import {
AssetPattern,
SourceMapUnion,
StyleElement,
} from '@angular-devkit/build-angular/src/builders/browser/schema';
import { StandaloneOptions } from '../utils/standalone-options';
Expand All @@ -36,6 +37,7 @@ export type StorybookBuilderOptions = JsonObject & {
styles?: StyleElement[];
stylePreprocessorOptions?: StylePreprocessorOptions;
assets?: AssetPattern[];
sourceMap?: SourceMapUnion;
} & Pick<
// makes sure the option exists
CLIOptions,
Expand Down Expand Up @@ -111,6 +113,7 @@ const commandBuilder: BuilderHandlerFn<StorybookBuilderOptions> = (options, cont
loglevel,
webpackStatsJson,
previewUrl,
sourceMap = false,
} = options;

const standaloneOptions: StandaloneOptions = {
Expand All @@ -134,6 +137,7 @@ const commandBuilder: BuilderHandlerFn<StorybookBuilderOptions> = (options, cont
...(stylePreprocessorOptions ? { stylePreprocessorOptions } : {}),
...(styles ? { styles } : {}),
...(assets ? { assets } : {}),
sourceMap,
},
tsConfig,
initialPath,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,11 @@
"type": "string",
"description": "Controls level of logging during build. Can be one of: [silly, verbose, info (default), warn, error, silent].",
"pattern": "(silly|verbose|info|warn|silent)"
},
"sourceMap": {
"type": ["boolean", "object"],
"description": "Configure sourcemaps. See: https://angular.io/guide/workspace-config#source-map-configuration",
"default": false
}
},
"additionalProperties": false,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { BuilderContext } from '@angular-devkit/architect';
import {
AssetPattern,
SourceMapUnion,
StyleElement,
StylePreprocessorOptions,
} from '@angular-devkit/build-angular/src/builders/browser/schema';
Expand All @@ -16,6 +17,7 @@ export type StandaloneOptions = CLIOptions &
styles?: StyleElement[];
stylePreprocessorOptions?: StylePreprocessorOptions;
assets?: AssetPattern[];
sourceMap?: SourceMapUnion;
};
angularBuilderContext?: BuilderContext | null;
tsConfig?: string;
Expand Down

0 comments on commit d996aaf

Please sign in to comment.