@nx/storybook 16.1.0-rc.0 → 16.1.0
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/migrations.json +10 -0
- package/package.json +8 -8
- package/src/executors/build-storybook/build-storybook.impl.js +4 -4
- package/src/executors/build-storybook/build-storybook.impl.js.map +1 -1
- package/src/executors/build-storybook/schema.json +15 -16
- package/src/executors/storybook/schema.json +15 -16
- package/src/executors/storybook/storybook.impl.js +4 -3
- package/src/executors/storybook/storybook.impl.js.map +1 -1
- package/src/executors/utils.d.ts +2 -7
- package/src/executors/utils.js +2 -18
- package/src/executors/utils.js.map +1 -1
- package/src/generators/configuration/configuration.js +17 -94
- package/src/generators/configuration/configuration.js.map +1 -1
- package/src/generators/configuration/lib/user-prompts.d.ts +1 -3
- package/src/generators/configuration/lib/user-prompts.js +6 -61
- package/src/generators/configuration/lib/user-prompts.js.map +1 -1
- package/src/generators/configuration/lib/util-functions.d.ts +3 -3
- package/src/generators/configuration/lib/util-functions.js +5 -10
- package/src/generators/configuration/lib/util-functions.js.map +1 -1
- package/src/generators/configuration/project-files/.storybook/main.js__tmpl__ +15 -29
- package/src/generators/configuration/project-files/.storybook/tsconfig.json__tmpl__ +3 -3
- package/src/generators/configuration/project-files-ts/.storybook/main.ts__tmpl__ +15 -30
- package/src/generators/configuration/project-files-ts/.storybook/tsconfig.json__tmpl__ +3 -3
- package/src/generators/configuration/schema.d.ts +1 -4
- package/src/generators/configuration/schema.json +4 -24
- package/src/generators/init/init.js +19 -69
- package/src/generators/init/init.js.map +1 -1
- package/src/generators/init/schema.d.ts +2 -4
- package/src/generators/init/schema.json +2 -16
- package/src/migrations/update-16-1-0/eslint-ignore-react-plugin.d.ts +2 -0
- package/src/migrations/update-16-1-0/eslint-ignore-react-plugin.js +43 -0
- package/src/migrations/update-16-1-0/eslint-ignore-react-plugin.js.map +1 -0
- package/src/utils/models.d.ts +2 -3
- package/src/utils/utilities.d.ts +1 -12
- package/src/utils/utilities.js +10 -63
- package/src/utils/utilities.js.map +1 -1
- package/src/utils/versions.d.ts +1 -13
- package/src/utils/versions.js +2 -14
- package/src/utils/versions.js.map +1 -1
- package/src/generators/configuration/project-files-7/.storybook/main.js__tmpl__ +0 -32
- package/src/generators/configuration/project-files-7/.storybook/preview.js__tmpl__ +0 -0
- package/src/generators/configuration/project-files-7/.storybook/tsconfig.json__tmpl__ +0 -26
- package/src/generators/configuration/project-files-7-ts/.storybook/main.ts__tmpl__ +0 -34
- package/src/generators/configuration/project-files-7-ts/.storybook/preview.ts__tmpl__ +0 -0
- package/src/generators/configuration/project-files-7-ts/.storybook/tsconfig.json__tmpl__ +0 -28
package/migrations.json
CHANGED
|
@@ -53,6 +53,12 @@
|
|
|
53
53
|
"version": "16.0.0-beta.1",
|
|
54
54
|
"description": "Update workspace to use Storybook v7",
|
|
55
55
|
"implementation": "./src/migrations/update-16-0-0/update-sb-7"
|
|
56
|
+
},
|
|
57
|
+
"update-16-1-0": {
|
|
58
|
+
"cli": "nx",
|
|
59
|
+
"version": "16.1.0-beta.0",
|
|
60
|
+
"description": "Ignore @nx/react/plugins/storybook in Storybook eslint rules.",
|
|
61
|
+
"factory": "./src/migrations/update-16-1-0/eslint-ignore-react-plugin"
|
|
56
62
|
}
|
|
57
63
|
},
|
|
58
64
|
"packageJsonUpdates": {
|
|
@@ -62,6 +68,10 @@
|
|
|
62
68
|
"@storybook/core-server": ">=7.0.0 <7.0.8"
|
|
63
69
|
},
|
|
64
70
|
"packages": {
|
|
71
|
+
"eslint-plugin-storybook": {
|
|
72
|
+
"version": "^0.6.12",
|
|
73
|
+
"alwaysAddToPackageJson": false
|
|
74
|
+
},
|
|
65
75
|
"@storybook/core-server": {
|
|
66
76
|
"version": "^7.0.8",
|
|
67
77
|
"alwaysAddToPackageJson": false
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/storybook",
|
|
3
|
-
"version": "16.1.0
|
|
3
|
+
"version": "16.1.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Nx Plugin for Storybook contains executors and generators for allowing your workspace to use the powerful Storybook integration testing & documenting capabilities.",
|
|
6
6
|
"repository": {
|
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
"migrations": "./migrations.json"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@nrwl/storybook": "16.1.0
|
|
34
|
-
"@nx/cypress": "16.1.0
|
|
35
|
-
"@nx/devkit": "16.1.0
|
|
36
|
-
"@nx/js": "16.1.0
|
|
37
|
-
"@nx/linter": "16.1.0
|
|
38
|
-
"@nx/workspace": "16.1.0
|
|
33
|
+
"@nrwl/storybook": "16.1.0",
|
|
34
|
+
"@nx/cypress": "16.1.0",
|
|
35
|
+
"@nx/devkit": "16.1.0",
|
|
36
|
+
"@nx/js": "16.1.0",
|
|
37
|
+
"@nx/linter": "16.1.0",
|
|
38
|
+
"@nx/workspace": "16.1.0",
|
|
39
39
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
40
40
|
"dotenv": "~10.0.0",
|
|
41
41
|
"enquirer": "~2.3.6",
|
|
@@ -45,5 +45,5 @@
|
|
|
45
45
|
"access": "public"
|
|
46
46
|
},
|
|
47
47
|
"types": "./index.d.ts",
|
|
48
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "dfae1bf35a711d61a2cf75de65e2e352ebc97188"
|
|
49
49
|
}
|
|
@@ -19,11 +19,10 @@ function buildStorybookExecutor(options, context) {
|
|
|
19
19
|
return { success: true };
|
|
20
20
|
}
|
|
21
21
|
else {
|
|
22
|
-
// TODO(katerina): Remove
|
|
22
|
+
// TODO(katerina): Remove Nx17
|
|
23
23
|
// print warnings
|
|
24
24
|
(0, utils_1.runStorybookSetupCheck)(options);
|
|
25
|
-
(0,
|
|
26
|
-
devkit_1.logger.info(`NX ui framework: ${options.uiFramework}`);
|
|
25
|
+
devkit_1.logger.error((0, utilities_1.pleaseUpgrade)());
|
|
27
26
|
const frameworkPath = (0, utils_1.getStorybookFrameworkPath)(options.uiFramework);
|
|
28
27
|
const { default: frameworkOptions } = yield Promise.resolve(`${frameworkPath}`).then(s => require(s));
|
|
29
28
|
const buildOptions = Object.assign(Object.assign(Object.assign({}, options), frameworkOptions), { frameworkPresets: [...(frameworkOptions.frameworkPresets || [])] });
|
|
@@ -44,6 +43,7 @@ function runInstance(options, storybook7) {
|
|
|
44
43
|
return build.build(Object.assign(Object.assign({}, options), { mode: 'static' }));
|
|
45
44
|
}
|
|
46
45
|
else {
|
|
46
|
+
// TODO(katerina): Remove Nx17
|
|
47
47
|
const nodeVersion = process.version.slice(1).split('.');
|
|
48
48
|
if (+nodeVersion[0] === 18) {
|
|
49
49
|
devkit_1.logger.warn(`
|
|
@@ -51,7 +51,7 @@ function runInstance(options, storybook7) {
|
|
|
51
51
|
Please use Node 16 if you are using @storybook/builder-vite.
|
|
52
52
|
`);
|
|
53
53
|
}
|
|
54
|
-
return build.buildStaticStandalone(Object.assign(Object.assign({}, options), { ci: true }));
|
|
54
|
+
return build.buildStaticStandalone(Object.assign(Object.assign({}, options), { ci: true }));
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
//# sourceMappingURL=build-storybook.impl.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-storybook.impl.js","sourceRoot":"","sources":["../../../../../../packages/storybook/src/executors/build-storybook/build-storybook.impl.ts"],"names":[],"mappings":";;;AAAA,uCAAqD;AACrD,gDAAgD;AAEhD,yBAAuB;AACvB,
|
|
1
|
+
{"version":3,"file":"build-storybook.impl.js","sourceRoot":"","sources":["../../../../../../packages/storybook/src/executors/build-storybook/build-storybook.impl.ts"],"names":[],"mappings":";;;AAAA,uCAAqD;AACrD,gDAAgD;AAEhD,yBAAuB;AACvB,qDAI+B;AAE/B,oCAA6E;AAE7E,SAA8B,sBAAsB,CAClD,OAA6C,EAC7C,OAAwB;;QAExB,IAAA,sCAA0B,EAAC,OA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ClB,OAAmB,EACnB,UAAmB;;IAMnB,MAAM,GAAG,GAAG,MAAA,OAAO,CAAC,GAAG,CAAC,QAAQ,mCAAI,YAAY,CAAC;IACjD,OAAO,CAAC,GAAG,CAAC,QAAQ,GAAG,GAAG,CAAC;IAE3B,IAAI,UAAU,EAAE;QACd,OAAO,KAAK,CAAC,KAAK,iCACb,OAAO,KACV,IAAI,EAAE,QAAQ,IACd,CAAC;KACJ;SAAM;QACL,8BAA8B;QAC9B,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACxD,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE;YAC1B,eAAM,CAAC,IAAI,CAAC;;;OAGX,CAAC,CAAC;SACJ;QACD,OAAO,KAAK,CAAC,qBAAqB,CAAC,gCAC9B,OAAO,KACV,EAAE,EAAE,IAAI,GACF,CAAC,CAAC;KACX;AACH,CAAC"}
|
|
@@ -8,24 +8,10 @@
|
|
|
8
8
|
"presets": [
|
|
9
9
|
{
|
|
10
10
|
"name": "Default minimum setup",
|
|
11
|
-
"keys": ["
|
|
11
|
+
"keys": ["outputDir", "configDir"]
|
|
12
12
|
}
|
|
13
13
|
],
|
|
14
14
|
"properties": {
|
|
15
|
-
"uiFramework": {
|
|
16
|
-
"type": "string",
|
|
17
|
-
"description": "Storybook framework npm package.",
|
|
18
|
-
"enum": [
|
|
19
|
-
"@storybook/react",
|
|
20
|
-
"@storybook/html",
|
|
21
|
-
"@storybook/web-components",
|
|
22
|
-
"@storybook/vue",
|
|
23
|
-
"@storybook/vue3",
|
|
24
|
-
"@storybook/svelte"
|
|
25
|
-
],
|
|
26
|
-
"default": "@storybook/react",
|
|
27
|
-
"x-priority": "important"
|
|
28
|
-
},
|
|
29
15
|
"outputDir": {
|
|
30
16
|
"type": "string",
|
|
31
17
|
"description": "Directory where to store built files.",
|
|
@@ -82,6 +68,19 @@
|
|
|
82
68
|
"docs": {
|
|
83
69
|
"type": "boolean",
|
|
84
70
|
"description": "Starts Storybook in documentation mode. Learn more about it : https://storybook.js.org/docs/react/writing-docs/build-documentation#preview-storybooks-documentation."
|
|
71
|
+
},
|
|
72
|
+
"uiFramework": {
|
|
73
|
+
"type": "string",
|
|
74
|
+
"description": "Storybook framework npm package.",
|
|
75
|
+
"enum": [
|
|
76
|
+
"@storybook/react",
|
|
77
|
+
"@storybook/html",
|
|
78
|
+
"@storybook/web-components",
|
|
79
|
+
"@storybook/vue",
|
|
80
|
+
"@storybook/vue3",
|
|
81
|
+
"@storybook/svelte"
|
|
82
|
+
],
|
|
83
|
+
"x-deprecated": "Upgrade to Storybook 7."
|
|
85
84
|
}
|
|
86
85
|
},
|
|
87
86
|
"definitions": {
|
|
@@ -117,6 +116,6 @@
|
|
|
117
116
|
}
|
|
118
117
|
},
|
|
119
118
|
"additionalProperties": true,
|
|
120
|
-
"required": ["
|
|
119
|
+
"required": ["configDir"],
|
|
121
120
|
"examplesFile": "../../../docs/build-storybook-executor-examples.md"
|
|
122
121
|
}
|
|
@@ -8,24 +8,10 @@
|
|
|
8
8
|
"presets": [
|
|
9
9
|
{
|
|
10
10
|
"name": "Default minimum setup",
|
|
11
|
-
"keys": ["
|
|
11
|
+
"keys": ["port", "configDir"]
|
|
12
12
|
}
|
|
13
13
|
],
|
|
14
14
|
"properties": {
|
|
15
|
-
"uiFramework": {
|
|
16
|
-
"type": "string",
|
|
17
|
-
"description": "Storybook framework npm package.",
|
|
18
|
-
"enum": [
|
|
19
|
-
"@storybook/react",
|
|
20
|
-
"@storybook/html",
|
|
21
|
-
"@storybook/web-components",
|
|
22
|
-
"@storybook/vue",
|
|
23
|
-
"@storybook/vue3",
|
|
24
|
-
"@storybook/svelte"
|
|
25
|
-
],
|
|
26
|
-
"default": "@storybook/react",
|
|
27
|
-
"x-priority": "important"
|
|
28
|
-
},
|
|
29
15
|
"port": {
|
|
30
16
|
"type": "number",
|
|
31
17
|
"description": "Port to listen on.",
|
|
@@ -85,10 +71,23 @@
|
|
|
85
71
|
"type": "boolean",
|
|
86
72
|
"description": "Starts Storybook in documentation mode. Learn more about it : https://storybook.js.org/docs/react/writing-docs/build-documentation#preview-storybooks-documentation.",
|
|
87
73
|
"default": false
|
|
74
|
+
},
|
|
75
|
+
"uiFramework": {
|
|
76
|
+
"type": "string",
|
|
77
|
+
"description": "Storybook framework npm package.",
|
|
78
|
+
"enum": [
|
|
79
|
+
"@storybook/react",
|
|
80
|
+
"@storybook/html",
|
|
81
|
+
"@storybook/web-components",
|
|
82
|
+
"@storybook/vue",
|
|
83
|
+
"@storybook/vue3",
|
|
84
|
+
"@storybook/svelte"
|
|
85
|
+
],
|
|
86
|
+
"x-deprecated": "Upgrade to Storybook 7."
|
|
88
87
|
}
|
|
89
88
|
},
|
|
90
89
|
"additionalProperties": true,
|
|
91
90
|
"definitions": {},
|
|
92
|
-
"required": ["
|
|
91
|
+
"required": ["configDir"],
|
|
93
92
|
"examplesFile": "../../../docs/storybook-executor-examples.md"
|
|
94
93
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
4
5
|
const build = require("@storybook/core-server");
|
|
5
6
|
require("dotenv/config");
|
|
6
7
|
const utilities_1 = require("../../utils/utilities");
|
|
@@ -23,10 +24,10 @@ function storybookExecutor(options, context) {
|
|
|
23
24
|
yield tslib_1.__await(new Promise(() => { }));
|
|
24
25
|
}
|
|
25
26
|
else {
|
|
26
|
-
// TODO(katerina): Remove
|
|
27
|
+
// TODO(katerina): Remove Nx17
|
|
27
28
|
// print warnings
|
|
28
29
|
(0, utils_1.runStorybookSetupCheck)(options);
|
|
29
|
-
(0,
|
|
30
|
+
devkit_1.logger.error((0, utilities_1.pleaseUpgrade)());
|
|
30
31
|
let frameworkPath = (0, utils_1.getStorybookFrameworkPath)(options.uiFramework);
|
|
31
32
|
const frameworkOptions = (yield tslib_1.__await(Promise.resolve(`${frameworkPath}`).then(s => require(s)))).default;
|
|
32
33
|
const buildOptions = Object.assign(Object.assign(Object.assign({}, options), frameworkOptions), { frameworkPresets: [...(frameworkOptions.frameworkPresets || [])] });
|
|
@@ -45,7 +46,7 @@ function runInstance(options, storybook7) {
|
|
|
45
46
|
return build.build(Object.assign(Object.assign({}, options), { mode: 'dev' }));
|
|
46
47
|
}
|
|
47
48
|
else {
|
|
48
|
-
// TODO(katerina): Remove
|
|
49
|
+
// TODO(katerina): Remove Nx17
|
|
49
50
|
return build['buildDev'](Object.assign(Object.assign({}, options), { configType: env.toUpperCase(), mode: 'dev' }));
|
|
50
51
|
}
|
|
51
52
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storybook.impl.js","sourceRoot":"","sources":["../../../../../../packages/storybook/src/executors/storybook/storybook.impl.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"storybook.impl.js","sourceRoot":"","sources":["../../../../../../packages/storybook/src/executors/storybook/storybook.impl.ts"],"names":[],"mappings":";;;AAAA,uCAAqD;AACrD,gDAAgD;AAChD,yBAAuB;AACvB,qDAI+B;AAC/B,oCAA6E;AAI7E,SAA+B,iBAAiB,CAC9C,OAA6C,EAC7C,OAAwB;;;QAKxB,MAAM,UAAU,GAAG,IAAA,iCAAqB,GAAE,KAAK,CAAC,CAAC;QACjD,IAAA,sCAA0B,EAAC,OAAO,CAAC,SAAS,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;QACnE,IAAI,UAAU,EAAE;YACd,MAAM,YAAY,GAAe,OAAO,CAAC;YACzC,MAAM,MAAM,GAAG,sBAAM,WAAW,CAAC,YAAY,EAAE,UAAU,CAAC,CAAA,CAAC;YAC3D,4BAAM;gBACJ,OAAO,EAAE,IAAI;gBACb,IAAI,EAAE;oBACJ,IAAI,EAAE,MAAM,aAAN,MAAM,u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O,KACV,IAAI,EAAE,KAAK,IACX,CAAC;KACJ;SAAM;QACL,8BAA8B;QAC9B,OAAO,KAAK,CAAC,UAAU,CAAC,CAAC,gCACpB,OAAO,KACV,UAAU,EAAE,GAAG,CAAC,WAAW,EAAE,EAC7B,IAAI,EAAE,KAAK,GACL,CAAC,CAAC;KACX;AACH,CAAC"}
|
package/src/executors/utils.d.ts
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import 'dotenv/config';
|
|
2
2
|
import ts = require('typescript');
|
|
3
|
-
import { CommonNxStorybookConfig
|
|
3
|
+
import { CommonNxStorybookConfig } from '../utils/models';
|
|
4
4
|
import { CLIOptions } from '@storybook/types';
|
|
5
|
-
export
|
|
6
|
-
name: string;
|
|
7
|
-
version: string;
|
|
8
|
-
}
|
|
9
|
-
export declare function getStorybookFrameworkPath(uiFramework: UiFramework): any;
|
|
5
|
+
export declare function getStorybookFrameworkPath(uiFramework: any): any;
|
|
10
6
|
export declare function runStorybookSetupCheck(options: CLIOptions & CommonNxStorybookConfig): void;
|
|
11
|
-
export declare function pleaseUpgrade(): void;
|
|
12
7
|
export declare function builderIsWebpackButNotWebpack5(storybookConfig: ts.SourceFile): boolean;
|
package/src/executors/utils.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// TODO(katerina): Remove Nx17 - DELETE whole file
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.builderIsWebpackButNotWebpack5 = exports.
|
|
4
|
+
exports.builderIsWebpackButNotWebpack5 = exports.runStorybookSetupCheck = exports.getStorybookFrameworkPath = void 0;
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
6
|
const js_1 = require("@nx/js");
|
|
6
7
|
require("dotenv/config");
|
|
@@ -8,7 +9,6 @@ const fs_1 = require("fs");
|
|
|
8
9
|
const path_1 = require("path");
|
|
9
10
|
const semver_1 = require("semver");
|
|
10
11
|
const ts = require("typescript");
|
|
11
|
-
// TODO(katerina): Remove when Storybook 7
|
|
12
12
|
function getStorybookFrameworkPath(uiFramework) {
|
|
13
13
|
const serverOptionsPaths = {
|
|
14
14
|
'@storybook/react': '@storybook/react/dist/cjs/server/options',
|
|
@@ -26,7 +26,6 @@ function getStorybookFrameworkPath(uiFramework) {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
exports.getStorybookFrameworkPath = getStorybookFrameworkPath;
|
|
29
|
-
// TODO(katerina): Remove when Storybook 7
|
|
30
29
|
function isStorybookV62onwards(uiFramework) {
|
|
31
30
|
try {
|
|
32
31
|
const storybookPackageVersion = require((0, path_1.join)(uiFramework, 'package.json')).version;
|
|
@@ -46,23 +45,11 @@ function isStorybookV62onwards(uiFramework) {
|
|
|
46
45
|
}
|
|
47
46
|
}
|
|
48
47
|
}
|
|
49
|
-
// TODO(katerina): Remove when Storybook 7
|
|
50
48
|
function runStorybookSetupCheck(options) {
|
|
51
49
|
webpackFinalPropertyCheck(options);
|
|
52
50
|
reactWebpack5Check(options);
|
|
53
51
|
}
|
|
54
52
|
exports.runStorybookSetupCheck = runStorybookSetupCheck;
|
|
55
|
-
function pleaseUpgrade() {
|
|
56
|
-
devkit_1.logger.warn(`
|
|
57
|
-
Please consider upgrading to Storybook version 7,
|
|
58
|
-
as version 6 is no longer maintained.
|
|
59
|
-
|
|
60
|
-
Here is a guide on how to upgrade:
|
|
61
|
-
https://nx.dev/packages/storybook/generators/migrate-7
|
|
62
|
-
`);
|
|
63
|
-
}
|
|
64
|
-
exports.pleaseUpgrade = pleaseUpgrade;
|
|
65
|
-
// TODO(katerina): Remove when Storybook 7
|
|
66
53
|
function reactWebpack5Check(options) {
|
|
67
54
|
if (options.uiFramework === '@storybook/react') {
|
|
68
55
|
const source = mainJsTsFileContent(options.configDir);
|
|
@@ -81,7 +68,6 @@ function reactWebpack5Check(options) {
|
|
|
81
68
|
}
|
|
82
69
|
}
|
|
83
70
|
}
|
|
84
|
-
// TODO(katerina): Remove when Storybook 7
|
|
85
71
|
function mainJsTsFileContent(configFolder) {
|
|
86
72
|
let storybookConfigFilePath = (0, devkit_1.joinPathFragments)(configFolder, 'main.js');
|
|
87
73
|
if (!(0, fs_1.existsSync)(storybookConfigFilePath)) {
|
|
@@ -96,7 +82,6 @@ function mainJsTsFileContent(configFolder) {
|
|
|
96
82
|
});
|
|
97
83
|
return ts.createSourceFile(storybookConfigFilePath, storybookConfig, ts.ScriptTarget.Latest, true);
|
|
98
84
|
}
|
|
99
|
-
// TODO(katerina): Remove when Storybook 7
|
|
100
85
|
function webpackFinalPropertyCheck(options) {
|
|
101
86
|
let placesToCheck = [
|
|
102
87
|
{
|
|
@@ -125,7 +110,6 @@ function webpackFinalPropertyCheck(options) {
|
|
|
125
110
|
`);
|
|
126
111
|
}
|
|
127
112
|
}
|
|
128
|
-
// TODO(katerina): Remove when Storybook 7
|
|
129
113
|
function builderIsWebpackButNotWebpack5(storybookConfig) {
|
|
130
114
|
const importArray = (0, js_1.findNodes)(storybookConfig, [
|
|
131
115
|
ts.SyntaxKind.PropertyAssignment,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../packages/storybook/src/executors/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../packages/storybook/src/executors/utils.ts"],"names":[],"mappings":";AAAA,kDAAkD;;;AAElD,uCAAuD;AACvD,+BAAmC;AACnC,yBAAuB;AACvB,2BAA8C;AAC9C,+BAA4B;AAC5B,mCAA6B;AAC7B,iCAAkC;AAIlC,SAAgB,yBAAyB,CAAC,WAAW;IACnD,MAAM,kBAAkB,GAAG;QACzB,kBAAkB,EAAE,0CAA0C;QAC9D,iBAAiB,EAAE,yCAAyC;QAC5D,gBAAgB,EAAE,wCAAwC;QAC1D,iBAAiB,EAAE,yCAAyC;QAC5D,2BAA2B,EACzB,mDAAmD;QACrD,mBAAmB,EAAE,2CAA2C;KACjE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AAM,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;;;IAItD,OAAO,CAAC,WAAW,KAAK,kBAAkB;YACxC,CAAC,CAAC,sDAAsD;YACxD,CAAC,CAAC,wDACN;KACG,CACA,CAAC;KACH;AACH,CAAC;AAED,SAAgB,8BAA8B,CAC5C,eAA8B;IAE9B,MAAM,WAAW,GAAG,IAAA,cAAS,EAAC,eAAe,EAAE;QAC7C,EAAE,CAAC,UAAU,CAAC,kBAAkB;KACjC,CAAC,CAAC;IACH,IAAI,oBAAoB,GAAG,KAAK,CAAC;IACjC,WAAW,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;;QAC7B,MAAM,UAAU,GAAG,IAAA,cAAS,EAAC,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;QAC/D,MAAM,SAAS,GAAG,IAAA,cAAS,EAAC,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;QACjE,MAAM,WAAW,GAAG,MAAA,MAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAG,CAAC,CAAC,0CAAE,OAAO,EAAE,mCAAI,EAAE,CAAC;QACpD,IACE,CAAA,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAG,CAAC,CAAC,0CAAE,OAAO,EAAE,MAAK,SAAS;YACxC,WAAW,CAAC,QAAQ,CAAC,SAAS,CAAC;YAC/B,CAAC,WAAW,CAAC,QAAQ,CAAC,UAAU,CAAC,EACjC;YACA,oBAAoB,GAAG,IAAI,CAAC;SAC7B;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,oBAAoB,CAAC;AAC9B,CAAC;AArBD,wEAqBC"}
|
|
@@ -10,26 +10,11 @@ const linter_1 = require("@nx/linter");
|
|
|
10
10
|
const utilities_1 = require("../../utils/utilities");
|
|
11
11
|
const versions_1 = require("../../utils/versions");
|
|
12
12
|
const user_prompts_1 = require("./lib/user-prompts");
|
|
13
|
-
const utils_1 = require("../../executors/utils");
|
|
14
13
|
function configurationGenerator(tree, rawSchema) {
|
|
15
|
-
var _a, _b
|
|
14
|
+
var _a, _b;
|
|
16
15
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
* with the wrong version.
|
|
20
|
-
*/
|
|
21
|
-
let storybook7 = (0, utilities_1.storybookMajorVersion)() === 7 || rawSchema.storybook7Configuration;
|
|
22
|
-
if ((0, utilities_1.storybookMajorVersion)() === 6 && rawSchema.storybook7Configuration) {
|
|
23
|
-
devkit_1.logger.error(`You are using Storybook version 6.
|
|
24
|
-
So Nx will configure Storybook for version 6.`);
|
|
25
|
-
(0, utils_1.pleaseUpgrade)();
|
|
26
|
-
rawSchema.storybook7Configuration = false;
|
|
27
|
-
storybook7 = false;
|
|
28
|
-
}
|
|
29
|
-
if (storybook7 && !rawSchema.storybook7Configuration) {
|
|
30
|
-
rawSchema.storybook7Configuration = true;
|
|
31
|
-
devkit_1.logger.info(`You are using Storybook version 7.
|
|
32
|
-
So Nx will configure Storybook for version 7.`);
|
|
16
|
+
if ((0, utilities_1.storybookMajorVersion)() === 6) {
|
|
17
|
+
throw new Error((0, utilities_1.pleaseUpgrade)());
|
|
33
18
|
}
|
|
34
19
|
if (process.env.NX_INTERACTIVE === 'true') {
|
|
35
20
|
rawSchema = yield (0, user_prompts_1.getGeneratorConfigurationOptions)(rawSchema);
|
|
@@ -40,94 +25,39 @@ function configurationGenerator(tree, rawSchema) {
|
|
|
40
25
|
const { nextBuildTarget, compiler, viteBuildTarget } = (0, utilities_1.findStorybookAndBuildTargetsAndCompiler)(targets);
|
|
41
26
|
let viteConfigFilePath;
|
|
42
27
|
if (viteBuildTarget) {
|
|
43
|
-
if (schema.bundler !== 'vite') {
|
|
44
|
-
if (!storybook7) {
|
|
45
|
-
// The warnings for v7 are handled in the next if statement
|
|
46
|
-
devkit_1.logger.info(`Your project ${schema.name} uses Vite as a bundler.
|
|
47
|
-
Nx will configure Storybook for this project to use Vite as well.`);
|
|
48
|
-
}
|
|
49
|
-
// We need this regardless of Storybook version
|
|
50
|
-
// because we use it in the init task
|
|
51
|
-
schema.bundler = 'vite';
|
|
52
|
-
}
|
|
53
28
|
viteConfigFilePath = (0, util_functions_1.getViteConfigFilePath)(tree, root, (_b = (_a = targets[viteBuildTarget]) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.configFile);
|
|
54
29
|
}
|
|
55
|
-
if (
|
|
56
|
-
if (
|
|
57
|
-
|
|
58
|
-
devkit_1.logger.info(`Your project ${schema.name} uses Vite as a bundler.
|
|
59
|
-
Nx will configure Storybook for this project to use Vite as well.`);
|
|
60
|
-
schema.storybook7UiFramework = '@storybook/react-vite';
|
|
61
|
-
}
|
|
62
|
-
if (schema.storybook7UiFramework === '@storybook/web-components-webpack5') {
|
|
63
|
-
devkit_1.logger.info(`Your project ${schema.name} uses Vite as a bundler.
|
|
30
|
+
if (viteBuildTarget) {
|
|
31
|
+
if (schema.uiFramework === '@storybook/react-webpack5') {
|
|
32
|
+
devkit_1.logger.info(`Your project ${schema.name} uses Vite as a bundler.
|
|
64
33
|
Nx will configure Storybook for this project to use Vite as well.`);
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
if (nextBuildTarget) {
|
|
69
|
-
schema.storybook7UiFramework = '@storybook/nextjs';
|
|
34
|
+
schema.uiFramework = '@storybook/react-vite';
|
|
70
35
|
}
|
|
71
|
-
if (
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
: '@storybook/react-webpack5';
|
|
76
|
-
}
|
|
77
|
-
else if (schema.uiFramework === '@storybook/web-components') {
|
|
78
|
-
schema.storybook7UiFramework = viteBuildTarget
|
|
79
|
-
? '@storybook/web-components-vite'
|
|
80
|
-
: '@storybook/web-components-webpack5';
|
|
81
|
-
}
|
|
82
|
-
else if (schema.uiFramework === '@storybook/angular') {
|
|
83
|
-
schema.storybook7UiFramework = '@storybook/angular';
|
|
84
|
-
}
|
|
85
|
-
else if (schema.uiFramework !== '@storybook/react-native') {
|
|
86
|
-
schema.storybook7UiFramework = `${schema.uiFramework}-webpack5`;
|
|
87
|
-
}
|
|
36
|
+
if (schema.uiFramework === '@storybook/web-components-webpack5') {
|
|
37
|
+
devkit_1.logger.info(`Your project ${schema.name} uses Vite as a bundler.
|
|
38
|
+
Nx will configure Storybook for this project to use Vite as well.`);
|
|
39
|
+
schema.uiFramework = '@storybook/web-components-vite';
|
|
88
40
|
}
|
|
89
41
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
if ((_c = schema.storybook7UiFramework) === null || _c === void 0 ? void 0 : _c.startsWith('@storybook/react')) {
|
|
93
|
-
schema.uiFramework = '@storybook/react';
|
|
94
|
-
}
|
|
95
|
-
else if ((_d = schema.storybook7UiFramework) === null || _d === void 0 ? void 0 : _d.startsWith('@storybook/web-components')) {
|
|
96
|
-
schema.uiFramework = '@storybook/web-components';
|
|
97
|
-
}
|
|
98
|
-
else if (schema.storybook7UiFramework === '@storybook/angular') {
|
|
99
|
-
schema.uiFramework = '@storybook/angular';
|
|
100
|
-
}
|
|
101
|
-
else if ((_e = schema.storybook7UiFramework) === null || _e === void 0 ? void 0 : _e.startsWith('@storybook/react-native')) {
|
|
102
|
-
schema.uiFramework = '@storybook/react-native';
|
|
103
|
-
}
|
|
104
|
-
else {
|
|
105
|
-
devkit_1.logger.error(`You have to specify a uiFramework for Storybook version 6.`);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
42
|
+
if (nextBuildTarget) {
|
|
43
|
+
schema.uiFramework = '@storybook/nextjs';
|
|
108
44
|
}
|
|
109
|
-
// If we're on Storybook 7, ignore schema.uiFramework
|
|
110
|
-
const uiFrameworkUsed = storybook7
|
|
111
|
-
? schema.storybook7UiFramework
|
|
112
|
-
: schema.uiFramework;
|
|
113
45
|
const initTask = yield (0, init_1.initGenerator)(tree, {
|
|
114
|
-
uiFramework:
|
|
46
|
+
uiFramework: schema.uiFramework,
|
|
115
47
|
js: schema.js,
|
|
116
|
-
bundler: schema.bundler,
|
|
117
|
-
storybook7Configuration: storybook7,
|
|
118
48
|
});
|
|
119
49
|
tasks.push(initTask);
|
|
120
|
-
(0, util_functions_1.createProjectStorybookDir)(tree, schema.name,
|
|
50
|
+
(0, util_functions_1.createProjectStorybookDir)(tree, schema.name, schema.uiFramework, schema.js, schema.tsConfiguration, root, projectType, (0, util_functions_1.projectIsRootProjectInStandaloneWorkspace)(root), !!nextBuildTarget, compiler === 'swc', !!viteBuildTarget, viteConfigFilePath);
|
|
121
51
|
(0, util_functions_1.configureTsProjectConfig)(tree, schema);
|
|
122
52
|
(0, util_functions_1.configureTsSolutionConfig)(tree, schema);
|
|
123
53
|
(0, util_functions_1.updateLintConfig)(tree, schema);
|
|
124
54
|
(0, util_functions_1.addBuildStorybookToCacheableOperations)(tree);
|
|
125
55
|
(0, util_functions_1.addStorybookToNamedInputs)(tree);
|
|
126
|
-
if (
|
|
56
|
+
if (schema.uiFramework === '@storybook/angular') {
|
|
127
57
|
(0, util_functions_1.addAngularStorybookTask)(tree, schema.name, schema.configureTestRunner);
|
|
128
58
|
}
|
|
129
59
|
else {
|
|
130
|
-
(0, util_functions_1.addStorybookTask)(tree, schema.name,
|
|
60
|
+
(0, util_functions_1.addStorybookTask)(tree, schema.name, schema.uiFramework, schema.configureTestRunner);
|
|
131
61
|
}
|
|
132
62
|
if (schema.configureStaticServe) {
|
|
133
63
|
(0, util_functions_1.addStaticTarget)(tree, schema);
|
|
@@ -157,13 +87,6 @@ function configurationGenerator(tree, rawSchema) {
|
|
|
157
87
|
devDeps['@storybook/core-common'] = versions_1.storybookVersion;
|
|
158
88
|
devDeps['ts-node'] = versions_1.tsNodeVersion;
|
|
159
89
|
}
|
|
160
|
-
if (nextBuildTarget && projectType === 'application' && !storybook7) {
|
|
161
|
-
devDeps['storybook-addon-next'] = versions_1.storybookNextAddonVersion;
|
|
162
|
-
devDeps['storybook-addon-swc'] = versions_1.storybookSwcAddonVersion;
|
|
163
|
-
}
|
|
164
|
-
else if (compiler === 'swc' && !storybook7) {
|
|
165
|
-
devDeps['storybook-addon-swc'] = versions_1.storybookSwcAddonVersion;
|
|
166
|
-
}
|
|
167
90
|
if (schema.configureTestRunner === true) {
|
|
168
91
|
devDeps['@storybook/test-runner'] = versions_1.storybookTestRunnerVersion;
|
|
169
92
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configuration.js","sourceRoot":"","sources":["../../../../../../packages/storybook/src/generators/configuration/configuration.ts"],"names":[],"mappings":";;;;AAAA,uCASoB;AAEpB,wEAA6E;AAE7E,uCAA6C;AAE7C,yDAa8B;AAC9B,uCAAoC;AACpC,
|
|
1
|
+
{"version":3,"file":"configuration.js","sourceRoot":"","sources":["../../../../../../packages/storybook/src/generators/configuration/configuration.ts"],"names":[],"mappings":";;;;AAAA,uCASoB;AAEpB,wEAA6E;AAE7E,uCAA6C;AAE7C,yDAa8B;AAC9B,uCAAoC;AACpC,qDAI+B;AAC/B,mDAK8B;AAC9B,qDAAsE;AAEtE,SAAsB,sBAAsB,CAC1C,IAAU,EACV,SAAmC;;;QAEnC,IAAI,IAAA,iCAAqB,GAAE,KAAK,CAAC,EAAE;YACjC,MAAM,IAAI,KAAK,CAAC,IAAA,yBAAa,GAAE,CAAC,CAAC;SAClC;QAED,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc,KAAK,MAAM,EAAE;YACzC,SAAS,GAAG,MAAM,IAAA,+CAAgC,EAAC,SAAS,CAAC,CAAC;SAC/D;QAED,MAAM,MAAM,GAAG,eAAe,CAAC,SAAS,CAAC,CAAC;QAE1C,MAAM,KAAK,GAAwB,EAAE,CAAC;QAEtC,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,IAAA,iCAAwB,EAC7D,IAAI,EACJ,MAAM,CAAC,IAAI,CACZ,CAAC;QACF,MAAM,EAAE,eAAe,EAAE,QAAQ,E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gBACL,eAAM,CAAC,IAAI,CACT,6CAA6C,MAAM,CAAC,IAAI,YAAY,UAAU,GAAG,CAClF,CAAC;aACH;SACF;QAED,MAAM,OAAO,GAAG,EAAE,CAAC;QAEnB,IAAI,MAAM,CAAC,eAAe,EAAE;YAC1B,OAAO,CAAC,wBAAwB,CAAC,GAAG,2BAAgB,CAAC;YACrD,OAAO,CAAC,SAAS,CAAC,GAAG,wBAAa,CAAC;SACpC;QAED,IAAI,MAAM,CAAC,mBAAmB,KAAK,IAAI,EAAE;YACvC,OAAO,CAAC,wBAAwB,CAAC,GAAG,qCAA0B,CAAC;SAChE;QACD,IAAI,MAAM,CAAC,oBAAoB,EAAE;YAC/B,OAAO,CAAC,SAAS,CAAC,GAAG,oBAAS,CAAC;SAChC;QAED,KAAK,CAAC,IAAI,CAAC,IAAA,qCAA4B,EAAC,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC;QAE5D,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE;YACtB,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;SACzB;QAED,OAAO,IAAA,yBAAgB,EAAC,GAAG,KAAK,CAAC,CAAC;;CACnC;AA5ID,wDA4IC;AAED,SAAS,eAAe,CACtB,MAAgC;IAEhC,MAAM,QAAQ,GAAG;QACf,gBAAgB,EAAE,IAAI;QACtB,MAAM,EAAE,eAAM,CAAC,MAAM;QACrB,EAAE,EAAE,KAAK;KACV,CAAC;IACF,uCACK,QAAQ,GACR,MAAM,EACT;AACJ,CAAC;AAED,kBAAe,sBAAsB,CAAC;AACzB,QAAA,sBAAsB,GAAG,IAAA,2BAAkB,EACtD,sBAAsB,CACvB,CAAC"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { UiFramework7 } from '../../../utils/models';
|
|
2
2
|
import { StorybookConfigureSchema } from '../schema';
|
|
3
3
|
export declare function getGeneratorConfigurationOptions(rawSchema: StorybookConfigureSchema): Promise<StorybookConfigureSchema>;
|
|
4
|
-
export declare function getBundler(): Promise<'vite' | 'webpack'>;
|
|
5
4
|
export declare function getStorybook7Framework(): Promise<UiFramework7>;
|
|
6
|
-
export declare function getStorybook6Framework(): Promise<UiFramework>;
|
|
@@ -1,82 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getStorybook7Framework = exports.getGeneratorConfigurationOptions = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const utilities_1 = require("../../../utils/utilities");
|
|
6
6
|
const enquirer_1 = require("enquirer");
|
|
7
7
|
function getGeneratorConfigurationOptions(rawSchema) {
|
|
8
8
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
9
|
-
if (rawSchema.
|
|
10
|
-
|
|
11
|
-
rawSchema.storybook7UiFramework = yield getStorybook7Framework();
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
if (!rawSchema.uiFramework) {
|
|
16
|
-
rawSchema.uiFramework = yield getStorybook6Framework();
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
if ((rawSchema === null || rawSchema === void 0 ? void 0 : rawSchema.uiFramework) === '@storybook/react' ||
|
|
20
|
-
(rawSchema === null || rawSchema === void 0 ? void 0 : rawSchema.uiFramework) === '@storybook/web-components') {
|
|
21
|
-
if (!(rawSchema === null || rawSchema === void 0 ? void 0 : rawSchema.bundler)) {
|
|
22
|
-
rawSchema.bundler = yield getBundler();
|
|
23
|
-
}
|
|
9
|
+
if (!rawSchema.uiFramework) {
|
|
10
|
+
rawSchema.uiFramework = yield getStorybook7Framework();
|
|
24
11
|
}
|
|
25
12
|
return rawSchema;
|
|
26
13
|
});
|
|
27
14
|
}
|
|
28
15
|
exports.getGeneratorConfigurationOptions = getGeneratorConfigurationOptions;
|
|
29
|
-
function getBundler() {
|
|
30
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
const a = yield (0, enquirer_1.prompt)([
|
|
32
|
-
{
|
|
33
|
-
name: 'bundler',
|
|
34
|
-
message: `Choose the builder you want to use for Storybook`,
|
|
35
|
-
type: 'autocomplete',
|
|
36
|
-
choices: [
|
|
37
|
-
{
|
|
38
|
-
name: 'vite',
|
|
39
|
-
message: 'Use Vite.js with the @storybook/builder-vite package',
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
name: 'webpack',
|
|
43
|
-
message: 'Use Webpack 5 with the @storybook/builder-webpack5 package',
|
|
44
|
-
},
|
|
45
|
-
],
|
|
46
|
-
},
|
|
47
|
-
]);
|
|
48
|
-
return a.bundler;
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
exports.getBundler = getBundler;
|
|
52
16
|
function getStorybook7Framework() {
|
|
53
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
54
|
-
const a = yield (0, enquirer_1.prompt)([
|
|
55
|
-
{
|
|
56
|
-
name: 'UiFramework7',
|
|
57
|
-
message: `Choose the Storybook 7 framework that you need to use`,
|
|
58
|
-
type: 'autocomplete',
|
|
59
|
-
choices: [
|
|
60
|
-
...utilities_1.Constants.uiFrameworks7.map((uiFramework7) => ({
|
|
61
|
-
name: uiFramework7,
|
|
62
|
-
message: uiFramework7,
|
|
63
|
-
})),
|
|
64
|
-
],
|
|
65
|
-
},
|
|
66
|
-
]);
|
|
67
|
-
return a.UiFramework7;
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
exports.getStorybook7Framework = getStorybook7Framework;
|
|
71
|
-
function getStorybook6Framework() {
|
|
72
17
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
73
18
|
const a = yield (0, enquirer_1.prompt)([
|
|
74
19
|
{
|
|
75
20
|
name: 'UiFramework',
|
|
76
|
-
message: `Choose the Storybook framework that you need to use`,
|
|
21
|
+
message: `Choose the Storybook 7 framework that you need to use`,
|
|
77
22
|
type: 'autocomplete',
|
|
78
23
|
choices: [
|
|
79
|
-
...
|
|
24
|
+
...utilities_1.Constants.uiFrameworks7.map((uiFramework) => ({
|
|
80
25
|
name: uiFramework,
|
|
81
26
|
message: uiFramework,
|
|
82
27
|
})),
|
|
@@ -86,5 +31,5 @@ function getStorybook6Framework() {
|
|
|
86
31
|
return a.UiFramework;
|
|
87
32
|
});
|
|
88
33
|
}
|
|
89
|
-
exports.
|
|
34
|
+
exports.getStorybook7Framework = getStorybook7Framework;
|
|
90
35
|
//# sourceMappingURL=user-prompts.js.map
|