@storybook/angular 6.4.0-alpha.32 → 6.4.0-alpha.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ts3.4/builders/build-storybook/index.d.ts +2 -1
- package/dist/ts3.4/builders/start-storybook/index.d.ts +2 -1
- package/dist/ts3.4/client/preview/angular/helpers.d.ts +3 -3
- package/dist/ts3.4/client/preview/angular-beta/AbstractRenderer.d.ts +3 -1
- package/dist/ts3.4/client/preview/angular-beta/CanvasRenderer.d.ts +1 -0
- package/dist/ts3.4/client/preview/angular-beta/DocsRenderer.d.ts +1 -0
- package/dist/ts3.4/client/preview/angular-beta/ElementRendererService.d.ts +2 -1
- package/dist/ts3.4/client/preview/angular-beta/RendererService.d.ts +3 -2
- package/dist/ts3.4/client/preview/angular-beta/StorybookModule.d.ts +2 -3
- package/dist/ts3.4/client/preview/config.d.ts +4 -0
- package/dist/ts3.4/client/preview/decorateStory.d.ts +3 -3
- package/dist/ts3.4/client/preview/decorators.d.ts +5 -4
- package/dist/ts3.4/client/preview/index.d.ts +3 -2
- package/dist/ts3.4/client/preview/render.d.ts +5 -11
- package/dist/ts3.4/client/preview/types-6-0.d.ts +9 -8
- package/dist/ts3.4/client/preview/types.d.ts +1 -1
- package/dist/ts3.4/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/src/main.d.ts +1 -0
- package/dist/ts3.4/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/src/main.d.ts +1 -0
- package/dist/ts3.4/server/__mocks-ng-workspace__/without-tsConfig/src/main.d.ts +1 -0
- package/dist/ts3.4/server/framework-preset-angular-cli.d.ts +1 -0
- package/dist/ts3.9/builders/build-storybook/index.d.ts +2 -1
- package/dist/ts3.9/builders/build-storybook/index.js +33 -15
- package/dist/ts3.9/builders/build-storybook/schema.json +14 -2
- package/dist/ts3.9/builders/start-storybook/index.d.ts +2 -1
- package/dist/ts3.9/builders/start-storybook/index.js +33 -15
- package/dist/ts3.9/builders/start-storybook/schema.json +14 -2
- package/dist/ts3.9/client/preview/angular/helpers.d.ts +3 -3
- package/dist/ts3.9/client/preview/angular-beta/AbstractRenderer.d.ts +3 -1
- package/dist/ts3.9/client/preview/angular-beta/AbstractRenderer.js +3 -2
- package/dist/ts3.9/client/preview/angular-beta/CanvasRenderer.d.ts +1 -0
- package/dist/ts3.9/client/preview/angular-beta/DocsRenderer.d.ts +1 -0
- package/dist/ts3.9/client/preview/angular-beta/ElementRendererService.d.ts +2 -1
- package/dist/ts3.9/client/preview/angular-beta/ElementRendererService.js +2 -2
- package/dist/ts3.9/client/preview/angular-beta/RendererService.d.ts +3 -2
- package/dist/ts3.9/client/preview/angular-beta/RendererService.js +3 -3
- package/dist/ts3.9/client/preview/angular-beta/StorybookModule.d.ts +2 -3
- package/dist/ts3.9/client/preview/angular-beta/StorybookModule.js +2 -2
- package/dist/ts3.9/client/preview/config.d.ts +4 -0
- package/dist/ts3.9/client/preview/config.js +7 -0
- package/dist/ts3.9/client/preview/decorateStory.d.ts +3 -3
- package/dist/ts3.9/client/preview/decorateStory.js +4 -26
- package/dist/ts3.9/client/preview/decorators.d.ts +5 -4
- package/dist/ts3.9/client/preview/index.d.ts +3 -2
- package/dist/ts3.9/client/preview/index.js +3 -5
- package/dist/ts3.9/client/preview/render.d.ts +5 -11
- package/dist/ts3.9/client/preview/render.js +10 -9
- package/dist/ts3.9/client/preview/types-6-0.d.ts +9 -8
- package/dist/ts3.9/client/preview/types.d.ts +1 -1
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-lib/angular.json +28 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/src/main.d.ts +1 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/src/main.js +5 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-lib/projects/pattern-lib/tsconfig.lib.json +25 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/with-lib/tsconfig.json +13 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/src/main.d.ts +1 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/src/main.js +5 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/without-projects-entry/projects/pattern-lib/tsconfig.lib.json +25 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/without-projects-entry/tsconfig.json +13 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/without-tsConfig/angular.json +16 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/without-tsConfig/src/main.d.ts +1 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/without-tsConfig/src/main.js +5 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/without-tsConfig/src/tsconfig.app.json +9 -0
- package/dist/ts3.9/server/__mocks-ng-workspace__/without-tsConfig/tsconfig.json +13 -0
- package/dist/ts3.9/server/angular-devkit-build-webpack.js +2 -2
- package/dist/ts3.9/server/framework-preset-angular-cli.d.ts +1 -0
- package/dist/ts3.9/server/framework-preset-angular-cli.js +20 -11
- package/package.json +11 -9
- package/preset.js +7 -0
- package/standalone.d.ts +2 -1
|
@@ -2,7 +2,8 @@ import { BuilderOutput } from '@angular-devkit/architect';
|
|
|
2
2
|
import { JsonObject } from '@angular-devkit/core';
|
|
3
3
|
import { CLIOptions } from '@storybook/core-common';
|
|
4
4
|
export declare type StorybookBuilderOptions = JsonObject & {
|
|
5
|
-
browserTarget
|
|
5
|
+
browserTarget?: string | null;
|
|
6
|
+
tsConfig?: string;
|
|
6
7
|
compodoc: boolean;
|
|
7
8
|
compodocArgs: string[];
|
|
8
9
|
} & Pick<CLIOptions, 'staticDir' | 'outputDir' | 'configDir' | 'loglevel' | 'quiet' | 'docs'>;
|
|
@@ -2,7 +2,8 @@ import { BuilderOutput } from '@angular-devkit/architect';
|
|
|
2
2
|
import { JsonObject } from '@angular-devkit/core';
|
|
3
3
|
import { CLIOptions } from '@storybook/core-common';
|
|
4
4
|
export declare type StorybookBuilderOptions = JsonObject & {
|
|
5
|
-
browserTarget
|
|
5
|
+
browserTarget?: string | null;
|
|
6
|
+
tsConfig?: string;
|
|
6
7
|
compodoc: boolean;
|
|
7
8
|
compodocArgs: string[];
|
|
8
9
|
} & Pick<CLIOptions, 'port' | 'host' | 'staticDir' | 'configDir' | 'https' | 'sslCa' | 'sslCert' | 'sslKey' | 'smokeTest' | 'ci' | 'quiet' | 'docs'>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { PartialStoryFn } from '@storybook/csf';
|
|
2
|
+
import { AngularFramework } from '../types-6-0';
|
|
3
3
|
declare global {
|
|
4
4
|
interface Window {
|
|
5
5
|
NODE_ENV: 'string' | 'development' | undefined;
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
|
-
export declare const renderNgApp: (storyFn:
|
|
8
|
+
export declare const renderNgApp: (storyFn: PartialStoryFn<AngularFramework>, forced: boolean) => void;
|
|
@@ -28,11 +28,13 @@ export declare abstract class AbstractRenderer {
|
|
|
28
28
|
* @param forced {boolean} If :
|
|
29
29
|
* - true render will only use the StoryFn `props' in storyProps observable that will update sotry's component/template properties. Improves performance without reloading the whole module&component if props changes
|
|
30
30
|
* - false fully recharges or initializes angular module & component
|
|
31
|
+
* @param component {Component}
|
|
31
32
|
* @param parameters {Parameters}
|
|
32
33
|
*/
|
|
33
|
-
render({ storyFnAngular, forced, parameters, targetDOMNode, }: {
|
|
34
|
+
render({ storyFnAngular, forced, parameters, component, targetDOMNode, }: {
|
|
34
35
|
storyFnAngular: StoryFnAngularReturnType;
|
|
35
36
|
forced: boolean;
|
|
37
|
+
component?: any;
|
|
36
38
|
parameters: Parameters;
|
|
37
39
|
targetDOMNode: HTMLElement;
|
|
38
40
|
}): Promise<void>;
|
|
@@ -10,8 +10,9 @@ export declare class ElementRendererService {
|
|
|
10
10
|
/**
|
|
11
11
|
* Returns a custom element generated by Angular elements
|
|
12
12
|
*/
|
|
13
|
-
renderAngularElement({ storyFnAngular, parameters, }: {
|
|
13
|
+
renderAngularElement({ storyFnAngular, parameters, component, }: {
|
|
14
14
|
storyFnAngular: StoryFnAngularReturnType;
|
|
15
15
|
parameters: Parameters;
|
|
16
|
+
component: any;
|
|
16
17
|
}): Promise<CustomElementConstructor>;
|
|
17
18
|
}
|
|
@@ -21,11 +21,12 @@ export declare class RendererService {
|
|
|
21
21
|
* @param forced {boolean} If :
|
|
22
22
|
* - true render will only use the StoryFn `props' in storyProps observable that will update sotry's component/template properties. Improves performance without reloading the whole module&component if props changes
|
|
23
23
|
* - false fully recharges or initializes angular module & component
|
|
24
|
-
* @param
|
|
24
|
+
* @param component {Parameters}
|
|
25
25
|
*/
|
|
26
|
-
render({ storyFnAngular, forced, parameters, }: {
|
|
26
|
+
render({ storyFnAngular, forced, component, parameters, }: {
|
|
27
27
|
storyFnAngular: StoryFnAngularReturnType;
|
|
28
28
|
forced: boolean;
|
|
29
|
+
component?: any;
|
|
29
30
|
parameters: Parameters;
|
|
30
31
|
}): Promise<void>;
|
|
31
32
|
newPlatformBrowserDynamic(): PlatformRef;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { NgModule, Type } from '@angular/core';
|
|
2
2
|
import { Subject } from 'rxjs';
|
|
3
3
|
import { ICollection, StoryFnAngularReturnType } from '../types';
|
|
4
|
-
|
|
5
|
-
export declare const getStorybookModuleMetadata: ({ storyFnAngular, parameters, targetSelector, }: {
|
|
4
|
+
export declare const getStorybookModuleMetadata: ({ storyFnAngular, component: annotatedComponent, targetSelector, }: {
|
|
6
5
|
storyFnAngular: StoryFnAngularReturnType;
|
|
7
|
-
|
|
6
|
+
component?: any;
|
|
8
7
|
targetSelector: string;
|
|
9
8
|
}, storyProps$: Subject<ICollection>) => NgModule;
|
|
10
9
|
export declare const createStorybookModule: (ngModule: NgModule) => Type<unknown>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { DecoratorFunction,
|
|
2
|
-
import {
|
|
3
|
-
export default function decorateStory(mainStoryFn:
|
|
1
|
+
import { DecoratorFunction, LegacyStoryFn } from '@storybook/csf';
|
|
2
|
+
import { AngularFramework } from './types-6-0';
|
|
3
|
+
export default function decorateStory(mainStoryFn: LegacyStoryFn<AngularFramework>, decorators: DecoratorFunction<AngularFramework>[]): LegacyStoryFn<AngularFramework>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Type } from '@angular/core';
|
|
2
|
-
import { DecoratorFunction, StoryContext } from '@storybook/
|
|
3
|
-
import { ICollection, NgModuleMetadata
|
|
4
|
-
|
|
5
|
-
export declare const
|
|
2
|
+
import { DecoratorFunction, StoryContext } from '@storybook/csf';
|
|
3
|
+
import { ICollection, NgModuleMetadata } from './types';
|
|
4
|
+
import { AngularFramework } from './types-6-0';
|
|
5
|
+
export declare const moduleMetadata: (metadata: Partial<NgModuleMetadata>) => DecoratorFunction<AngularFramework>;
|
|
6
|
+
export declare const componentWrapperDecorator: (element: Type<unknown> | ((story: string) => string), props?: ICollection | ((storyContext: StoryContext<AngularFramework>) => ICollection)) => DecoratorFunction<AngularFramework>;
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
/// <reference types="node" />
|
|
3
3
|
import { ClientStoryApi, Loadable } from '@storybook/addons';
|
|
4
4
|
import './globals';
|
|
5
|
-
import { IStorybookSection
|
|
6
|
-
|
|
5
|
+
import { IStorybookSection } from './types';
|
|
6
|
+
import { AngularFramework } from './types-6-0';
|
|
7
|
+
interface ClientApi extends ClientStoryApi<AngularFramework['storyResult']> {
|
|
7
8
|
setAddon(addon: any): void;
|
|
8
9
|
configure(loader: Loadable, module: NodeModule): void;
|
|
9
10
|
getStorybook(): IStorybookSection[];
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { RenderContext } from '@storybook/store';
|
|
2
|
+
import { ArgsStoryFn } from '@storybook/csf';
|
|
3
|
+
import { AngularFramework } from './types-6-0';
|
|
4
4
|
import { RendererFactory } from './angular-beta/RendererFactory';
|
|
5
5
|
export declare const rendererFactory: RendererFactory;
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
showMain: () => void;
|
|
9
|
-
forceRender: boolean;
|
|
10
|
-
parameters: Parameters;
|
|
11
|
-
targetDOMNode: HTMLElement;
|
|
12
|
-
id: string;
|
|
13
|
-
}): Promise<void>;
|
|
6
|
+
export declare const render: ArgsStoryFn<AngularFramework>;
|
|
7
|
+
export declare function renderToDOM({ storyFn, showMain, forceRemount, storyContext: { parameters, component }, id, }: RenderContext<AngularFramework>, element: HTMLElement): Promise<void>;
|
|
@@ -1,26 +1,27 @@
|
|
|
1
|
-
import { Args
|
|
1
|
+
import { Args, Parameters as DefaultParameters, StoryContext as DefaultStoryContext, ComponentAnnotations, StoryAnnotationsOrFn } from '@storybook/csf';
|
|
2
2
|
import { StoryFnAngularReturnType } from './types';
|
|
3
|
-
export { Args, ArgTypes } from '@storybook/
|
|
4
|
-
declare type
|
|
5
|
-
|
|
3
|
+
export { Args, ArgTypes } from '@storybook/csf';
|
|
4
|
+
export declare type AngularFramework = {
|
|
5
|
+
component: any;
|
|
6
|
+
storyResult: StoryFnAngularReturnType;
|
|
7
|
+
};
|
|
6
8
|
/**
|
|
7
9
|
* Metadata to configure the stories for a component.
|
|
8
10
|
*
|
|
9
11
|
* @see [Default export](https://storybook.js.org/docs/formats/component-story-format/#default-export)
|
|
10
12
|
*/
|
|
11
|
-
export declare type Meta<
|
|
13
|
+
export declare type Meta<TArgs = Args> = ComponentAnnotations<AngularFramework, TArgs>;
|
|
12
14
|
/**
|
|
13
15
|
* Story function that represents a component example.
|
|
14
16
|
*
|
|
15
17
|
* @see [Named Story exports](https://storybook.js.org/docs/formats/component-story-format/#named-story-exports)
|
|
16
18
|
*/
|
|
17
|
-
export declare type Story<
|
|
19
|
+
export declare type Story<TArgs = Args> = StoryAnnotationsOrFn<AngularFramework, TArgs>;
|
|
18
20
|
export declare type Parameters = DefaultParameters & {
|
|
19
21
|
/** Uses legacy angular rendering engine that use dynamic component */
|
|
20
22
|
angularLegacyRendering?: boolean;
|
|
21
|
-
component: unknown;
|
|
22
23
|
bootstrapModuleOptions?: unknown;
|
|
23
24
|
};
|
|
24
|
-
export declare type StoryContext = DefaultStoryContext & {
|
|
25
|
+
export declare type StoryContext = DefaultStoryContext<AngularFramework> & {
|
|
25
26
|
parameters: Parameters;
|
|
26
27
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const not = "empty";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const not = "empty";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const not = "empty";
|
|
@@ -3,6 +3,7 @@ import TsconfigPathsPlugin from 'tsconfig-paths-webpack-plugin';
|
|
|
3
3
|
import { Options as CoreOptions } from '@storybook/core-common';
|
|
4
4
|
export declare type Options = CoreOptions & {
|
|
5
5
|
angularBrowserTarget?: string;
|
|
6
|
+
tsConfig?: string;
|
|
6
7
|
};
|
|
7
8
|
export declare function webpackFinal(baseConfig: webpack.Configuration, options: Options): Promise<webpack.Configuration | {
|
|
8
9
|
entry: any[];
|
|
@@ -2,7 +2,8 @@ import { BuilderOutput } from '@angular-devkit/architect';
|
|
|
2
2
|
import { JsonObject } from '@angular-devkit/core';
|
|
3
3
|
import { CLIOptions } from '@storybook/core-common';
|
|
4
4
|
export declare type StorybookBuilderOptions = JsonObject & {
|
|
5
|
-
browserTarget
|
|
5
|
+
browserTarget?: string | null;
|
|
6
|
+
tsConfig?: string;
|
|
6
7
|
compodoc: boolean;
|
|
7
8
|
compodocArgs: string[];
|
|
8
9
|
} & Pick<CLIOptions, 'staticDir' | 'outputDir' | 'configDir' | 'loglevel' | 'quiet' | 'docs'>;
|
|
@@ -46,6 +46,17 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
46
46
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
50
|
+
var t = {};
|
|
51
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
52
|
+
t[p] = s[p];
|
|
53
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
54
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
55
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
56
|
+
t[p[i]] = s[p[i]];
|
|
57
|
+
}
|
|
58
|
+
return t;
|
|
59
|
+
};
|
|
49
60
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
61
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
62
|
};
|
|
@@ -59,33 +70,40 @@ var run_compodoc_1 = require("../utils/run-compodoc");
|
|
|
59
70
|
exports.default = architect_1.createBuilder(commandBuilder);
|
|
60
71
|
function commandBuilder(options, context) {
|
|
61
72
|
return rxjs_1.from(setup(options, context)).pipe(operators_1.switchMap(function (_a) {
|
|
62
|
-
var
|
|
63
|
-
|
|
64
|
-
? run_compodoc_1.runCompodoc({ compodocArgs: options.compodocArgs, tsconfig:
|
|
73
|
+
var tsConfig = _a.tsConfig;
|
|
74
|
+
var runCompodoc$ = options.compodoc
|
|
75
|
+
? run_compodoc_1.runCompodoc({ compodocArgs: options.compodocArgs, tsconfig: tsConfig }, context).pipe(operators_1.mapTo({ tsConfig: tsConfig }))
|
|
65
76
|
: rxjs_1.of({});
|
|
66
|
-
|
|
77
|
+
return runCompodoc$.pipe(operators_1.mapTo({ tsConfig: tsConfig }));
|
|
78
|
+
}), operators_1.map(function (_a) {
|
|
79
|
+
var tsConfig = _a.tsConfig;
|
|
80
|
+
var browserTarget = options.browserTarget, otherOptions = __rest(options, ["browserTarget"]);
|
|
81
|
+
return __assign(__assign({}, otherOptions), { angularBrowserTarget: browserTarget, tsConfig: tsConfig });
|
|
82
|
+
}), operators_1.switchMap(function (standaloneOptions) { return runInstance(__assign(__assign({}, standaloneOptions), { mode: 'static' })); }), operators_1.map(function () {
|
|
67
83
|
return { success: true };
|
|
68
84
|
}));
|
|
69
85
|
}
|
|
70
86
|
function setup(options, context) {
|
|
87
|
+
var _a, _b;
|
|
71
88
|
return __awaiter(this, void 0, void 0, function () {
|
|
72
|
-
var
|
|
73
|
-
return __generator(this, function (
|
|
74
|
-
switch (
|
|
89
|
+
var browserOptions, browserTarget, _c, _d, _e;
|
|
90
|
+
return __generator(this, function (_f) {
|
|
91
|
+
switch (_f.label) {
|
|
75
92
|
case 0:
|
|
93
|
+
if (!options.browserTarget) return [3 /*break*/, 4];
|
|
76
94
|
browserTarget = architect_1.targetFromTargetString(options.browserTarget);
|
|
77
|
-
|
|
95
|
+
_d = (_c = context).validateOptions;
|
|
78
96
|
return [4 /*yield*/, context.getTargetOptions(browserTarget)];
|
|
79
97
|
case 1:
|
|
80
|
-
|
|
98
|
+
_e = [_f.sent()];
|
|
81
99
|
return [4 /*yield*/, context.getBuilderNameForTarget(browserTarget)];
|
|
82
|
-
case 2: return [4 /*yield*/,
|
|
100
|
+
case 2: return [4 /*yield*/, _d.apply(_c, _e.concat([_f.sent()]))];
|
|
83
101
|
case 3:
|
|
84
|
-
browserOptions =
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
102
|
+
browserOptions = _f.sent();
|
|
103
|
+
_f.label = 4;
|
|
104
|
+
case 4: return [2 /*return*/, {
|
|
105
|
+
tsConfig: (_b = (_a = options.tsConfig) !== null && _a !== void 0 ? _a : browserOptions.tsConfig) !== null && _b !== void 0 ? _b : undefined,
|
|
106
|
+
}];
|
|
89
107
|
}
|
|
90
108
|
});
|
|
91
109
|
});
|
|
@@ -7,7 +7,12 @@
|
|
|
7
7
|
"browserTarget": {
|
|
8
8
|
"type": "string",
|
|
9
9
|
"description": "Build target to be served in project-name:builder:config format. Should generally target on the builder: '@angular-devkit/build-angular:browser'. Useful for Storybook to use options (styles, assets, ...).",
|
|
10
|
-
"pattern": "^[^:\\s]+:[^:\\s]+(:[^\\s]+)?$"
|
|
10
|
+
"pattern": "^[^:\\s]+:[^:\\s]+(:[^\\s]+)?$",
|
|
11
|
+
"default": null
|
|
12
|
+
},
|
|
13
|
+
"tsConfig": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"description": "The full path for the TypeScript configuration file, relative to the current workspace."
|
|
11
16
|
},
|
|
12
17
|
"staticDir": {
|
|
13
18
|
"type": "array",
|
|
@@ -56,5 +61,12 @@
|
|
|
56
61
|
}
|
|
57
62
|
},
|
|
58
63
|
"additionalProperties": false,
|
|
59
|
-
"
|
|
64
|
+
"oneOf": [
|
|
65
|
+
{
|
|
66
|
+
"required": ["browserTarget"]
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"required": ["tsConfig"]
|
|
70
|
+
}
|
|
71
|
+
]
|
|
60
72
|
}
|
|
@@ -2,7 +2,8 @@ import { BuilderOutput } from '@angular-devkit/architect';
|
|
|
2
2
|
import { JsonObject } from '@angular-devkit/core';
|
|
3
3
|
import { CLIOptions } from '@storybook/core-common';
|
|
4
4
|
export declare type StorybookBuilderOptions = JsonObject & {
|
|
5
|
-
browserTarget
|
|
5
|
+
browserTarget?: string | null;
|
|
6
|
+
tsConfig?: string;
|
|
6
7
|
compodoc: boolean;
|
|
7
8
|
compodocArgs: string[];
|
|
8
9
|
} & Pick<CLIOptions, 'port' | 'host' | 'staticDir' | 'configDir' | 'https' | 'sslCa' | 'sslCert' | 'sslKey' | 'smokeTest' | 'ci' | 'quiet' | 'docs'>;
|
|
@@ -46,6 +46,17 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
46
46
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
47
|
}
|
|
48
48
|
};
|
|
49
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
50
|
+
var t = {};
|
|
51
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
52
|
+
t[p] = s[p];
|
|
53
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
54
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
55
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
56
|
+
t[p[i]] = s[p[i]];
|
|
57
|
+
}
|
|
58
|
+
return t;
|
|
59
|
+
};
|
|
49
60
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
50
61
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
51
62
|
};
|
|
@@ -59,33 +70,40 @@ var run_compodoc_1 = require("../utils/run-compodoc");
|
|
|
59
70
|
exports.default = architect_1.createBuilder(commandBuilder);
|
|
60
71
|
function commandBuilder(options, context) {
|
|
61
72
|
return rxjs_1.from(setup(options, context)).pipe(operators_1.switchMap(function (_a) {
|
|
62
|
-
var
|
|
63
|
-
|
|
64
|
-
? run_compodoc_1.runCompodoc({ compodocArgs: options.compodocArgs, tsconfig:
|
|
73
|
+
var tsConfig = _a.tsConfig;
|
|
74
|
+
var runCompodoc$ = options.compodoc
|
|
75
|
+
? run_compodoc_1.runCompodoc({ compodocArgs: options.compodocArgs, tsconfig: tsConfig }, context).pipe(operators_1.mapTo({ tsConfig: tsConfig }))
|
|
65
76
|
: rxjs_1.of({});
|
|
66
|
-
|
|
77
|
+
return runCompodoc$.pipe(operators_1.mapTo({ tsConfig: tsConfig }));
|
|
78
|
+
}), operators_1.map(function (_a) {
|
|
79
|
+
var tsConfig = _a.tsConfig;
|
|
80
|
+
var browserTarget = options.browserTarget, otherOptions = __rest(options, ["browserTarget"]);
|
|
81
|
+
return __assign(__assign({}, otherOptions), { angularBrowserTarget: browserTarget, tsConfig: tsConfig });
|
|
82
|
+
}), operators_1.switchMap(function (standaloneOptions) { return runInstance(standaloneOptions); }), operators_1.map(function () {
|
|
67
83
|
return { success: true };
|
|
68
84
|
}));
|
|
69
85
|
}
|
|
70
86
|
function setup(options, context) {
|
|
87
|
+
var _a, _b;
|
|
71
88
|
return __awaiter(this, void 0, void 0, function () {
|
|
72
|
-
var
|
|
73
|
-
return __generator(this, function (
|
|
74
|
-
switch (
|
|
89
|
+
var browserOptions, browserTarget, _c, _d, _e;
|
|
90
|
+
return __generator(this, function (_f) {
|
|
91
|
+
switch (_f.label) {
|
|
75
92
|
case 0:
|
|
93
|
+
if (!options.browserTarget) return [3 /*break*/, 4];
|
|
76
94
|
browserTarget = architect_1.targetFromTargetString(options.browserTarget);
|
|
77
|
-
|
|
95
|
+
_d = (_c = context).validateOptions;
|
|
78
96
|
return [4 /*yield*/, context.getTargetOptions(browserTarget)];
|
|
79
97
|
case 1:
|
|
80
|
-
|
|
98
|
+
_e = [_f.sent()];
|
|
81
99
|
return [4 /*yield*/, context.getBuilderNameForTarget(browserTarget)];
|
|
82
|
-
case 2: return [4 /*yield*/,
|
|
100
|
+
case 2: return [4 /*yield*/, _d.apply(_c, _e.concat([_f.sent()]))];
|
|
83
101
|
case 3:
|
|
84
|
-
browserOptions =
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
102
|
+
browserOptions = _f.sent();
|
|
103
|
+
_f.label = 4;
|
|
104
|
+
case 4: return [2 /*return*/, {
|
|
105
|
+
tsConfig: (_b = (_a = options.tsConfig) !== null && _a !== void 0 ? _a : browserOptions.tsConfig) !== null && _b !== void 0 ? _b : undefined,
|
|
106
|
+
}];
|
|
89
107
|
}
|
|
90
108
|
});
|
|
91
109
|
});
|
|
@@ -7,7 +7,12 @@
|
|
|
7
7
|
"browserTarget": {
|
|
8
8
|
"type": "string",
|
|
9
9
|
"description": "Build target to be served in project-name:builder:config format. Should generally target on the builder: '@angular-devkit/build-angular:browser'. Useful for Storybook to use options (styles, assets, ...).",
|
|
10
|
-
"pattern": "^[^:\\s]+:[^:\\s]+(:[^\\s]+)?$"
|
|
10
|
+
"pattern": "^[^:\\s]+:[^:\\s]+(:[^\\s]+)?$",
|
|
11
|
+
"default": null
|
|
12
|
+
},
|
|
13
|
+
"tsConfig": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"description": "The full path for the TypeScript configuration file, relative to the current workspace."
|
|
11
16
|
},
|
|
12
17
|
"port": {
|
|
13
18
|
"type": "number",
|
|
@@ -83,5 +88,12 @@
|
|
|
83
88
|
}
|
|
84
89
|
},
|
|
85
90
|
"additionalProperties": false,
|
|
86
|
-
"
|
|
91
|
+
"oneOf": [
|
|
92
|
+
{
|
|
93
|
+
"required": ["browserTarget"]
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"required": ["tsConfig"]
|
|
97
|
+
}
|
|
98
|
+
]
|
|
87
99
|
}
|