@nx/storybook 16.0.0-beta.1
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/CHANGELOG.md +8 -0
- package/LICENSE +22 -0
- package/README.md +63 -0
- package/executors.json +26 -0
- package/generators.json +58 -0
- package/index.d.ts +3 -0
- package/index.js +10 -0
- package/index.js.map +1 -0
- package/migrations.json +294 -0
- package/package.json +49 -0
- package/presets/cypress.d.ts +22 -0
- package/presets/cypress.js +9 -0
- package/presets/cypress.js.map +1 -0
- package/src/executors/build-storybook/build-storybook.impl.d.ts +7 -0
- package/src/executors/build-storybook/build-storybook.impl.js +58 -0
- package/src/executors/build-storybook/build-storybook.impl.js.map +1 -0
- package/src/executors/build-storybook/compat.d.ts +2 -0
- package/src/executors/build-storybook/compat.js +6 -0
- package/src/executors/build-storybook/compat.js.map +1 -0
- package/src/executors/build-storybook/schema.json +122 -0
- package/src/executors/storybook/compat.d.ts +2 -0
- package/src/executors/storybook/compat.js +6 -0
- package/src/executors/storybook/compat.js.map +1 -0
- package/src/executors/storybook/schema.json +94 -0
- package/src/executors/storybook/storybook.impl.d.ts +11 -0
- package/src/executors/storybook/storybook.impl.js +53 -0
- package/src/executors/storybook/storybook.impl.js.map +1 -0
- package/src/executors/utils.d.ts +12 -0
- package/src/executors/utils.js +148 -0
- package/src/executors/utils.js.map +1 -0
- package/src/generators/configuration/configuration.d.ts +5 -0
- package/src/generators/configuration/configuration.js +191 -0
- package/src/generators/configuration/configuration.js.map +1 -0
- package/src/generators/configuration/lib/user-prompts.d.ts +6 -0
- package/src/generators/configuration/lib/user-prompts.js +90 -0
- package/src/generators/configuration/lib/user-prompts.js.map +1 -0
- package/src/generators/configuration/lib/util-functions.d.ts +27 -0
- package/src/generators/configuration/lib/util-functions.js +359 -0
- package/src/generators/configuration/lib/util-functions.js.map +1 -0
- package/src/generators/configuration/project-files/.storybook/main.js__tmpl__ +46 -0
- package/src/generators/configuration/project-files/.storybook/preview.js__tmpl__ +0 -0
- package/src/generators/configuration/project-files/.storybook/tsconfig.json__tmpl__ +26 -0
- package/src/generators/configuration/project-files-7/.storybook/main.js__tmpl__ +34 -0
- package/src/generators/configuration/project-files-7/.storybook/preview.js__tmpl__ +0 -0
- package/src/generators/configuration/project-files-7/.storybook/tsconfig.json__tmpl__ +26 -0
- package/src/generators/configuration/project-files-7-ts/.storybook/main.ts__tmpl__ +36 -0
- 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__ +28 -0
- package/src/generators/configuration/project-files-ts/.storybook/main.ts__tmpl__ +49 -0
- package/src/generators/configuration/project-files-ts/.storybook/preview.ts__tmpl__ +0 -0
- package/src/generators/configuration/project-files-ts/.storybook/tsconfig.json__tmpl__ +28 -0
- package/src/generators/configuration/schema.d.ts +19 -0
- package/src/generators/configuration/schema.json +124 -0
- package/src/generators/cypress-project/cypress-project.d.ts +14 -0
- package/src/generators/cypress-project/cypress-project.js +98 -0
- package/src/generators/cypress-project/cypress-project.js.map +1 -0
- package/src/generators/cypress-project/files/cypress.config.ts__tpl__ +6 -0
- package/src/generators/cypress-project/schema.json +55 -0
- package/src/generators/init/init.d.ts +5 -0
- package/src/generators/init/init.js +181 -0
- package/src/generators/init/init.js.map +1 -0
- package/src/generators/init/schema.d.ts +8 -0
- package/src/generators/init/schema.json +60 -0
- package/src/generators/migrate-7/calling-storybook-cli.d.ts +13 -0
- package/src/generators/migrate-7/calling-storybook-cli.js +85 -0
- package/src/generators/migrate-7/calling-storybook-cli.js.map +1 -0
- package/src/generators/migrate-7/files/storybook-migration-summary.md__tmpl__ +80 -0
- package/src/generators/migrate-7/helper-functions.d.ts +69 -0
- package/src/generators/migrate-7/helper-functions.js +449 -0
- package/src/generators/migrate-7/helper-functions.js.map +1 -0
- package/src/generators/migrate-7/migrate-7.d.ts +5 -0
- package/src/generators/migrate-7/migrate-7.js +73 -0
- package/src/generators/migrate-7/migrate-7.js.map +1 -0
- package/src/generators/migrate-7/schema.d.ts +9 -0
- package/src/generators/migrate-7/schema.json +35 -0
- package/src/migrations/update-13-4-6/set-project-build-config.d.ts +2 -0
- package/src/migrations/update-13-4-6/set-project-build-config.js +61 -0
- package/src/migrations/update-13-4-6/set-project-build-config.js.map +1 -0
- package/src/migrations/update-14-0-0/migrate-defaults-5-to-6/migrate-defaults-5-to-6.d.ts +6 -0
- package/src/migrations/update-14-0-0/migrate-defaults-5-to-6/migrate-defaults-5-to-6.js +120 -0
- package/src/migrations/update-14-0-0/migrate-defaults-5-to-6/migrate-defaults-5-to-6.js.map +1 -0
- package/src/migrations/update-14-0-0/migrate-stories-to-6-2/migrate-stories-to-6-2.d.ts +8 -0
- package/src/migrations/update-14-0-0/migrate-stories-to-6-2/migrate-stories-to-6-2.js +294 -0
- package/src/migrations/update-14-0-0/migrate-stories-to-6-2/migrate-stories-to-6-2.js.map +1 -0
- package/src/migrations/update-14-0-0/migrate-to-storybook-6.d.ts +2 -0
- package/src/migrations/update-14-0-0/migrate-to-storybook-6.js +13 -0
- package/src/migrations/update-14-0-0/migrate-to-storybook-6.js.map +1 -0
- package/src/migrations/update-14-1-8/change-storybook-targets-generator.d.ts +4 -0
- package/src/migrations/update-14-1-8/change-storybook-targets-generator.js +105 -0
- package/src/migrations/update-14-1-8/change-storybook-targets-generator.js.map +1 -0
- package/src/migrations/update-14-1-8/change-storybook-targets.d.ts +2 -0
- package/src/migrations/update-14-1-8/change-storybook-targets.js +11 -0
- package/src/migrations/update-14-1-8/change-storybook-targets.js.map +1 -0
- package/src/migrations/update-15-0-0/add-storybook-inputs.d.ts +2 -0
- package/src/migrations/update-15-0-0/add-storybook-inputs.js +47 -0
- package/src/migrations/update-15-0-0/add-storybook-inputs.js.map +1 -0
- package/src/migrations/update-15-4-6/refactor-executor-options.d.ts +2 -0
- package/src/migrations/update-15-4-6/refactor-executor-options.js +67 -0
- package/src/migrations/update-15-4-6/refactor-executor-options.js.map +1 -0
- package/src/migrations/update-15-5-3/ensure-webpack-package.d.ts +2 -0
- package/src/migrations/update-15-5-3/ensure-webpack-package.js +33 -0
- package/src/migrations/update-15-5-3/ensure-webpack-package.js.map +1 -0
- package/src/migrations/update-15-7-0/add-addon-essentials-to-all.d.ts +24 -0
- package/src/migrations/update-15-7-0/add-addon-essentials-to-all.js +278 -0
- package/src/migrations/update-15-7-0/add-addon-essentials-to-all.js.map +1 -0
- package/src/migrations/update-15-7-0/remove-root-config.d.ts +14 -0
- package/src/migrations/update-15-7-0/remove-root-config.js +210 -0
- package/src/migrations/update-15-7-0/remove-root-config.js.map +1 -0
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +2 -0
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +13 -0
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js.map +1 -0
- package/src/utils/models.d.ts +5 -0
- package/src/utils/models.js +3 -0
- package/src/utils/models.js.map +1 -0
- package/src/utils/test-configs/.storybook/main.js +8 -0
- package/src/utils/test-configs/.storybook/tsconfig.json +19 -0
- package/src/utils/testing.d.ts +3 -0
- package/src/utils/testing.js +38 -0
- package/src/utils/testing.js.map +1 -0
- package/src/utils/utilities.d.ts +53 -0
- package/src/utils/utilities.js +255 -0
- package/src/utils/utilities.js.map +1 -0
- package/src/utils/versions.d.ts +20 -0
- package/src/utils/versions.js +24 -0
- package/src/utils/versions.js.map +1 -0
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getViteConfigFilePath = exports.getE2EProjectName = exports.rootFileIsTs = exports.workspaceHasRootProject = exports.projectIsRootProjectInStandaloneWorkspace = exports.addBuildStorybookToCacheableOperations = exports.getTsConfigPath = exports.createProjectStorybookDir = exports.addStorybookToNamedInputs = exports.normalizeSchema = exports.updateLintConfig = exports.configureTsSolutionConfig = exports.configureTsProjectConfig = exports.addStaticTarget = exports.addAngularStorybookTask = exports.addStorybookTask = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
|
|
7
|
+
const linter_1 = require("@nx/linter");
|
|
8
|
+
const path_1 = require("path");
|
|
9
|
+
const utilities_1 = require("../../../utils/utilities");
|
|
10
|
+
const versions_1 = require("../../../utils/versions");
|
|
11
|
+
const DEFAULT_PORT = 4400;
|
|
12
|
+
function addStorybookTask(tree, projectName, uiFramework, configureTestRunner, usesV7) {
|
|
13
|
+
if (uiFramework === '@storybook/react-native') {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
17
|
+
projectConfig.targets['storybook'] = {
|
|
18
|
+
executor: '@nrwl/storybook:storybook',
|
|
19
|
+
options: {
|
|
20
|
+
port: DEFAULT_PORT,
|
|
21
|
+
configDir: `${projectConfig.root}/.storybook`,
|
|
22
|
+
},
|
|
23
|
+
configurations: {
|
|
24
|
+
ci: {
|
|
25
|
+
quiet: true,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
projectConfig.targets['build-storybook'] = {
|
|
30
|
+
executor: '@nrwl/storybook:build',
|
|
31
|
+
outputs: ['{options.outputDir}'],
|
|
32
|
+
options: {
|
|
33
|
+
outputDir: (0, devkit_1.joinPathFragments)('dist/storybook', projectName),
|
|
34
|
+
configDir: `${projectConfig.root}/.storybook`,
|
|
35
|
+
},
|
|
36
|
+
configurations: {
|
|
37
|
+
ci: {
|
|
38
|
+
quiet: true,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
if (!usesV7) {
|
|
43
|
+
projectConfig.targets['storybook'].options.uiFramework = uiFramework;
|
|
44
|
+
projectConfig.targets['build-storybook'].options.uiFramework = uiFramework;
|
|
45
|
+
}
|
|
46
|
+
if (configureTestRunner === true) {
|
|
47
|
+
projectConfig.targets['test-storybook'] = {
|
|
48
|
+
executor: 'nx:run-commands',
|
|
49
|
+
options: {
|
|
50
|
+
command: `test-storybook -c ${projectConfig.root}/.storybook --url=http://localhost:${DEFAULT_PORT}`,
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
(0, devkit_1.updateProjectConfiguration)(tree, projectName, projectConfig);
|
|
55
|
+
}
|
|
56
|
+
exports.addStorybookTask = addStorybookTask;
|
|
57
|
+
function addAngularStorybookTask(tree, projectName, configureTestRunner) {
|
|
58
|
+
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
59
|
+
const { ngBuildTarget } = (0, utilities_1.findStorybookAndBuildTargetsAndCompiler)(projectConfig.targets);
|
|
60
|
+
projectConfig.targets['storybook'] = {
|
|
61
|
+
executor: '@storybook/angular:start-storybook',
|
|
62
|
+
options: {
|
|
63
|
+
port: 4400,
|
|
64
|
+
configDir: `${projectConfig.root}/.storybook`,
|
|
65
|
+
browserTarget: `${projectName}:${ngBuildTarget ? 'build' : 'build-storybook'}`,
|
|
66
|
+
compodoc: false,
|
|
67
|
+
},
|
|
68
|
+
configurations: {
|
|
69
|
+
ci: {
|
|
70
|
+
quiet: true,
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
projectConfig.targets['build-storybook'] = {
|
|
75
|
+
executor: '@storybook/angular:build-storybook',
|
|
76
|
+
outputs: ['{options.outputDir}'],
|
|
77
|
+
options: {
|
|
78
|
+
outputDir: (0, devkit_1.joinPathFragments)('dist/storybook', projectName),
|
|
79
|
+
configDir: `${projectConfig.root}/.storybook`,
|
|
80
|
+
browserTarget: `${projectName}:${ngBuildTarget ? 'build' : 'build-storybook'}`,
|
|
81
|
+
compodoc: false,
|
|
82
|
+
},
|
|
83
|
+
configurations: {
|
|
84
|
+
ci: {
|
|
85
|
+
quiet: true,
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
if (configureTestRunner === true) {
|
|
90
|
+
projectConfig.targets['test-storybook'] = {
|
|
91
|
+
executor: 'nx:run-commands',
|
|
92
|
+
options: {
|
|
93
|
+
command: `test-storybook -c ${projectConfig.root}/.storybook --url=http://localhost:${DEFAULT_PORT}`,
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
(0, devkit_1.updateProjectConfiguration)(tree, projectName, projectConfig);
|
|
98
|
+
}
|
|
99
|
+
exports.addAngularStorybookTask = addAngularStorybookTask;
|
|
100
|
+
function addStaticTarget(tree, opts) {
|
|
101
|
+
const nrwlWeb = (0, devkit_1.ensurePackage)('@nx/web', versions_1.nxVersion);
|
|
102
|
+
nrwlWeb.webStaticServeGenerator(tree, {
|
|
103
|
+
buildTarget: `${opts.name}:build-storybook`,
|
|
104
|
+
outputPath: (0, devkit_1.joinPathFragments)('dist/storybook', opts.name),
|
|
105
|
+
targetName: 'static-storybook',
|
|
106
|
+
});
|
|
107
|
+
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, opts.name);
|
|
108
|
+
projectConfig.targets['static-storybook'].configurations = {
|
|
109
|
+
ci: {
|
|
110
|
+
buildTarget: `${opts.name}:build-storybook:ci`,
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
(0, devkit_1.updateProjectConfiguration)(tree, opts.name, projectConfig);
|
|
114
|
+
}
|
|
115
|
+
exports.addStaticTarget = addStaticTarget;
|
|
116
|
+
function configureTsProjectConfig(tree, schema) {
|
|
117
|
+
var _a, _b, _c;
|
|
118
|
+
const { name: projectName } = schema;
|
|
119
|
+
let tsConfigPath;
|
|
120
|
+
let tsConfigContent;
|
|
121
|
+
try {
|
|
122
|
+
tsConfigPath = getTsConfigPath(tree, projectName);
|
|
123
|
+
tsConfigContent = (0, devkit_1.readJson)(tree, tsConfigPath);
|
|
124
|
+
}
|
|
125
|
+
catch (_d) {
|
|
126
|
+
/**
|
|
127
|
+
* Custom app configurations
|
|
128
|
+
* may contain a tsconfig.json
|
|
129
|
+
* instead of a tsconfig.app.json.
|
|
130
|
+
*/
|
|
131
|
+
tsConfigPath = getTsConfigPath(tree, projectName, 'tsconfig.json');
|
|
132
|
+
tsConfigContent = (0, devkit_1.readJson)(tree, tsConfigPath);
|
|
133
|
+
}
|
|
134
|
+
if (!((_a = tsConfigContent === null || tsConfigContent === void 0 ? void 0 : tsConfigContent.exclude) === null || _a === void 0 ? void 0 : _a.includes('**/*.stories.ts')) &&
|
|
135
|
+
!((_b = tsConfigContent === null || tsConfigContent === void 0 ? void 0 : tsConfigContent.exclude) === null || _b === void 0 ? void 0 : _b.includes('**/*.stories.js'))) {
|
|
136
|
+
tsConfigContent.exclude = [
|
|
137
|
+
...(tsConfigContent.exclude || []),
|
|
138
|
+
'**/*.stories.ts',
|
|
139
|
+
'**/*.stories.js',
|
|
140
|
+
...(schema.uiFramework === '@storybook/react' ||
|
|
141
|
+
schema.uiFramework === '@storybook/react-native' ||
|
|
142
|
+
((_c = schema.storybook7UiFramework) === null || _c === void 0 ? void 0 : _c.startsWith('@storybook/react'))
|
|
143
|
+
? ['**/*.stories.jsx', '**/*.stories.tsx']
|
|
144
|
+
: []),
|
|
145
|
+
];
|
|
146
|
+
}
|
|
147
|
+
(0, devkit_1.writeJson)(tree, tsConfigPath, tsConfigContent);
|
|
148
|
+
}
|
|
149
|
+
exports.configureTsProjectConfig = configureTsProjectConfig;
|
|
150
|
+
function configureTsSolutionConfig(tree, schema) {
|
|
151
|
+
var _a, _b;
|
|
152
|
+
const { name: projectName } = schema;
|
|
153
|
+
const { root } = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
154
|
+
const tsConfigPath = (0, path_1.join)(root, 'tsconfig.json');
|
|
155
|
+
const tsConfigContent = (0, devkit_1.readJson)(tree, tsConfigPath);
|
|
156
|
+
if (!((_b = (_a = tsConfigContent.references) === null || _a === void 0 ? void 0 : _a.map((reference) => reference.path)) === null || _b === void 0 ? void 0 : _b.includes('./.storybook/tsconfig.json'))) {
|
|
157
|
+
tsConfigContent.references = [
|
|
158
|
+
...(tsConfigContent.references || []),
|
|
159
|
+
{
|
|
160
|
+
path: './.storybook/tsconfig.json',
|
|
161
|
+
},
|
|
162
|
+
];
|
|
163
|
+
}
|
|
164
|
+
(0, devkit_1.writeJson)(tree, tsConfigPath, tsConfigContent);
|
|
165
|
+
}
|
|
166
|
+
exports.configureTsSolutionConfig = configureTsSolutionConfig;
|
|
167
|
+
/**
|
|
168
|
+
* When adding storybook we need to inform TSLint or ESLint
|
|
169
|
+
* of the additional tsconfig.json file which will be the only tsconfig
|
|
170
|
+
* which includes *.stories files.
|
|
171
|
+
*
|
|
172
|
+
* For TSLint this is done via the builder config, for ESLint this is
|
|
173
|
+
* done within the .eslintrc.json file.
|
|
174
|
+
*/
|
|
175
|
+
function updateLintConfig(tree, schema) {
|
|
176
|
+
const { name: projectName } = schema;
|
|
177
|
+
const { targets, root } = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
178
|
+
const tslintTargets = Object.values(targets).filter((target) => target.executor === '@angular-devkit/build-angular:tslint');
|
|
179
|
+
tslintTargets.forEach((target) => {
|
|
180
|
+
target.options.tsConfig = (0, utilities_1.dedupe)([
|
|
181
|
+
...target.options.tsConfig,
|
|
182
|
+
(0, devkit_1.joinPathFragments)(root, './.storybook/tsconfig.json'),
|
|
183
|
+
]);
|
|
184
|
+
});
|
|
185
|
+
if (tree.exists((0, path_1.join)(root, '.eslintrc.json'))) {
|
|
186
|
+
(0, devkit_1.updateJson)(tree, (0, path_1.join)(root, '.eslintrc.json'), (json) => {
|
|
187
|
+
var _a, _b, _c, _d;
|
|
188
|
+
if (typeof ((_a = json.parserOptions) === null || _a === void 0 ? void 0 : _a.project) === 'string') {
|
|
189
|
+
json.parserOptions.project = [json.parserOptions.project];
|
|
190
|
+
}
|
|
191
|
+
if (Array.isArray((_b = json.parserOptions) === null || _b === void 0 ? void 0 : _b.project)) {
|
|
192
|
+
json.parserOptions.project = (0, utilities_1.dedupe)([
|
|
193
|
+
...json.parserOptions.project,
|
|
194
|
+
(0, path_1.join)(root, '.storybook/tsconfig.json'),
|
|
195
|
+
]);
|
|
196
|
+
}
|
|
197
|
+
const overrides = json.overrides || [];
|
|
198
|
+
for (const o of overrides) {
|
|
199
|
+
if (typeof ((_c = o.parserOptions) === null || _c === void 0 ? void 0 : _c.project) === 'string') {
|
|
200
|
+
o.parserOptions.project = [o.parserOptions.project];
|
|
201
|
+
}
|
|
202
|
+
if (Array.isArray((_d = o.parserOptions) === null || _d === void 0 ? void 0 : _d.project)) {
|
|
203
|
+
o.parserOptions.project = (0, utilities_1.dedupe)([
|
|
204
|
+
...o.parserOptions.project,
|
|
205
|
+
(0, path_1.join)(root, '.storybook/tsconfig.json'),
|
|
206
|
+
]);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
return json;
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
exports.updateLintConfig = updateLintConfig;
|
|
214
|
+
function normalizeSchema(schema) {
|
|
215
|
+
const defaults = {
|
|
216
|
+
configureCypress: true,
|
|
217
|
+
linter: linter_1.Linter.EsLint,
|
|
218
|
+
js: false,
|
|
219
|
+
};
|
|
220
|
+
return Object.assign(Object.assign({}, defaults), schema);
|
|
221
|
+
}
|
|
222
|
+
exports.normalizeSchema = normalizeSchema;
|
|
223
|
+
function addStorybookToNamedInputs(tree) {
|
|
224
|
+
var _a, _b, _c, _d;
|
|
225
|
+
var _e, _f;
|
|
226
|
+
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
227
|
+
if (nxJson.namedInputs) {
|
|
228
|
+
const hasProductionFileset = !!((_a = nxJson.namedInputs) === null || _a === void 0 ? void 0 : _a.production);
|
|
229
|
+
if (hasProductionFileset) {
|
|
230
|
+
if (!nxJson.namedInputs.production.includes('!{projectRoot}/**/*.stories.@(js|jsx|ts|tsx|mdx)')) {
|
|
231
|
+
nxJson.namedInputs.production.push('!{projectRoot}/**/*.stories.@(js|jsx|ts|tsx|mdx)');
|
|
232
|
+
}
|
|
233
|
+
if (!nxJson.namedInputs.production.includes('!{projectRoot}/.storybook/**/*')) {
|
|
234
|
+
nxJson.namedInputs.production.push('!{projectRoot}/.storybook/**/*');
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
(_b = nxJson.targetDefaults) !== null && _b !== void 0 ? _b : (nxJson.targetDefaults = {});
|
|
238
|
+
(_c = (_e = nxJson.targetDefaults)['build-storybook']) !== null && _c !== void 0 ? _c : (_e['build-storybook'] = {});
|
|
239
|
+
(_d = (_f = nxJson.targetDefaults['build-storybook']).inputs) !== null && _d !== void 0 ? _d : (_f.inputs = [
|
|
240
|
+
'default',
|
|
241
|
+
hasProductionFileset ? '^production' : '^default',
|
|
242
|
+
]);
|
|
243
|
+
if (!nxJson.targetDefaults['build-storybook'].inputs.includes('!{projectRoot}/.storybook/**/*')) {
|
|
244
|
+
nxJson.targetDefaults['build-storybook'].inputs.push('!{projectRoot}/.storybook/**/*');
|
|
245
|
+
}
|
|
246
|
+
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
exports.addStorybookToNamedInputs = addStorybookToNamedInputs;
|
|
250
|
+
function createProjectStorybookDir(tree, projectName, uiFramework, js, tsConfiguration, root, projectType, projectIsRootProjectInStandaloneWorkspace, isNextJs, usesSwc, usesVite, usesV7, viteConfigFilePath) {
|
|
251
|
+
const projectDirectory = projectType === 'application'
|
|
252
|
+
? isNextJs
|
|
253
|
+
? 'components'
|
|
254
|
+
: 'src/app'
|
|
255
|
+
: 'src/lib';
|
|
256
|
+
const storybookConfigExists = projectIsRootProjectInStandaloneWorkspace
|
|
257
|
+
? tree.exists('.storybook/main.js') || tree.exists('.storybook/main.ts')
|
|
258
|
+
: tree.exists((0, path_1.join)(root, '.storybook/main.ts')) ||
|
|
259
|
+
tree.exists((0, path_1.join)(root, '.storybook/main.js'));
|
|
260
|
+
if (storybookConfigExists) {
|
|
261
|
+
devkit_1.logger.warn(`Storybook configuration files already exist for ${projectName}!`);
|
|
262
|
+
return;
|
|
263
|
+
}
|
|
264
|
+
devkit_1.logger.debug(`adding .storybook folder to your ${projectType}`);
|
|
265
|
+
const templatePath = (0, path_1.join)(__dirname, `../project-files${usesV7 ? '-7' : ''}${tsConfiguration ? '-ts' : ''}`);
|
|
266
|
+
(0, devkit_1.generateFiles)(tree, templatePath, root, {
|
|
267
|
+
tmpl: '',
|
|
268
|
+
uiFramework,
|
|
269
|
+
offsetFromRoot: (0, devkit_1.offsetFromRoot)(root),
|
|
270
|
+
projectDirectory,
|
|
271
|
+
projectType,
|
|
272
|
+
mainDir: isNextJs && projectType === 'application' ? 'components' : 'src',
|
|
273
|
+
isNextJs: isNextJs && projectType === 'application',
|
|
274
|
+
usesSwc,
|
|
275
|
+
usesVite,
|
|
276
|
+
isRootProject: projectIsRootProjectInStandaloneWorkspace,
|
|
277
|
+
viteConfigFilePath,
|
|
278
|
+
});
|
|
279
|
+
if (js) {
|
|
280
|
+
(0, devkit_1.toJS)(tree);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
exports.createProjectStorybookDir = createProjectStorybookDir;
|
|
284
|
+
function getTsConfigPath(tree, projectName, path) {
|
|
285
|
+
const { root, projectType } = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
286
|
+
return (0, path_1.join)(root, path && path.length > 0
|
|
287
|
+
? path
|
|
288
|
+
: projectType === 'application'
|
|
289
|
+
? 'tsconfig.app.json'
|
|
290
|
+
: 'tsconfig.lib.json');
|
|
291
|
+
}
|
|
292
|
+
exports.getTsConfigPath = getTsConfigPath;
|
|
293
|
+
function addBuildStorybookToCacheableOperations(tree) {
|
|
294
|
+
(0, devkit_1.updateJson)(tree, 'nx.json', (json) => {
|
|
295
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
296
|
+
return (Object.assign(Object.assign({}, json), { tasksRunnerOptions: Object.assign(Object.assign({}, ((_a = json.tasksRunnerOptions) !== null && _a !== void 0 ? _a : {})), { default: Object.assign(Object.assign({}, ((_c = (_b = json.tasksRunnerOptions) === null || _b === void 0 ? void 0 : _b.default) !== null && _c !== void 0 ? _c : {})), { options: Object.assign(Object.assign({}, ((_f = (_e = (_d = json.tasksRunnerOptions) === null || _d === void 0 ? void 0 : _d.default) === null || _e === void 0 ? void 0 : _e.options) !== null && _f !== void 0 ? _f : {})), { cacheableOperations: Array.from(new Set([
|
|
297
|
+
...((_k = (_j = (_h = (_g = json.tasksRunnerOptions) === null || _g === void 0 ? void 0 : _g.default) === null || _h === void 0 ? void 0 : _h.options) === null || _j === void 0 ? void 0 : _j.cacheableOperations) !== null && _k !== void 0 ? _k : []),
|
|
298
|
+
'build-storybook',
|
|
299
|
+
])) }) }) }) }));
|
|
300
|
+
});
|
|
301
|
+
}
|
|
302
|
+
exports.addBuildStorybookToCacheableOperations = addBuildStorybookToCacheableOperations;
|
|
303
|
+
function projectIsRootProjectInStandaloneWorkspace(projectRoot) {
|
|
304
|
+
return (0, path_1.relative)(devkit_1.workspaceRoot, projectRoot).length === 0;
|
|
305
|
+
}
|
|
306
|
+
exports.projectIsRootProjectInStandaloneWorkspace = projectIsRootProjectInStandaloneWorkspace;
|
|
307
|
+
function workspaceHasRootProject(tree) {
|
|
308
|
+
return tree.exists('project.json');
|
|
309
|
+
}
|
|
310
|
+
exports.workspaceHasRootProject = workspaceHasRootProject;
|
|
311
|
+
function rootFileIsTs(tree, rootFileName, tsConfiguration) {
|
|
312
|
+
if (tree.exists(`.storybook/${rootFileName}.ts`) && !tsConfiguration) {
|
|
313
|
+
devkit_1.logger.info(`The root Storybook configuration is in TypeScript,
|
|
314
|
+
so Nx will generate TypeScript Storybook configuration files
|
|
315
|
+
in this project's .storybook folder as well.`);
|
|
316
|
+
return true;
|
|
317
|
+
}
|
|
318
|
+
else if (tree.exists(`.storybook/${rootFileName}.js`) && tsConfiguration) {
|
|
319
|
+
devkit_1.logger.info(`The root Storybook configuration is in JavaScript,
|
|
320
|
+
so Nx will generate JavaScript Storybook configuration files
|
|
321
|
+
in this project's .storybook folder as well.`);
|
|
322
|
+
return false;
|
|
323
|
+
}
|
|
324
|
+
else {
|
|
325
|
+
return tsConfiguration;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
exports.rootFileIsTs = rootFileIsTs;
|
|
329
|
+
function getE2EProjectName(tree, mainProject) {
|
|
330
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
331
|
+
let e2eProject;
|
|
332
|
+
const graph = yield (0, devkit_1.createProjectGraphAsync)();
|
|
333
|
+
(0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nrwl/cypress:cypress', (options, projectName) => {
|
|
334
|
+
if (e2eProject) {
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
if (options['devServerTarget']) {
|
|
338
|
+
const { project, target } = (0, devkit_1.parseTargetString)(options['devServerTarget'], graph);
|
|
339
|
+
if ((project === mainProject && target === 'serve') ||
|
|
340
|
+
(project === mainProject && target === 'storybook')) {
|
|
341
|
+
e2eProject = projectName;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
});
|
|
345
|
+
return e2eProject;
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
exports.getE2EProjectName = getE2EProjectName;
|
|
349
|
+
function getViteConfigFilePath(tree, projectRoot, configFile) {
|
|
350
|
+
return configFile && tree.exists(configFile)
|
|
351
|
+
? configFile
|
|
352
|
+
: tree.exists((0, devkit_1.joinPathFragments)(`${projectRoot}/vite.config.ts`))
|
|
353
|
+
? (0, devkit_1.joinPathFragments)(`${projectRoot}/vite.config.ts`)
|
|
354
|
+
: tree.exists((0, devkit_1.joinPathFragments)(`${projectRoot}/vite.config.js`))
|
|
355
|
+
? (0, devkit_1.joinPathFragments)(`${projectRoot}/vite.config.js`)
|
|
356
|
+
: undefined;
|
|
357
|
+
}
|
|
358
|
+
exports.getViteConfigFilePath = getViteConfigFilePath;
|
|
359
|
+
//# sourceMappingURL=util-functions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"util-functions.js","sourceRoot":"","sources":["../../../../../../../packages/storybook/src/generators/configuration/lib/util-functions.ts"],"names":[],"mappings":";;;;AAAA,uCAkBoB;AACpB,6FAA0F;AAC1F,uCAAoC;AACpC,+BAAsC;AACtC,wDAIkC;AAGlC,sDAAoD;AAEpD,MAAM,YAAY,GAAG,IAAI,CAAC;AAE1B,SAAgB,gBAAgB,CAC9B,IAAU,EACV,WAAmB,EACnB,WAAmB,EACnB,mBAA4B,EAC5B,MAAgB;IAEhB,IAAI,WAAW,KAAK,yBAAyB,EAAE;QAC7C,OAAO;KACR;IACD,MAAM,aAAa,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IAClE,aAAa,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG;QACnC,QAAQ,EAAE,2BAA2B;QACrC,OAAO,EAAE;YACP,IAAI,EAAE,YAAY;YAClB,SAAS,EAAE,GAAG,aAAa,CAAC,IAAI,aAAa;SAC9C;QACD,cAAc,EAAE;YACd,EAAE,EAAE;gBACF,KAAK,EAAE,IAAI;aACZ;SACF;KACF,CAAC;IAEF,aAAa,CAAC,OAAO,CAAC,iBAAiB,CAAC,GAAG;QACzC,QAAQ,EAAE,uBAAuB;QACjC,OAAO,EAAE,CAAC,qBAAqB,CAAC;QAChC,OAAO,EAAE;YACP,SAAS,EAAE,IAAA,0BAAiB,EAAC,gBAAgB,EAAE,WAAW,CAAC;YAC3D,SAAS,EAAE,GAAG,aAAa,CAAC,IAAI,aAAa;SAC9C;QACD,cAAc,EAAE;YACd,EAAE,EAAE;gBACF,KAAK,EAAE,IAAI;aACZ;SACF;KACF,CAAC;IAEF,IAAI,CAAC,MAAM,EAAE;QACX,aAAa,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,OAAO,CAAC,WAAW,G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ig } = require('vite');<% } %>
|
|
2
|
+
<% if (usesVite){ %>const viteTsConfigPaths = require('vite-tsconfig-paths').default;<% } %>
|
|
3
|
+
<% if (isNextJs){ %>const path = require('path');<% } %>
|
|
4
|
+
|
|
5
|
+
module.exports = {
|
|
6
|
+
core: { builder: <% if (!usesVite) { %>'webpack5'<% } %><% if (usesVite) { %>'@storybook/builder-vite'<% } %> },
|
|
7
|
+
stories: [
|
|
8
|
+
<% if(uiFramework === '@storybook/angular' && projectType === 'library') { %>
|
|
9
|
+
'../**/*.stories.mdx',
|
|
10
|
+
'../**/*.stories.@(js|jsx|ts|tsx)' <% } else { %>
|
|
11
|
+
'../<%= projectDirectory %>/**/*.stories.mdx',
|
|
12
|
+
'../<%= projectDirectory %>/**/*.stories.@(js|jsx|ts|tsx)'
|
|
13
|
+
<% } %>],
|
|
14
|
+
addons: ['@storybook/addon-essentials' <% if(uiFramework === '@storybook/react' && !usesVite) { %>, '@nrwl/react/plugins/storybook' <% } %><% if(uiFramework === '@storybook/react-native') { %>, '@storybook/addon-ondevice-actions', '@storybook/addon-ondevice-backgrounds', '@storybook/addon-ondevice-controls', '@storybook/addon-ondevice-notes' <% } %>
|
|
15
|
+
<% if(usesSwc && !isNextJs) { %>, 'storybook-addon-swc' <% } %>
|
|
16
|
+
<% if(isNextJs) { %>, 'storybook-addon-swc',
|
|
17
|
+
{
|
|
18
|
+
name: 'storybook-addon-next',
|
|
19
|
+
options: {
|
|
20
|
+
nextConfigPath: path.resolve(__dirname, '../next.config.js'),
|
|
21
|
+
},
|
|
22
|
+
}
|
|
23
|
+
<% } %>
|
|
24
|
+
]<% if (usesVite) { %>,
|
|
25
|
+
async viteFinal(config, { configType }) {
|
|
26
|
+
return mergeConfig(config, {
|
|
27
|
+
plugins: [
|
|
28
|
+
viteTsConfigPaths({
|
|
29
|
+
root: '<%= offsetFromRoot %>../',
|
|
30
|
+
}),
|
|
31
|
+
],
|
|
32
|
+
});
|
|
33
|
+
},<% } %>
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
<% if(!usesVite) { %>
|
|
37
|
+
// To customize your webpack configuration you can use the webpackFinal field.
|
|
38
|
+
// Check https://storybook.js.org/docs/react/builders/webpack#extending-storybooks-webpack-config
|
|
39
|
+
// and https://nx.dev/packages/storybook/documents/custom-builder-configs
|
|
40
|
+
<% } %>
|
|
41
|
+
|
|
42
|
+
<% if(usesVite) { %>
|
|
43
|
+
// To customize your Vite configuration you can use the viteFinal field.
|
|
44
|
+
// Check https://storybook.js.org/docs/react/builders/vite#configuration
|
|
45
|
+
// and https://nx.dev/packages/storybook/documents/custom-builder-configs
|
|
46
|
+
<% } %>
|
|
File without changes
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"emitDecoratorMetadata": true
|
|
5
|
+
<% if(uiFramework === '@storybook/react') { %>, "outDir": "" <% } %>
|
|
6
|
+
},
|
|
7
|
+
<% if(uiFramework === '@storybook/react') { %>"files": [
|
|
8
|
+
"<% if(!isRootProject) { %><%= offsetFromRoot %><% } %>../node_modules/@nrwl/react/typings/styled-jsx.d.ts",
|
|
9
|
+
"<% if(!isRootProject) { %><%= offsetFromRoot %><% } %>../node_modules/@nrwl/react/typings/cssmodule.d.ts",
|
|
10
|
+
"<% if(!isRootProject) { %><%= offsetFromRoot %><% } %>../node_modules/@nrwl/react/typings/image.d.ts"
|
|
11
|
+
],<% } %>
|
|
12
|
+
"exclude": ["../**/*.spec.ts" <% if(uiFramework === '@storybook/react') { %>, "../**/*.spec.js", "../**/*.spec.tsx", "../**/*.spec.jsx"<% } %>],
|
|
13
|
+
"include": [<% if(uiFramework === '@storybook/angular' && projectType === 'library') { %>
|
|
14
|
+
"../src/**/*.stories.ts",
|
|
15
|
+
"../src/**/*.stories.js",
|
|
16
|
+
"../src/**/*.stories.jsx",
|
|
17
|
+
"../src/**/*.stories.tsx",
|
|
18
|
+
"../src/**/*.stories.mdx",
|
|
19
|
+
"*.js"<% } else { %>
|
|
20
|
+
"../<%= mainDir %>/**/*.stories.ts",
|
|
21
|
+
"../<%= mainDir %>/**/*.stories.js",
|
|
22
|
+
"../<%= mainDir %>/**/*.stories.jsx",
|
|
23
|
+
"../<%= mainDir %>/**/*.stories.tsx",
|
|
24
|
+
"../<%= mainDir %>/**/*.stories.mdx",
|
|
25
|
+
"*.js"<% if(uiFramework === '@storybook/react-native') { %>, "*.ts", "*.tsx"<% } %><% } %>]
|
|
26
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const config = {
|
|
2
|
+
stories: [
|
|
3
|
+
<% if(uiFramework === '@storybook/angular' && projectType === 'library') { %>
|
|
4
|
+
'../**/*.stories.@(js|jsx|ts|tsx|mdx)' <% } else { %>
|
|
5
|
+
'../<%= projectDirectory %>/**/*.stories.@(js|jsx|ts|tsx|mdx)'
|
|
6
|
+
<% } %>],
|
|
7
|
+
addons: ['@storybook/addon-essentials' <% if(uiFramework === '@storybook/react-webpack5') { %>, '@nrwl/react/plugins/storybook' <% } %><% if(uiFramework === '@storybook/react-native') { %>, '@storybook/addon-ondevice-actions', '@storybook/addon-ondevice-backgrounds', '@storybook/addon-ondevice-controls', '@storybook/addon-ondevice-notes' <% } %>
|
|
8
|
+
<% if(usesSwc) { %>, 'storybook-addon-swc' <% } %>
|
|
9
|
+
],
|
|
10
|
+
framework: {
|
|
11
|
+
name: '<%= uiFramework %>',
|
|
12
|
+
options: {
|
|
13
|
+
<% if (usesVite) { %>
|
|
14
|
+
builder: {
|
|
15
|
+
viteConfigPath: '<%= viteConfigFilePath %>',
|
|
16
|
+
},
|
|
17
|
+
<% } %>
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default config;
|
|
23
|
+
|
|
24
|
+
<% if(!usesVite) { %>
|
|
25
|
+
// To customize your webpack configuration you can use the webpackFinal field.
|
|
26
|
+
// Check https://storybook.js.org/docs/react/builders/webpack#extending-storybooks-webpack-config
|
|
27
|
+
// and https://nx.dev/packages/storybook/documents/custom-builder-configs
|
|
28
|
+
<% } %>
|
|
29
|
+
|
|
30
|
+
<% if(usesVite) { %>
|
|
31
|
+
// To customize your Vite configuration you can use the viteFinal field.
|
|
32
|
+
// Check https://storybook.js.org/docs/react/builders/vite#configuration
|
|
33
|
+
// and https://nx.dev/packages/storybook/documents/custom-builder-configs
|
|
34
|
+
<% } %>
|
|
File without changes
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"emitDecoratorMetadata": true
|
|
5
|
+
<% if(uiFramework === '@storybook/react-webpack5' || uiFramework === '@storybook/react-vite') { %>, "outDir": "" <% } %>
|
|
6
|
+
},
|
|
7
|
+
<% if(uiFramework === '@storybook/react-webpack5' || uiFramework === '@storybook/react-vite') { %>"files": [
|
|
8
|
+
"<% if(!isRootProject) { %><%= offsetFromRoot %><% } %>../node_modules/@nrwl/react/typings/styled-jsx.d.ts",
|
|
9
|
+
"<% if(!isRootProject) { %><%= offsetFromRoot %><% } %>../node_modules/@nrwl/react/typings/cssmodule.d.ts",
|
|
10
|
+
"<% if(!isRootProject) { %><%= offsetFromRoot %><% } %>../node_modules/@nrwl/react/typings/image.d.ts"
|
|
11
|
+
],<% } %>
|
|
12
|
+
"exclude": ["../**/*.spec.ts" <% if(uiFramework === '@storybook/react-webpack5' || uiFramework === '@storybook/react-vite') { %>, "../**/*.spec.js", "../**/*.spec.tsx", "../**/*.spec.jsx"<% } %>],
|
|
13
|
+
"include": [<% if(uiFramework === '@storybook/angular' && projectType === 'library') { %>
|
|
14
|
+
"../src/**/*.stories.ts",
|
|
15
|
+
"../src/**/*.stories.js",
|
|
16
|
+
"../src/**/*.stories.jsx",
|
|
17
|
+
"../src/**/*.stories.tsx",
|
|
18
|
+
"../src/**/*.stories.mdx",
|
|
19
|
+
"*.js"<% } else { %>
|
|
20
|
+
"../<%= mainDir %>/**/*.stories.ts",
|
|
21
|
+
"../<%= mainDir %>/**/*.stories.js",
|
|
22
|
+
"../<%= mainDir %>/**/*.stories.jsx",
|
|
23
|
+
"../<%= mainDir %>/**/*.stories.tsx",
|
|
24
|
+
"../<%= mainDir %>/**/*.stories.mdx",
|
|
25
|
+
"*.js"<% if(uiFramework === '@storybook/react-native') { %>, "*.ts", "*.tsx"<% } %><% } %>]
|
|
26
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { StorybookConfig } from '<%= uiFramework %>';
|
|
2
|
+
|
|
3
|
+
const config: StorybookConfig = {
|
|
4
|
+
stories: [
|
|
5
|
+
<% if(uiFramework === '@storybook/angular' && projectType === 'library') { %>
|
|
6
|
+
'../**/*.stories.@(js|jsx|ts|tsx|mdx)' <% } else { %>
|
|
7
|
+
'../<%= projectDirectory %>/**/*.stories.@(js|jsx|ts|tsx|mdx)'
|
|
8
|
+
<% } %>],
|
|
9
|
+
addons: ['@storybook/addon-essentials' <% if(uiFramework === '@storybook/react-webpack5') { %>, '@nrwl/react/plugins/storybook' <% } %><% if(uiFramework === '@storybook/react-native') { %>, '@storybook/addon-ondevice-actions', '@storybook/addon-ondevice-backgrounds', '@storybook/addon-ondevice-controls', '@storybook/addon-ondevice-notes' <% } %>
|
|
10
|
+
<% if(usesSwc) { %>, 'storybook-addon-swc' <% } %>
|
|
11
|
+
],
|
|
12
|
+
framework: {
|
|
13
|
+
name: '<%= uiFramework %>',
|
|
14
|
+
options: {
|
|
15
|
+
<% if (usesVite) { %>
|
|
16
|
+
builder: {
|
|
17
|
+
viteConfigPath: '<%= viteConfigFilePath %>',
|
|
18
|
+
},
|
|
19
|
+
<% } %>
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default config;
|
|
25
|
+
|
|
26
|
+
<% if(!usesVite) { %>
|
|
27
|
+
// To customize your webpack configuration you can use the webpackFinal field.
|
|
28
|
+
// Check https://storybook.js.org/docs/react/builders/webpack#extending-storybooks-webpack-config
|
|
29
|
+
// and https://nx.dev/packages/storybook/documents/custom-builder-configs
|
|
30
|
+
<% } %>
|
|
31
|
+
|
|
32
|
+
<% if(usesVite) { %>
|
|
33
|
+
// To customize your Vite configuration you can use the viteFinal field.
|
|
34
|
+
// Check https://storybook.js.org/docs/react/builders/vite#configuration
|
|
35
|
+
// and https://nx.dev/packages/storybook/documents/custom-builder-configs
|
|
36
|
+
<% } %>
|
|
File without changes
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"emitDecoratorMetadata": true
|
|
5
|
+
<% if(uiFramework === '@storybook/react-webpack5' || uiFramework === '@storybook/react-vite') { %>, "outDir": "" <% } %>
|
|
6
|
+
},
|
|
7
|
+
<% if(uiFramework === '@storybook/react-webpack5' || uiFramework === '@storybook/react-vite') { %>"files": [
|
|
8
|
+
"<% if(!isRootProject) { %><%= offsetFromRoot %><% } %>../node_modules/@nrwl/react/typings/styled-jsx.d.ts",
|
|
9
|
+
"<% if(!isRootProject) { %><%= offsetFromRoot %><% } %>../node_modules/@nrwl/react/typings/cssmodule.d.ts",
|
|
10
|
+
"<% if(!isRootProject) { %><%= offsetFromRoot %><% } %>../node_modules/@nrwl/react/typings/image.d.ts"
|
|
11
|
+
],<% } %>
|
|
12
|
+
"exclude": ["../**/*.spec.ts" <% if(uiFramework === '@storybook/react-webpack5' || uiFramework === '@storybook/react-vite') { %>, "../**/*.spec.js", "../**/*.spec.tsx", "../**/*.spec.jsx"<% } %>],
|
|
13
|
+
"include": [<% if(uiFramework === '@storybook/angular' && projectType === 'library') { %>
|
|
14
|
+
"../src/**/*.stories.ts",
|
|
15
|
+
"../src/**/*.stories.js",
|
|
16
|
+
"../src/**/*.stories.jsx",
|
|
17
|
+
"../src/**/*.stories.tsx",
|
|
18
|
+
"../src/**/*.stories.mdx",
|
|
19
|
+
"*.ts",
|
|
20
|
+
"*.js"<% } else { %>
|
|
21
|
+
"../<%= mainDir %>/**/*.stories.ts",
|
|
22
|
+
"../<%= mainDir %>/**/*.stories.js",
|
|
23
|
+
"../<%= mainDir %>/**/*.stories.jsx",
|
|
24
|
+
"../<%= mainDir %>/**/*.stories.tsx",
|
|
25
|
+
"../<%= mainDir %>/**/*.stories.mdx",
|
|
26
|
+
"*.ts",
|
|
27
|
+
"*.js"<% if(uiFramework === '@storybook/react-native') { %>, "*.tsx"<% } %><% } %>]
|
|
28
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { StorybookConfig } from '@storybook/core-common';
|
|
2
|
+
<% if (isNextJs){ %>import path from 'path';<% } %>
|
|
3
|
+
<% if (usesVite){ %>import { mergeConfig } from 'vite';<% } %>
|
|
4
|
+
<% if (usesVite){ %>import viteTsConfigPaths from 'vite-tsconfig-paths';<% } %>
|
|
5
|
+
|
|
6
|
+
const config: StorybookConfig = {
|
|
7
|
+
core: { builder: <% if (!usesVite) { %>'webpack5'<% } %><% if (usesVite) { %>'@storybook/builder-vite'<% } %> },
|
|
8
|
+
stories: [
|
|
9
|
+
<% if(uiFramework === '@storybook/angular' && projectType === 'library') { %>
|
|
10
|
+
'../**/*.stories.mdx',
|
|
11
|
+
'../**/*.stories.@(js|jsx|ts|tsx)' <% } else { %>
|
|
12
|
+
'../<%= projectDirectory %>/**/*.stories.mdx',
|
|
13
|
+
'../<%= projectDirectory %>/**/*.stories.@(js|jsx|ts|tsx)'
|
|
14
|
+
<% } %>],
|
|
15
|
+
addons: ['@storybook/addon-essentials' <% if(uiFramework === '@storybook/react' && !usesVite) { %>, '@nrwl/react/plugins/storybook' <% } %><% if(uiFramework === '@storybook/react-native') { %>, '@storybook/addon-ondevice-actions', '@storybook/addon-ondevice-backgrounds', '@storybook/addon-ondevice-controls', '@storybook/addon-ondevice-notes' <% } %>
|
|
16
|
+
<% if(usesSwc && !isNextJs) { %>, 'storybook-addon-swc' <% } %>
|
|
17
|
+
<% if(isNextJs) { %>, 'storybook-addon-swc',
|
|
18
|
+
{
|
|
19
|
+
name: 'storybook-addon-next',
|
|
20
|
+
options: {
|
|
21
|
+
nextConfigPath: path.resolve(__dirname, '../next.config.js'),
|
|
22
|
+
},
|
|
23
|
+
}
|
|
24
|
+
<% } %>
|
|
25
|
+
]<% if (usesVite) { %>,
|
|
26
|
+
async viteFinal(config: any) {
|
|
27
|
+
return mergeConfig(config, {
|
|
28
|
+
plugins: [
|
|
29
|
+
viteTsConfigPaths({
|
|
30
|
+
root: '<%= offsetFromRoot %>../',
|
|
31
|
+
}),
|
|
32
|
+
],
|
|
33
|
+
});
|
|
34
|
+
},<% } %>
|
|
35
|
+
}<% if (usesVite) { %> as StorybookConfig<% } %>;
|
|
36
|
+
|
|
37
|
+
module.exports = config;
|
|
38
|
+
|
|
39
|
+
<% if(!usesVite) { %>
|
|
40
|
+
// To customize your webpack configuration you can use the webpackFinal field.
|
|
41
|
+
// Check https://storybook.js.org/docs/react/builders/webpack#extending-storybooks-webpack-config
|
|
42
|
+
// and https://nx.dev/packages/storybook/documents/custom-builder-configs
|
|
43
|
+
<% } %>
|
|
44
|
+
|
|
45
|
+
<% if(usesVite) { %>
|
|
46
|
+
// To customize your Vite configuration you can use the viteFinal field.
|
|
47
|
+
// Check https://storybook.js.org/docs/react/builders/vite#configuration
|
|
48
|
+
// and https://nx.dev/packages/storybook/documents/custom-builder-configs
|
|
49
|
+
<% } %>
|
|
File without changes
|