@storybook/angular 7.1.0-alpha.32 → 7.1.0-alpha.34
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/builders/start-storybook/index.d.ts +2 -2
- package/dist/builders/start-storybook/index.js +2 -1
- package/dist/builders/start-storybook/schema.json +4 -0
- package/dist/server/angular-cli-webpack.js +24 -1
- package/dist/server/framework-preset-angular-ivy.js +2 -2
- package/package.json +14 -14
- package/src/server/angular-cli-webpack.js +37 -6
|
@@ -11,7 +11,7 @@ export type StorybookBuilderOptions = JsonObject & {
|
|
|
11
11
|
styles?: StyleElement[];
|
|
12
12
|
stylePreprocessorOptions?: StylePreprocessorOptions;
|
|
13
13
|
assets?: AssetPattern[];
|
|
14
|
-
} & Pick<CLIOptions, 'port' | 'host' | 'configDir' | 'https' | 'sslCa' | 'sslCert' | 'sslKey' | 'smokeTest' | 'ci' | 'quiet' | 'disableTelemetry' | 'open' | 'docs'>;
|
|
14
|
+
} & Pick<CLIOptions, 'port' | 'host' | 'configDir' | 'https' | 'sslCa' | 'sslCert' | 'sslKey' | 'smokeTest' | 'ci' | 'quiet' | 'disableTelemetry' | 'initialPath' | 'open' | 'docs'>;
|
|
15
15
|
export type StorybookBuilderOutput = JsonObject & BuilderOutput & {};
|
|
16
16
|
declare const _default: import("@angular-devkit/architect/src/internal").Builder<JsonObject & {
|
|
17
17
|
browserTarget?: string | null | undefined;
|
|
@@ -21,5 +21,5 @@ declare const _default: import("@angular-devkit/architect/src/internal").Builder
|
|
|
21
21
|
styles?: StyleElement[] | undefined;
|
|
22
22
|
stylePreprocessorOptions?: StylePreprocessorOptions | undefined;
|
|
23
23
|
assets?: AssetPattern[] | undefined;
|
|
24
|
-
} & Pick<CLIOptions, "docs" | "configDir" | "quiet" | "disableTelemetry" | "port" | "host" | "https" | "sslCa" | "sslCert" | "sslKey" | "smokeTest" | "open" | "ci">>;
|
|
24
|
+
} & Pick<CLIOptions, "docs" | "configDir" | "quiet" | "disableTelemetry" | "port" | "host" | "initialPath" | "https" | "sslCa" | "sslCert" | "sslKey" | "smokeTest" | "open" | "ci">>;
|
|
25
25
|
export default _default;
|
|
@@ -30,7 +30,7 @@ const commandBuilder = (options, context) => {
|
|
|
30
30
|
});
|
|
31
31
|
// eslint-disable-next-line no-param-reassign
|
|
32
32
|
options.port = parseInt(`${options.port}`, 10);
|
|
33
|
-
const { browserTarget, stylePreprocessorOptions, styles, ci, configDir, docs, host, https, port, quiet, smokeTest, sslCa, sslCert, sslKey, disableTelemetry, assets, open, } = options;
|
|
33
|
+
const { browserTarget, stylePreprocessorOptions, styles, ci, configDir, docs, host, https, port, quiet, smokeTest, sslCa, sslCert, sslKey, disableTelemetry, assets, initialPath, open, } = options;
|
|
34
34
|
const standaloneOptions = {
|
|
35
35
|
packageJson: (0, read_pkg_up_1.sync)({ cwd: __dirname }).packageJson,
|
|
36
36
|
ci,
|
|
@@ -53,6 +53,7 @@ const commandBuilder = (options, context) => {
|
|
|
53
53
|
...(assets ? { assets } : {}),
|
|
54
54
|
},
|
|
55
55
|
tsConfig,
|
|
56
|
+
initialPath,
|
|
56
57
|
open,
|
|
57
58
|
};
|
|
58
59
|
return standaloneOptions;
|
|
@@ -114,6 +114,10 @@
|
|
|
114
114
|
"items": {
|
|
115
115
|
"$ref": "#/definitions/assetPattern"
|
|
116
116
|
}
|
|
117
|
+
},
|
|
118
|
+
"initialPath": {
|
|
119
|
+
"type": "string",
|
|
120
|
+
"description": "URL path to be appended when visiting Storybook for the first time"
|
|
117
121
|
}
|
|
118
122
|
},
|
|
119
123
|
"additionalProperties": false,
|
|
@@ -1,10 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/* eslint-disable global-require */
|
|
2
3
|
// Private angular devkit stuff
|
|
3
4
|
const { generateI18nBrowserWebpackConfigFromContext, } = require('@angular-devkit/build-angular/src/utils/webpack-browser-config');
|
|
4
|
-
const { getCommonConfig, getStylesConfig, getDevServerConfig, getTypeScriptConfig, } = require('@angular-devkit/build-angular/src/webpack/configs');
|
|
5
5
|
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
|
|
6
6
|
const { filterOutStylingRules } = require('./utils/filter-out-styling-rules');
|
|
7
7
|
const { default: StorybookNormalizeAngularEntryPlugin, } = require('./plugins/storybook-normalize-angular-entry-plugin');
|
|
8
|
+
const getAngularWebpackUtils = () => {
|
|
9
|
+
try {
|
|
10
|
+
// Angular < 16.1.0
|
|
11
|
+
const { getCommonConfig, getStylesConfig, getDevServerConfig, getTypeScriptConfig, } = require('@angular-devkit/build-angular/src/webpack/configs');
|
|
12
|
+
return {
|
|
13
|
+
getCommonConfig,
|
|
14
|
+
getStylesConfig,
|
|
15
|
+
getDevServerConfig,
|
|
16
|
+
getTypeScriptConfig,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
catch (e) {
|
|
20
|
+
// Angular > 16.1.0
|
|
21
|
+
const { getCommonConfig, getStylesConfig, getDevServerConfig, getTypeScriptConfig, } = require('@angular-devkit/build-angular/src/tools/webpack/configs');
|
|
22
|
+
return {
|
|
23
|
+
getCommonConfig,
|
|
24
|
+
getStylesConfig,
|
|
25
|
+
getDevServerConfig,
|
|
26
|
+
getTypeScriptConfig,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
};
|
|
8
30
|
/**
|
|
9
31
|
* Extract webpack config from angular-cli 13.x.x
|
|
10
32
|
* ⚠️ This file is in JavaScript to not use TypeScript. Because current storybook TypeScript version is not compatible with Angular CLI.
|
|
@@ -17,6 +39,7 @@ exports.getWebpackConfig = async (baseConfig, { builderOptions, builderContext }
|
|
|
17
39
|
/**
|
|
18
40
|
* Get angular-cli Webpack config
|
|
19
41
|
*/
|
|
42
|
+
const { getCommonConfig, getStylesConfig, getDevServerConfig, getTypeScriptConfig } = getAngularWebpackUtils();
|
|
20
43
|
const { config: cliConfig } = await generateI18nBrowserWebpackConfigFromContext({
|
|
21
44
|
// Default options
|
|
22
45
|
index: 'noop-index',
|
|
@@ -24,7 +24,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.webpack = exports.runNgcc = void 0;
|
|
27
|
-
const core_1 = require("@angular/core");
|
|
28
27
|
const path = __importStar(require("path"));
|
|
29
28
|
/**
|
|
30
29
|
* Source : https://github.com/angular/angular-cli/blob/ebccb5de4a455af813c5e82483db6af20666bdbd/packages/angular_devkit/build_angular/src/utils/load-esm.ts#L23
|
|
@@ -69,9 +68,10 @@ const runNgcc = async () => {
|
|
|
69
68
|
};
|
|
70
69
|
exports.runNgcc = runNgcc;
|
|
71
70
|
const webpack = async (webpackConfig, options) => {
|
|
71
|
+
const { VERSION } = await loadEsmModule('@angular/core');
|
|
72
72
|
const framework = await options.presets.apply('framework');
|
|
73
73
|
const angularOptions = (typeof framework === 'object' ? framework.options : {});
|
|
74
|
-
const isAngular16OrNewer = parseInt(
|
|
74
|
+
const isAngular16OrNewer = parseInt(VERSION.major, 10) >= 16;
|
|
75
75
|
// Default to true, if undefined
|
|
76
76
|
if (angularOptions.enableIvy === false) {
|
|
77
77
|
return webpackConfig;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/angular",
|
|
3
|
-
"version": "7.1.0-alpha.
|
|
3
|
+
"version": "7.1.0-alpha.34",
|
|
4
4
|
"description": "Storybook for Angular: Develop Angular components in isolation with hot reloading.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook",
|
|
@@ -36,20 +36,20 @@
|
|
|
36
36
|
"prep": "../../../scripts/prepare/tsc.ts"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@storybook/builder-webpack5": "7.1.0-alpha.
|
|
40
|
-
"@storybook/cli": "7.1.0-alpha.
|
|
41
|
-
"@storybook/client-logger": "7.1.0-alpha.
|
|
42
|
-
"@storybook/core-common": "7.1.0-alpha.
|
|
43
|
-
"@storybook/core-events": "7.1.0-alpha.
|
|
44
|
-
"@storybook/core-server": "7.1.0-alpha.
|
|
45
|
-
"@storybook/core-webpack": "7.1.0-alpha.
|
|
46
|
-
"@storybook/docs-tools": "7.1.0-alpha.
|
|
39
|
+
"@storybook/builder-webpack5": "7.1.0-alpha.34",
|
|
40
|
+
"@storybook/cli": "7.1.0-alpha.34",
|
|
41
|
+
"@storybook/client-logger": "7.1.0-alpha.34",
|
|
42
|
+
"@storybook/core-common": "7.1.0-alpha.34",
|
|
43
|
+
"@storybook/core-events": "7.1.0-alpha.34",
|
|
44
|
+
"@storybook/core-server": "7.1.0-alpha.34",
|
|
45
|
+
"@storybook/core-webpack": "7.1.0-alpha.34",
|
|
46
|
+
"@storybook/docs-tools": "7.1.0-alpha.34",
|
|
47
47
|
"@storybook/global": "^5.0.0",
|
|
48
|
-
"@storybook/manager-api": "7.1.0-alpha.
|
|
49
|
-
"@storybook/node-logger": "7.1.0-alpha.
|
|
50
|
-
"@storybook/preview-api": "7.1.0-alpha.
|
|
51
|
-
"@storybook/telemetry": "7.1.0-alpha.
|
|
52
|
-
"@storybook/types": "7.1.0-alpha.
|
|
48
|
+
"@storybook/manager-api": "7.1.0-alpha.34",
|
|
49
|
+
"@storybook/node-logger": "7.1.0-alpha.34",
|
|
50
|
+
"@storybook/preview-api": "7.1.0-alpha.34",
|
|
51
|
+
"@storybook/telemetry": "7.1.0-alpha.34",
|
|
52
|
+
"@storybook/types": "7.1.0-alpha.34",
|
|
53
53
|
"@types/node": "^16.0.0",
|
|
54
54
|
"@types/react": "^16.14.34",
|
|
55
55
|
"@types/react-dom": "^16.9.14",
|
|
@@ -1,19 +1,48 @@
|
|
|
1
|
+
/* eslint-disable global-require */
|
|
1
2
|
// Private angular devkit stuff
|
|
2
3
|
const {
|
|
3
4
|
generateI18nBrowserWebpackConfigFromContext,
|
|
4
5
|
} = require('@angular-devkit/build-angular/src/utils/webpack-browser-config');
|
|
5
|
-
const {
|
|
6
|
-
getCommonConfig,
|
|
7
|
-
getStylesConfig,
|
|
8
|
-
getDevServerConfig,
|
|
9
|
-
getTypeScriptConfig,
|
|
10
|
-
} = require('@angular-devkit/build-angular/src/webpack/configs');
|
|
11
6
|
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
|
|
12
7
|
const { filterOutStylingRules } = require('./utils/filter-out-styling-rules');
|
|
13
8
|
const {
|
|
14
9
|
default: StorybookNormalizeAngularEntryPlugin,
|
|
15
10
|
} = require('./plugins/storybook-normalize-angular-entry-plugin');
|
|
16
11
|
|
|
12
|
+
const getAngularWebpackUtils = () => {
|
|
13
|
+
try {
|
|
14
|
+
// Angular < 16.1.0
|
|
15
|
+
const {
|
|
16
|
+
getCommonConfig,
|
|
17
|
+
getStylesConfig,
|
|
18
|
+
getDevServerConfig,
|
|
19
|
+
getTypeScriptConfig,
|
|
20
|
+
} = require('@angular-devkit/build-angular/src/webpack/configs');
|
|
21
|
+
|
|
22
|
+
return {
|
|
23
|
+
getCommonConfig,
|
|
24
|
+
getStylesConfig,
|
|
25
|
+
getDevServerConfig,
|
|
26
|
+
getTypeScriptConfig,
|
|
27
|
+
};
|
|
28
|
+
} catch (e) {
|
|
29
|
+
// Angular > 16.1.0
|
|
30
|
+
const {
|
|
31
|
+
getCommonConfig,
|
|
32
|
+
getStylesConfig,
|
|
33
|
+
getDevServerConfig,
|
|
34
|
+
getTypeScriptConfig,
|
|
35
|
+
} = require('@angular-devkit/build-angular/src/tools/webpack/configs');
|
|
36
|
+
|
|
37
|
+
return {
|
|
38
|
+
getCommonConfig,
|
|
39
|
+
getStylesConfig,
|
|
40
|
+
getDevServerConfig,
|
|
41
|
+
getTypeScriptConfig,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
|
|
17
46
|
/**
|
|
18
47
|
* Extract webpack config from angular-cli 13.x.x
|
|
19
48
|
* ⚠️ This file is in JavaScript to not use TypeScript. Because current storybook TypeScript version is not compatible with Angular CLI.
|
|
@@ -26,6 +55,8 @@ exports.getWebpackConfig = async (baseConfig, { builderOptions, builderContext }
|
|
|
26
55
|
/**
|
|
27
56
|
* Get angular-cli Webpack config
|
|
28
57
|
*/
|
|
58
|
+
const { getCommonConfig, getStylesConfig, getDevServerConfig, getTypeScriptConfig } =
|
|
59
|
+
getAngularWebpackUtils();
|
|
29
60
|
const { config: cliConfig } = await generateI18nBrowserWebpackConfigFromContext(
|
|
30
61
|
{
|
|
31
62
|
// Default options
|