@nx/storybook 19.4.3 → 19.5.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/package.json +6 -6
- package/presets/cypress.js +1 -2
- package/src/executors/build-storybook/build-storybook.impl.js +1 -1
- package/src/executors/storybook/storybook.impl.js +1 -1
- package/src/generators/configuration/configuration.js +2 -3
- package/src/generators/configuration/lib/edit-root-tsconfig.js +1 -2
- package/src/generators/configuration/lib/ensure-dependencies.js +1 -2
- package/src/generators/configuration/lib/interaction-testing.utils.js +2 -3
- package/src/generators/configuration/lib/util-functions.js +22 -23
- package/src/generators/convert-to-inferred/convert-to-inferred.js +1 -2
- package/src/generators/convert-to-inferred/lib/build-post-target-transformer.js +1 -2
- package/src/generators/convert-to-inferred/lib/serve-post-target-transformer.js +1 -2
- package/src/generators/convert-to-inferred/lib/utils.js +6 -6
- package/src/generators/cypress-project/cypress-project.js +2 -3
- package/src/generators/init/init.js +2 -3
- package/src/generators/init/lib/update-gitignore.js +1 -2
- package/src/generators/migrate-7/calling-storybook-cli.d.ts +0 -1
- package/src/generators/migrate-7/calling-storybook-cli.js +2 -3
- package/src/generators/migrate-7/helper-functions.js +16 -17
- package/src/generators/migrate-7/migrate-7.js +1 -2
- package/src/migrations/update-16-0-0/update-sb-7.js +1 -1
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +1 -1
- package/src/migrations/update-16-1-0/eslint-ignore-react-plugin.js +1 -1
- package/src/migrations/update-16-5-0/move-storybook-tsconfig.js +1 -1
- package/src/utils/testing.js +2 -3
- package/src/utils/utilities.js +10 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/storybook",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.5.0-beta.1",
|
|
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": {
|
|
@@ -33,14 +33,14 @@
|
|
|
33
33
|
"migrations": "./migrations.json"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@nx/devkit": "19.
|
|
36
|
+
"@nx/devkit": "19.5.0-beta.1",
|
|
37
37
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
38
38
|
"semver": "^7.5.3",
|
|
39
39
|
"tslib": "^2.3.0",
|
|
40
|
-
"@nx/cypress": "19.
|
|
41
|
-
"@nx/js": "19.
|
|
42
|
-
"@nx/eslint": "19.
|
|
43
|
-
"@nrwl/storybook": "19.
|
|
40
|
+
"@nx/cypress": "19.5.0-beta.1",
|
|
41
|
+
"@nx/js": "19.5.0-beta.1",
|
|
42
|
+
"@nx/eslint": "19.5.0-beta.1",
|
|
43
|
+
"@nrwl/storybook": "19.5.0-beta.1"
|
|
44
44
|
},
|
|
45
45
|
"publishConfig": {
|
|
46
46
|
"access": "public"
|
package/presets/cypress.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.nxE2EStorybookPreset =
|
|
3
|
+
exports.nxE2EStorybookPreset = nxE2EStorybookPreset;
|
|
4
4
|
const cypress_preset_1 = require("@nx/cypress/plugins/cypress-preset");
|
|
5
5
|
function nxE2EStorybookPreset(filePath, options) {
|
|
6
6
|
return {
|
|
@@ -8,4 +8,3 @@ function nxE2EStorybookPreset(filePath, options) {
|
|
|
8
8
|
baseUrl: 'http://localhost:4400',
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
|
-
exports.nxE2EStorybookPreset = nxE2EStorybookPreset;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = buildStorybookExecutor;
|
|
3
4
|
const devkit_1 = require("@nx/devkit");
|
|
4
5
|
const build = require("@storybook/core-server");
|
|
5
6
|
const utilities_1 = require("../../utils/utilities");
|
|
@@ -16,7 +17,6 @@ async function buildStorybookExecutor(options, context) {
|
|
|
16
17
|
devkit_1.logger.info(`NX Storybook files available in ${buildOptions.outputDir}`);
|
|
17
18
|
return { success: true };
|
|
18
19
|
}
|
|
19
|
-
exports.default = buildStorybookExecutor;
|
|
20
20
|
function runInstance(options) {
|
|
21
21
|
const env = process.env.NODE_ENV ?? 'production';
|
|
22
22
|
process.env.NODE_ENV = env;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = storybookExecutor;
|
|
3
4
|
const build = require("@storybook/core-server");
|
|
4
5
|
const utilities_1 = require("../../utils/utilities");
|
|
5
6
|
async function* storybookExecutor(options, context) {
|
|
@@ -19,7 +20,6 @@ async function* storybookExecutor(options, context) {
|
|
|
19
20
|
};
|
|
20
21
|
await new Promise(() => { });
|
|
21
22
|
}
|
|
22
|
-
exports.default = storybookExecutor;
|
|
23
23
|
function runInstance(options) {
|
|
24
24
|
const env = process.env.NODE_ENV ?? 'development';
|
|
25
25
|
process.env.NODE_ENV = env;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.configurationGenerator = configurationGenerator;
|
|
4
|
+
exports.configurationGeneratorInternal = configurationGeneratorInternal;
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
6
|
const js_1 = require("@nx/js");
|
|
6
7
|
const cypress_project_1 = require("../cypress-project/cypress-project");
|
|
@@ -15,7 +16,6 @@ const edit_root_tsconfig_1 = require("./lib/edit-root-tsconfig");
|
|
|
15
16
|
function configurationGenerator(tree, schema) {
|
|
16
17
|
return configurationGeneratorInternal(tree, { addPlugin: false, ...schema });
|
|
17
18
|
}
|
|
18
|
-
exports.configurationGenerator = configurationGenerator;
|
|
19
19
|
async function configurationGeneratorInternal(tree, rawSchema) {
|
|
20
20
|
if ((0, utilities_1.storybookMajorVersion)() === 6) {
|
|
21
21
|
throw new Error((0, utilities_1.pleaseUpgrade)());
|
|
@@ -146,7 +146,6 @@ async function configurationGeneratorInternal(tree, rawSchema) {
|
|
|
146
146
|
}
|
|
147
147
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
148
148
|
}
|
|
149
|
-
exports.configurationGeneratorInternal = configurationGeneratorInternal;
|
|
150
149
|
function normalizeSchema(tree, schema) {
|
|
151
150
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
152
151
|
const addPlugin = process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.editRootTsConfig =
|
|
3
|
+
exports.editRootTsConfig = editRootTsConfig;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
/**
|
|
6
6
|
* This is a temporary fix for Storybook to support TypeScript configuration files.
|
|
@@ -32,4 +32,3 @@ function editRootTsConfig(tree) {
|
|
|
32
32
|
return json;
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
|
-
exports.editRootTsConfig = editRootTsConfig;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ensureDependencies =
|
|
3
|
+
exports.ensureDependencies = ensureDependencies;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const semver_1 = require("semver");
|
|
6
6
|
const utilities_1 = require("../../../utils/utilities");
|
|
@@ -67,4 +67,3 @@ function ensureDependencies(tree, options) {
|
|
|
67
67
|
}
|
|
68
68
|
return (0, devkit_1.addDependenciesToPackageJson)(tree, dependencies, devDependencies);
|
|
69
69
|
}
|
|
70
|
-
exports.ensureDependencies = ensureDependencies;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.interactionTestsDependencies = interactionTestsDependencies;
|
|
4
|
+
exports.addInteractionsInAddons = addInteractionsInAddons;
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
6
|
const tsquery_1 = require("@phenomnomnominal/tsquery");
|
|
6
7
|
const versions_1 = require("../../../utils/versions");
|
|
@@ -12,7 +13,6 @@ function interactionTestsDependencies() {
|
|
|
12
13
|
'@storybook/jest': versions_1.storybookJestVersion,
|
|
13
14
|
};
|
|
14
15
|
}
|
|
15
|
-
exports.interactionTestsDependencies = interactionTestsDependencies;
|
|
16
16
|
function addInteractionsInAddons(tree, projectConfig) {
|
|
17
17
|
const mainJsTsPath = getMainTsJsPath(tree, projectConfig);
|
|
18
18
|
if (!mainJsTsPath)
|
|
@@ -43,7 +43,6 @@ function addInteractionsInAddons(tree, projectConfig) {
|
|
|
43
43
|
]);
|
|
44
44
|
tree.write(mainJsTsPath, mainJsTs);
|
|
45
45
|
}
|
|
46
|
-
exports.addInteractionsInAddons = addInteractionsInAddons;
|
|
47
46
|
function getMainTsJsPath(host, projectConfig) {
|
|
48
47
|
let mainJsTsPath = undefined;
|
|
49
48
|
Object.entries(projectConfig.targets).forEach(([_targetName, targetConfig]) => {
|
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.addStorybookTarget = addStorybookTarget;
|
|
4
|
+
exports.addAngularStorybookTarget = addAngularStorybookTarget;
|
|
5
|
+
exports.addStaticTarget = addStaticTarget;
|
|
6
|
+
exports.createStorybookTsconfigFile = createStorybookTsconfigFile;
|
|
7
|
+
exports.editTsconfigBaseJson = editTsconfigBaseJson;
|
|
8
|
+
exports.configureTsProjectConfig = configureTsProjectConfig;
|
|
9
|
+
exports.configureTsSolutionConfig = configureTsSolutionConfig;
|
|
10
|
+
exports.updateLintConfig = updateLintConfig;
|
|
11
|
+
exports.normalizeSchema = normalizeSchema;
|
|
12
|
+
exports.addStorybookToNamedInputs = addStorybookToNamedInputs;
|
|
13
|
+
exports.addStorybookToTargetDefaults = addStorybookToTargetDefaults;
|
|
14
|
+
exports.createProjectStorybookDir = createProjectStorybookDir;
|
|
15
|
+
exports.getTsConfigPath = getTsConfigPath;
|
|
16
|
+
exports.addBuildStorybookToCacheableOperations = addBuildStorybookToCacheableOperations;
|
|
17
|
+
exports.projectIsRootProjectInStandaloneWorkspace = projectIsRootProjectInStandaloneWorkspace;
|
|
18
|
+
exports.workspaceHasRootProject = workspaceHasRootProject;
|
|
19
|
+
exports.rootFileIsTs = rootFileIsTs;
|
|
20
|
+
exports.getE2EProjectName = getE2EProjectName;
|
|
21
|
+
exports.findViteConfig = findViteConfig;
|
|
22
|
+
exports.findNextConfig = findNextConfig;
|
|
23
|
+
exports.findMetroConfig = findMetroConfig;
|
|
24
|
+
exports.renameAndMoveOldTsConfig = renameAndMoveOldTsConfig;
|
|
4
25
|
const devkit_1 = require("@nx/devkit");
|
|
5
26
|
const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
|
|
6
27
|
const eslint_1 = require("@nx/eslint");
|
|
@@ -47,7 +68,6 @@ function addStorybookTarget(tree, projectName, uiFramework, interactionTests) {
|
|
|
47
68
|
}
|
|
48
69
|
(0, devkit_1.updateProjectConfiguration)(tree, projectName, projectConfig);
|
|
49
70
|
}
|
|
50
|
-
exports.addStorybookTarget = addStorybookTarget;
|
|
51
71
|
function addAngularStorybookTarget(tree, projectName, interactionTests) {
|
|
52
72
|
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
53
73
|
const { ngBuildTarget } = (0, utilities_1.findStorybookAndBuildTargetsAndCompiler)(projectConfig.targets);
|
|
@@ -90,7 +110,6 @@ function addAngularStorybookTarget(tree, projectName, interactionTests) {
|
|
|
90
110
|
}
|
|
91
111
|
(0, devkit_1.updateProjectConfiguration)(tree, projectName, projectConfig);
|
|
92
112
|
}
|
|
93
|
-
exports.addAngularStorybookTarget = addAngularStorybookTarget;
|
|
94
113
|
async function addStaticTarget(tree, opts) {
|
|
95
114
|
const { webStaticServeGenerator } = (0, devkit_1.ensurePackage)('@nx/web', versions_1.nxVersion);
|
|
96
115
|
await webStaticServeGenerator(tree, {
|
|
@@ -106,7 +125,6 @@ async function addStaticTarget(tree, opts) {
|
|
|
106
125
|
};
|
|
107
126
|
(0, devkit_1.updateProjectConfiguration)(tree, opts.project, projectConfig);
|
|
108
127
|
}
|
|
109
|
-
exports.addStaticTarget = addStaticTarget;
|
|
110
128
|
function createStorybookTsconfigFile(tree, projectRoot, uiFramework, isRootProject, mainDir) {
|
|
111
129
|
// First let's check if old configuration file exists
|
|
112
130
|
// If it exists, let's rename it and move it to the new location
|
|
@@ -164,7 +182,6 @@ function createStorybookTsconfigFile(tree, projectRoot, uiFramework, isRootProje
|
|
|
164
182
|
};
|
|
165
183
|
(0, devkit_1.writeJson)(tree, storybookTsConfigPath, storybookTsConfig);
|
|
166
184
|
}
|
|
167
|
-
exports.createStorybookTsconfigFile = createStorybookTsconfigFile;
|
|
168
185
|
function editTsconfigBaseJson(tree) {
|
|
169
186
|
let tsconfigBasePath = 'tsconfig.base.json';
|
|
170
187
|
// standalone workspace maybe
|
|
@@ -178,7 +195,6 @@ function editTsconfigBaseJson(tree) {
|
|
|
178
195
|
tsconfigBaseContent.compilerOptions.skipLibCheck = true;
|
|
179
196
|
(0, devkit_1.writeJson)(tree, tsconfigBasePath, tsconfigBaseContent);
|
|
180
197
|
}
|
|
181
|
-
exports.editTsconfigBaseJson = editTsconfigBaseJson;
|
|
182
198
|
function configureTsProjectConfig(tree, schema) {
|
|
183
199
|
const { project: projectName } = schema;
|
|
184
200
|
let tsConfigPath;
|
|
@@ -209,7 +225,6 @@ function configureTsProjectConfig(tree, schema) {
|
|
|
209
225
|
}
|
|
210
226
|
(0, devkit_1.writeJson)(tree, tsConfigPath, tsConfigContent);
|
|
211
227
|
}
|
|
212
|
-
exports.configureTsProjectConfig = configureTsProjectConfig;
|
|
213
228
|
function configureTsSolutionConfig(tree, schema) {
|
|
214
229
|
const { project: projectName } = schema;
|
|
215
230
|
const { root } = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
@@ -241,7 +256,6 @@ function configureTsSolutionConfig(tree, schema) {
|
|
|
241
256
|
}
|
|
242
257
|
(0, devkit_1.writeJson)(tree, tsConfigPath, tsConfigContent);
|
|
243
258
|
}
|
|
244
|
-
exports.configureTsSolutionConfig = configureTsSolutionConfig;
|
|
245
259
|
/**
|
|
246
260
|
* When adding storybook we need to inform ESLint
|
|
247
261
|
* of the additional tsconfig.json file which will be the only tsconfig
|
|
@@ -307,7 +321,6 @@ function updateLintConfig(tree, schema) {
|
|
|
307
321
|
});
|
|
308
322
|
}
|
|
309
323
|
}
|
|
310
|
-
exports.updateLintConfig = updateLintConfig;
|
|
311
324
|
function normalizeSchema(schema) {
|
|
312
325
|
const defaults = {
|
|
313
326
|
configureCypress: true,
|
|
@@ -319,7 +332,6 @@ function normalizeSchema(schema) {
|
|
|
319
332
|
...schema,
|
|
320
333
|
};
|
|
321
334
|
}
|
|
322
|
-
exports.normalizeSchema = normalizeSchema;
|
|
323
335
|
function addStorybookToNamedInputs(tree) {
|
|
324
336
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
325
337
|
if (nxJson.namedInputs) {
|
|
@@ -338,7 +350,6 @@ function addStorybookToNamedInputs(tree) {
|
|
|
338
350
|
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
339
351
|
}
|
|
340
352
|
}
|
|
341
|
-
exports.addStorybookToNamedInputs = addStorybookToNamedInputs;
|
|
342
353
|
function addStorybookToTargetDefaults(tree, setCache = true) {
|
|
343
354
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
344
355
|
nxJson.targetDefaults ??= {};
|
|
@@ -366,7 +377,6 @@ function addStorybookToTargetDefaults(tree, setCache = true) {
|
|
|
366
377
|
}
|
|
367
378
|
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
368
379
|
}
|
|
369
|
-
exports.addStorybookToTargetDefaults = addStorybookToTargetDefaults;
|
|
370
380
|
function createProjectStorybookDir(tree, projectName, uiFramework, js, tsConfiguration, root, projectType, projectIsRootProjectInStandaloneWorkspace, interactionTests, mainDir, isNextJs, usesSwc, usesVite, viteConfigFilePath, hasPlugin, viteConfigFileName, useReactNative) {
|
|
371
381
|
let projectDirectory = projectType === 'application'
|
|
372
382
|
? isNextJs
|
|
@@ -415,7 +425,6 @@ function createProjectStorybookDir(tree, projectName, uiFramework, js, tsConfigu
|
|
|
415
425
|
tree.delete((0, path_1.join)(root, '.storybook/tsconfig.json'));
|
|
416
426
|
}
|
|
417
427
|
}
|
|
418
|
-
exports.createProjectStorybookDir = createProjectStorybookDir;
|
|
419
428
|
function getTsConfigPath(tree, projectName, path) {
|
|
420
429
|
const { root, projectType } = (0, devkit_1.readProjectConfiguration)(tree, projectName);
|
|
421
430
|
return (0, path_1.join)(root, path?.length > 0
|
|
@@ -424,7 +433,6 @@ function getTsConfigPath(tree, projectName, path) {
|
|
|
424
433
|
? 'tsconfig.app.json'
|
|
425
434
|
: 'tsconfig.lib.json');
|
|
426
435
|
}
|
|
427
|
-
exports.getTsConfigPath = getTsConfigPath;
|
|
428
436
|
function addBuildStorybookToCacheableOperations(tree) {
|
|
429
437
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
430
438
|
if (nxJson.tasksRunnerOptions?.default?.options?.cacheableOperations &&
|
|
@@ -433,15 +441,12 @@ function addBuildStorybookToCacheableOperations(tree) {
|
|
|
433
441
|
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
434
442
|
}
|
|
435
443
|
}
|
|
436
|
-
exports.addBuildStorybookToCacheableOperations = addBuildStorybookToCacheableOperations;
|
|
437
444
|
function projectIsRootProjectInStandaloneWorkspace(projectRoot) {
|
|
438
445
|
return (0, path_1.relative)(devkit_1.workspaceRoot, projectRoot)?.length === 0;
|
|
439
446
|
}
|
|
440
|
-
exports.projectIsRootProjectInStandaloneWorkspace = projectIsRootProjectInStandaloneWorkspace;
|
|
441
447
|
function workspaceHasRootProject(tree) {
|
|
442
448
|
return tree.exists('project.json');
|
|
443
449
|
}
|
|
444
|
-
exports.workspaceHasRootProject = workspaceHasRootProject;
|
|
445
450
|
function rootFileIsTs(tree, rootFileName, tsConfiguration) {
|
|
446
451
|
if (tree.exists(`.storybook/${rootFileName}.ts`) && !tsConfiguration) {
|
|
447
452
|
devkit_1.logger.info(`The root Storybook configuration is in TypeScript,
|
|
@@ -459,7 +464,6 @@ function rootFileIsTs(tree, rootFileName, tsConfiguration) {
|
|
|
459
464
|
return tsConfiguration;
|
|
460
465
|
}
|
|
461
466
|
}
|
|
462
|
-
exports.rootFileIsTs = rootFileIsTs;
|
|
463
467
|
async function getE2EProjectName(tree, mainProject) {
|
|
464
468
|
let e2eProject;
|
|
465
469
|
const graph = await (0, devkit_1.createProjectGraphAsync)();
|
|
@@ -477,7 +481,6 @@ async function getE2EProjectName(tree, mainProject) {
|
|
|
477
481
|
});
|
|
478
482
|
return e2eProject;
|
|
479
483
|
}
|
|
480
|
-
exports.getE2EProjectName = getE2EProjectName;
|
|
481
484
|
function findViteConfig(tree, projectRoot) {
|
|
482
485
|
const allowsExt = ['js', 'mjs', 'ts', 'cjs', 'mts', 'cts'];
|
|
483
486
|
for (const ext of allowsExt) {
|
|
@@ -490,7 +493,6 @@ function findViteConfig(tree, projectRoot) {
|
|
|
490
493
|
}
|
|
491
494
|
}
|
|
492
495
|
}
|
|
493
|
-
exports.findViteConfig = findViteConfig;
|
|
494
496
|
function findNextConfig(tree, projectRoot) {
|
|
495
497
|
const allowsExt = ['js', 'mjs', 'cjs'];
|
|
496
498
|
for (const ext of allowsExt) {
|
|
@@ -500,14 +502,12 @@ function findNextConfig(tree, projectRoot) {
|
|
|
500
502
|
}
|
|
501
503
|
}
|
|
502
504
|
}
|
|
503
|
-
exports.findNextConfig = findNextConfig;
|
|
504
505
|
function findMetroConfig(tree, projectRoot) {
|
|
505
506
|
const nextConfigPath = (0, devkit_1.joinPathFragments)(projectRoot, `metro.config.js`);
|
|
506
507
|
if (tree.exists(nextConfigPath)) {
|
|
507
508
|
return nextConfigPath;
|
|
508
509
|
}
|
|
509
510
|
}
|
|
510
|
-
exports.findMetroConfig = findMetroConfig;
|
|
511
511
|
function renameAndMoveOldTsConfig(projectRoot, pathToStorybookConfigFile, tree) {
|
|
512
512
|
if (pathToStorybookConfigFile && tree.exists(pathToStorybookConfigFile)) {
|
|
513
513
|
(0, devkit_1.updateJson)(tree, pathToStorybookConfigFile, (json) => {
|
|
@@ -560,4 +560,3 @@ function renameAndMoveOldTsConfig(projectRoot, pathToStorybookConfigFile, tree)
|
|
|
560
560
|
tree.write(fileName, config.replace(/\.storybook\/tsconfig\.json/g, 'tsconfig.storybook.json'));
|
|
561
561
|
}
|
|
562
562
|
}
|
|
563
|
-
exports.renameAndMoveOldTsConfig = renameAndMoveOldTsConfig;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.convertToInferred =
|
|
3
|
+
exports.convertToInferred = convertToInferred;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const aggregate_log_util_1 = require("@nx/devkit/src/generators/plugin-migrations/aggregate-log-util");
|
|
6
6
|
const executor_to_plugin_migrator_1 = require("@nx/devkit/src/generators/plugin-migrations/executor-to-plugin-migrator");
|
|
@@ -43,5 +43,4 @@ async function convertToInferred(tree, options) {
|
|
|
43
43
|
migrationLogs.flushLogs();
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
|
-
exports.convertToInferred = convertToInferred;
|
|
47
46
|
exports.default = convertToInferred;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buildPostTargetTransformer =
|
|
3
|
+
exports.buildPostTargetTransformer = buildPostTargetTransformer;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const plugin_migration_utils_1 = require("@nx/devkit/src/generators/plugin-migrations/plugin-migration-utils");
|
|
6
6
|
const tsquery_1 = require("@phenomnomnominal/tsquery");
|
|
@@ -60,7 +60,6 @@ function buildPostTargetTransformer(migrationLogs) {
|
|
|
60
60
|
return target;
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
|
-
exports.buildPostTargetTransformer = buildPostTargetTransformer;
|
|
64
63
|
function handlePropertiesFromTargetOptions(tree, options, defaultConfigDir, projectName, projectRoot, configValues, migrationLogs) {
|
|
65
64
|
let configDir = defaultConfigDir;
|
|
66
65
|
if ('configDir' in options) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.servePostTargetTransformer =
|
|
3
|
+
exports.servePostTargetTransformer = servePostTargetTransformer;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const plugin_migration_utils_1 = require("@nx/devkit/src/generators/plugin-migrations/plugin-migration-utils");
|
|
6
6
|
const utils_1 = require("./utils");
|
|
@@ -37,7 +37,6 @@ function servePostTargetTransformer(migrationLogs) {
|
|
|
37
37
|
return target;
|
|
38
38
|
};
|
|
39
39
|
}
|
|
40
|
-
exports.servePostTargetTransformer = servePostTargetTransformer;
|
|
41
40
|
function handlePropertiesFromTargetOptions(tree, options, projectName, projectRoot, migrationLogs) {
|
|
42
41
|
if ('configDir' in options) {
|
|
43
42
|
options.configDir = (0, plugin_migration_utils_1.toProjectRelativePath)(options.configDir, projectRoot);
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.STORYBOOK_PROP_MAPPINGS = void 0;
|
|
4
|
+
exports.getConfigFilePath = getConfigFilePath;
|
|
5
|
+
exports.addConfigValuesToConfigFile = addConfigValuesToConfigFile;
|
|
6
|
+
exports.ensureViteConfigPathIsRelative = ensureViteConfigPathIsRelative;
|
|
7
|
+
exports.getInstalledPackageVersion = getInstalledPackageVersion;
|
|
8
|
+
exports.getInstalledPackageVersionInfo = getInstalledPackageVersionInfo;
|
|
4
9
|
const tsquery_1 = require("@phenomnomnominal/tsquery");
|
|
5
10
|
const devkit_1 = require("@nx/devkit");
|
|
6
11
|
const plugin_migration_utils_1 = require("@nx/devkit/src/generators/plugin-migrations/plugin-migration-utils");
|
|
@@ -15,7 +20,6 @@ function getConfigFilePath(tree, configDir) {
|
|
|
15
20
|
(0, devkit_1.joinPathFragments)(configDir, `main.mjs`),
|
|
16
21
|
].find((f) => tree.exists(f));
|
|
17
22
|
}
|
|
18
|
-
exports.getConfigFilePath = getConfigFilePath;
|
|
19
23
|
function addConfigValuesToConfigFile(tree, configFile, configValues) {
|
|
20
24
|
const IMPORT_PROPERTY_SELECTOR = 'ImportDeclaration';
|
|
21
25
|
const configFileContents = tree.read(configFile, 'utf-8');
|
|
@@ -44,7 +48,6 @@ function addConfigValuesToConfigFile(tree, configFile, configValues) {
|
|
|
44
48
|
${configValuesString}
|
|
45
49
|
${configFileContents.slice(startPosition)}`);
|
|
46
50
|
}
|
|
47
|
-
exports.addConfigValuesToConfigFile = addConfigValuesToConfigFile;
|
|
48
51
|
exports.STORYBOOK_PROP_MAPPINGS = {
|
|
49
52
|
v7: {
|
|
50
53
|
port: 'port',
|
|
@@ -135,15 +138,12 @@ function ensureViteConfigPathIsRelative(tree, configPath, projectName, projectRo
|
|
|
135
138
|
const relativePathToViteConfig = (0, plugin_migration_utils_1.toProjectRelativePath)(pathToViteConfig, projectRoot);
|
|
136
139
|
tree.write(configPath, `${configFileContents.slice(0, viteConfigPathNode.getStart() + 1)}${relativePathToViteConfig}${configFileContents.slice(viteConfigPathNode.getEnd() - 1)}`);
|
|
137
140
|
}
|
|
138
|
-
exports.ensureViteConfigPathIsRelative = ensureViteConfigPathIsRelative;
|
|
139
141
|
function getInstalledPackageVersion(tree, pkgName) {
|
|
140
142
|
const { dependencies, devDependencies } = (0, devkit_1.readJson)(tree, 'package.json');
|
|
141
143
|
const version = dependencies?.[pkgName] ?? devDependencies?.[pkgName];
|
|
142
144
|
return version;
|
|
143
145
|
}
|
|
144
|
-
exports.getInstalledPackageVersion = getInstalledPackageVersion;
|
|
145
146
|
function getInstalledPackageVersionInfo(tree, pkgName) {
|
|
146
147
|
const version = getInstalledPackageVersion(tree, pkgName);
|
|
147
148
|
return version ? { major: (0, semver_1.major)((0, semver_1.coerce)(version)), version } : null;
|
|
148
149
|
}
|
|
149
|
-
exports.getInstalledPackageVersionInfo = getInstalledPackageVersionInfo;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.cypressProjectGenerator = cypressProjectGenerator;
|
|
4
|
+
exports.cypressProjectGeneratorInternal = cypressProjectGeneratorInternal;
|
|
4
5
|
const project_name_1 = require("@nx/cypress/src/utils/project-name");
|
|
5
6
|
const devkit_1 = require("@nx/devkit");
|
|
6
7
|
const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
|
|
@@ -13,7 +14,6 @@ async function cypressProjectGenerator(tree, schema) {
|
|
|
13
14
|
...schema,
|
|
14
15
|
});
|
|
15
16
|
}
|
|
16
|
-
exports.cypressProjectGenerator = cypressProjectGenerator;
|
|
17
17
|
async function cypressProjectGeneratorInternal(tree, schema) {
|
|
18
18
|
devkit_1.logger.warn(`Use 'interactionTests' instead when running '@nx/storybook:configuration'. This generator will be removed in v21.`);
|
|
19
19
|
const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/cypress', versions_1.nxVersion);
|
|
@@ -63,7 +63,6 @@ async function cypressProjectGeneratorInternal(tree, schema) {
|
|
|
63
63
|
}
|
|
64
64
|
return cypressTask;
|
|
65
65
|
}
|
|
66
|
-
exports.cypressProjectGeneratorInternal = cypressProjectGeneratorInternal;
|
|
67
66
|
function hasCypressPlugin(tree) {
|
|
68
67
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
69
68
|
return nxJson.plugins?.some((p) => typeof p === 'string'
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.initGenerator = initGenerator;
|
|
4
|
+
exports.initGeneratorInternal = initGeneratorInternal;
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
6
|
const add_plugin_1 = require("@nx/devkit/src/utils/add-plugin");
|
|
6
7
|
const semver_1 = require("semver");
|
|
@@ -53,7 +54,6 @@ function moveToDevDependencies(tree) {
|
|
|
53
54
|
function initGenerator(tree, schema) {
|
|
54
55
|
return initGeneratorInternal(tree, { addPlugin: false, ...schema });
|
|
55
56
|
}
|
|
56
|
-
exports.initGenerator = initGenerator;
|
|
57
57
|
async function initGeneratorInternal(tree, schema) {
|
|
58
58
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
59
59
|
const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
@@ -99,5 +99,4 @@ async function initGeneratorInternal(tree, schema) {
|
|
|
99
99
|
}
|
|
100
100
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
101
101
|
}
|
|
102
|
-
exports.initGeneratorInternal = initGeneratorInternal;
|
|
103
102
|
exports.default = initGenerator;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateGitignore =
|
|
3
|
+
exports.updateGitignore = updateGitignore;
|
|
4
4
|
function updateGitignore(tree) {
|
|
5
5
|
if (!tree.exists('.gitignore')) {
|
|
6
6
|
return;
|
|
@@ -13,4 +13,3 @@ function updateGitignore(tree) {
|
|
|
13
13
|
}
|
|
14
14
|
tree.write('.gitignore', `${gitignore}\n\nstorybook-static`);
|
|
15
15
|
}
|
|
16
|
-
exports.updateGitignore = updateGitignore;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.callUpgrade = callUpgrade;
|
|
4
|
+
exports.callAutomigrate = callAutomigrate;
|
|
4
5
|
const devkit_1 = require("@nx/devkit");
|
|
5
6
|
const child_process_1 = require("child_process");
|
|
6
7
|
function callUpgrade(schema) {
|
|
@@ -40,7 +41,6 @@ function callUpgrade(schema) {
|
|
|
40
41
|
return 1;
|
|
41
42
|
}
|
|
42
43
|
}
|
|
43
|
-
exports.callUpgrade = callUpgrade;
|
|
44
44
|
function callAutomigrate(allStorybookProjects, schema) {
|
|
45
45
|
devkit_1.output.log({
|
|
46
46
|
title: `⚙️ Calling sb automigrate`,
|
|
@@ -83,4 +83,3 @@ function callAutomigrate(allStorybookProjects, schema) {
|
|
|
83
83
|
});
|
|
84
84
|
return resultOfMigration;
|
|
85
85
|
}
|
|
86
|
-
exports.callAutomigrate = callAutomigrate;
|
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.onlyShowGuide = onlyShowGuide;
|
|
4
|
+
exports.writeFile = writeFile;
|
|
5
|
+
exports.removePathResolvesFromNextConfig = removePathResolvesFromNextConfig;
|
|
6
|
+
exports.removeViteTsConfigPathsPlugin = removeViteTsConfigPathsPlugin;
|
|
7
|
+
exports.addViteConfigFilePathInFrameworkOptions = addViteConfigFilePathInFrameworkOptions;
|
|
8
|
+
exports.normalizeViteConfigFilePathWithTree = normalizeViteConfigFilePathWithTree;
|
|
9
|
+
exports.removeTypecastFromMainTs = removeTypecastFromMainTs;
|
|
10
|
+
exports.removeUiFrameworkFromProjectJson = removeUiFrameworkFromProjectJson;
|
|
11
|
+
exports.changeCoreCommonImportToFramework = changeCoreCommonImportToFramework;
|
|
12
|
+
exports.getAllStorybookInfo = getAllStorybookInfo;
|
|
13
|
+
exports.prepareFiles = prepareFiles;
|
|
14
|
+
exports.handleMigrationResult = handleMigrationResult;
|
|
15
|
+
exports.checkStorybookInstalled = checkStorybookInstalled;
|
|
16
|
+
exports.checkWebComponentsInstalled = checkWebComponentsInstalled;
|
|
17
|
+
exports.afterMigration = afterMigration;
|
|
18
|
+
exports.logResult = logResult;
|
|
4
19
|
const devkit_1 = require("@nx/devkit");
|
|
5
20
|
const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
|
|
6
21
|
const tsquery_1 = require("@phenomnomnominal/tsquery");
|
|
@@ -32,13 +47,11 @@ function onlyShowGuide(storybookProjects) {
|
|
|
32
47
|
],
|
|
33
48
|
});
|
|
34
49
|
}
|
|
35
|
-
exports.onlyShowGuide = onlyShowGuide;
|
|
36
50
|
function writeFile(file) {
|
|
37
51
|
if (file?.path && file?.content) {
|
|
38
52
|
fs.writeFileSync(file.path, file.content);
|
|
39
53
|
}
|
|
40
54
|
}
|
|
41
|
-
exports.writeFile = writeFile;
|
|
42
55
|
function removePathResolvesFromNextConfig(tree, mainJsTsPath) {
|
|
43
56
|
let mainJsTs = tree.read(mainJsTsPath, 'utf-8');
|
|
44
57
|
const hasNextConfig = tsquery_1.tsquery.query(mainJsTs, `PropertyAssignment:has(Identifier:has([name="nextConfigPath"]))`);
|
|
@@ -72,7 +85,6 @@ function removePathResolvesFromNextConfig(tree, mainJsTsPath) {
|
|
|
72
85
|
}
|
|
73
86
|
}
|
|
74
87
|
}
|
|
75
|
-
exports.removePathResolvesFromNextConfig = removePathResolvesFromNextConfig;
|
|
76
88
|
function removeViteTsConfigPathsPlugin(tree, mainJsTsPath) {
|
|
77
89
|
let mainJsTs = tree.read(mainJsTsPath, 'utf-8');
|
|
78
90
|
const { vitePluginVariableName, importExpression } = getViteTsConfigPathsNameAndImport(mainJsTs);
|
|
@@ -99,7 +111,6 @@ function removeViteTsConfigPathsPlugin(tree, mainJsTsPath) {
|
|
|
99
111
|
removePluginsArrayIfEmpty(tree, mainJsTsPath);
|
|
100
112
|
}
|
|
101
113
|
}
|
|
102
|
-
exports.removeViteTsConfigPathsPlugin = removeViteTsConfigPathsPlugin;
|
|
103
114
|
function getViteTsConfigPathsNameAndImport(mainJsTs) {
|
|
104
115
|
const requireVariableStatement = tsquery_1.tsquery.query(mainJsTs, `VariableStatement:has(CallExpression:has(Identifier[name="require"]))`);
|
|
105
116
|
let vitePluginVariableName;
|
|
@@ -206,7 +217,6 @@ function addViteConfigFilePathInFrameworkOptions(tree, mainJsTsPath, viteConfigP
|
|
|
206
217
|
}
|
|
207
218
|
}
|
|
208
219
|
}
|
|
209
|
-
exports.addViteConfigFilePathInFrameworkOptions = addViteConfigFilePathInFrameworkOptions;
|
|
210
220
|
function normalizeViteConfigFilePathWithTree(tree, projectRoot, configFile) {
|
|
211
221
|
return configFile && tree.exists(configFile)
|
|
212
222
|
? configFile
|
|
@@ -216,7 +226,6 @@ function normalizeViteConfigFilePathWithTree(tree, projectRoot, configFile) {
|
|
|
216
226
|
? (0, devkit_1.joinPathFragments)(`${projectRoot}/vite.config.js`)
|
|
217
227
|
: undefined;
|
|
218
228
|
}
|
|
219
|
-
exports.normalizeViteConfigFilePathWithTree = normalizeViteConfigFilePathWithTree;
|
|
220
229
|
function removeTypecastFromMainTs(tree, mainTsPath) {
|
|
221
230
|
let mainTs = tree.read(mainTsPath, 'utf-8');
|
|
222
231
|
mainTs = mainTs.replace(/as StorybookConfig/g, '');
|
|
@@ -225,7 +234,6 @@ function removeTypecastFromMainTs(tree, mainTsPath) {
|
|
|
225
234
|
content: mainTs,
|
|
226
235
|
};
|
|
227
236
|
}
|
|
228
|
-
exports.removeTypecastFromMainTs = removeTypecastFromMainTs;
|
|
229
237
|
function removeUiFrameworkFromProjectJson(tree) {
|
|
230
238
|
(0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nx/storybook:build', (options, projectName, targetName) => {
|
|
231
239
|
if (projectName && options?.['uiFramework']) {
|
|
@@ -242,7 +250,6 @@ function removeUiFrameworkFromProjectJson(tree) {
|
|
|
242
250
|
}
|
|
243
251
|
});
|
|
244
252
|
}
|
|
245
|
-
exports.removeUiFrameworkFromProjectJson = removeUiFrameworkFromProjectJson;
|
|
246
253
|
function changeCoreCommonImportToFramework(tree, mainTsPath) {
|
|
247
254
|
let mainTs = tree.read(mainTsPath, 'utf-8');
|
|
248
255
|
const importDeclarations = tsquery_1.tsquery.query(mainTs, 'ImportDeclaration:has(ImportSpecifier:has([text="StorybookConfig"]))')?.[0];
|
|
@@ -280,7 +287,6 @@ function changeCoreCommonImportToFramework(tree, mainTsPath) {
|
|
|
280
287
|
}
|
|
281
288
|
}
|
|
282
289
|
}
|
|
283
|
-
exports.changeCoreCommonImportToFramework = changeCoreCommonImportToFramework;
|
|
284
290
|
function getAllStorybookInfo(tree) {
|
|
285
291
|
const allStorybookDirs = {};
|
|
286
292
|
(0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nx/storybook:build', (options, projectName) => {
|
|
@@ -303,7 +309,6 @@ function getAllStorybookInfo(tree) {
|
|
|
303
309
|
});
|
|
304
310
|
return allStorybookDirs;
|
|
305
311
|
}
|
|
306
|
-
exports.getAllStorybookInfo = getAllStorybookInfo;
|
|
307
312
|
function prepareFiles(tree, allStorybookProjects) {
|
|
308
313
|
devkit_1.output.log({
|
|
309
314
|
title: `Preparing Storybook files.`,
|
|
@@ -342,7 +347,6 @@ function prepareFiles(tree, allStorybookProjects) {
|
|
|
342
347
|
color: 'green',
|
|
343
348
|
});
|
|
344
349
|
}
|
|
345
|
-
exports.prepareFiles = prepareFiles;
|
|
346
350
|
function handleMigrationResult(migrateResult, allStorybookProjects) {
|
|
347
351
|
if ((0, fileutils_1.fileExists)((0, path_1.join)(devkit_1.workspaceRoot, 'migration-storybook.log')) &&
|
|
348
352
|
Object.keys(migrateResult.successfulProjects)?.length) {
|
|
@@ -395,7 +399,6 @@ function handleMigrationResult(migrateResult, allStorybookProjects) {
|
|
|
395
399
|
}
|
|
396
400
|
return migrateResult;
|
|
397
401
|
}
|
|
398
|
-
exports.handleMigrationResult = handleMigrationResult;
|
|
399
402
|
function checkStorybookInstalled(packageJson) {
|
|
400
403
|
return ((packageJson.dependencies['@storybook/core-server'] ||
|
|
401
404
|
packageJson.devDependencies['@storybook/core-server']) &&
|
|
@@ -404,7 +407,6 @@ function checkStorybookInstalled(packageJson) {
|
|
|
404
407
|
packageJson.dependencies['@nrwl/storybook'] ||
|
|
405
408
|
packageJson.devDependencies['@nrwl/storybook']));
|
|
406
409
|
}
|
|
407
|
-
exports.checkStorybookInstalled = checkStorybookInstalled;
|
|
408
410
|
function checkWebComponentsInstalled(packageJson) {
|
|
409
411
|
return (packageJson.dependencies['@storybook/web-components'] ||
|
|
410
412
|
packageJson.devDependencies['@storybook/web-components-vite'] ||
|
|
@@ -412,7 +414,6 @@ function checkWebComponentsInstalled(packageJson) {
|
|
|
412
414
|
packageJson.devDependencies['@storybook/web-components-webpack5'] ||
|
|
413
415
|
packageJson.dependencies['@storybook/web-components-webpack5']);
|
|
414
416
|
}
|
|
415
|
-
exports.checkWebComponentsInstalled = checkWebComponentsInstalled;
|
|
416
417
|
function afterMigration(tree, allStorybookProjects) {
|
|
417
418
|
Object.entries(allStorybookProjects).forEach(async ([_projectName, storybookProjectInfo]) => {
|
|
418
419
|
const mainJsTsPath = tree.exists(`${storybookProjectInfo.configDir}/main.js`)
|
|
@@ -427,7 +428,6 @@ function afterMigration(tree, allStorybookProjects) {
|
|
|
427
428
|
changeCoreCommonImportToFramework(tree, mainJsTsPath);
|
|
428
429
|
});
|
|
429
430
|
}
|
|
430
|
-
exports.afterMigration = afterMigration;
|
|
431
431
|
function logResult(tree, migrationSummary) {
|
|
432
432
|
devkit_1.output.log({
|
|
433
433
|
title: `Migration complete!`,
|
|
@@ -445,4 +445,3 @@ function logResult(tree, migrationSummary) {
|
|
|
445
445
|
hasSuccessfulProjects: Object.keys(migrationSummary?.successfulProjects)?.length > 0,
|
|
446
446
|
});
|
|
447
447
|
}
|
|
448
|
-
exports.logResult = logResult;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.migrate7Generator =
|
|
3
|
+
exports.migrate7Generator = migrate7Generator;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const output_1 = require("nx/src/utils/output");
|
|
6
6
|
const versions_1 = require("../../utils/versions");
|
|
@@ -64,5 +64,4 @@ async function migrate7Generator(tree, schema) {
|
|
|
64
64
|
await (0, devkit_1.formatFiles)(tree);
|
|
65
65
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
66
66
|
}
|
|
67
|
-
exports.migrate7Generator = migrate7Generator;
|
|
68
67
|
exports.default = migrate7Generator;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = changeStorybookTargets;
|
|
3
4
|
const output_1 = require("nx/src/utils/output");
|
|
4
5
|
const migrate_7_1 = require("../../generators/migrate-7/migrate-7");
|
|
5
6
|
const utilities_1 = require("../../utils/utilities");
|
|
@@ -27,4 +28,3 @@ async function changeStorybookTargets(tree) {
|
|
|
27
28
|
});
|
|
28
29
|
return (0, migrate_7_1.default)(tree, { autoAcceptAllPrompts: true });
|
|
29
30
|
}
|
|
30
|
-
exports.default = changeStorybookTargets;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = replacePackage;
|
|
3
4
|
const devkit_1 = require("@nx/devkit");
|
|
4
5
|
const replace_package_1 = require("@nx/devkit/src/utils/replace-package");
|
|
5
6
|
async function replacePackage(tree) {
|
|
6
7
|
await (0, replace_package_1.replaceNrwlPackageWithNxPackage)(tree, '@nrwl/storybook', '@nx/storybook');
|
|
7
8
|
await (0, devkit_1.formatFiles)(tree);
|
|
8
9
|
}
|
|
9
|
-
exports.default = replacePackage;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = default_1;
|
|
3
4
|
const devkit_1 = require("@nx/devkit");
|
|
4
5
|
async function default_1(tree) {
|
|
5
6
|
const projects = (0, devkit_1.getProjects)(tree);
|
|
@@ -35,4 +36,3 @@ async function default_1(tree) {
|
|
|
35
36
|
}
|
|
36
37
|
await (0, devkit_1.formatFiles)(tree);
|
|
37
38
|
}
|
|
38
|
-
exports.default = default_1;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = default_1;
|
|
3
4
|
const devkit_1 = require("@nx/devkit");
|
|
4
5
|
const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
|
|
5
6
|
const util_functions_1 = require("../../generators/configuration/lib/util-functions");
|
|
@@ -17,4 +18,3 @@ async function default_1(tree) {
|
|
|
17
18
|
(0, util_functions_1.addStorybookToTargetDefaults)(tree, false);
|
|
18
19
|
await (0, devkit_1.formatFiles)(tree);
|
|
19
20
|
}
|
|
20
|
-
exports.default = default_1;
|
package/src/utils/testing.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.createTestUILibNoNgDevkit = createTestUILibNoNgDevkit;
|
|
4
|
+
exports.deleteNewConfigurationAndCreateNew = deleteNewConfigurationAndCreateNew;
|
|
4
5
|
const js_1 = require("@nx/js");
|
|
5
6
|
const eslint_1 = require("@nx/eslint");
|
|
6
7
|
async function createTestUILibNoNgDevkit(appTree, libName) {
|
|
@@ -13,7 +14,6 @@ async function createTestUILibNoNgDevkit(appTree, libName) {
|
|
|
13
14
|
});
|
|
14
15
|
return appTree;
|
|
15
16
|
}
|
|
16
|
-
exports.createTestUILibNoNgDevkit = createTestUILibNoNgDevkit;
|
|
17
17
|
function deleteNewConfigurationAndCreateNew(appTree, projectStorybookRoot) {
|
|
18
18
|
// Remove new Storybook configuration
|
|
19
19
|
appTree.delete(`.storybook/main.js`);
|
|
@@ -31,4 +31,3 @@ function deleteNewConfigurationAndCreateNew(appTree, projectStorybookRoot) {
|
|
|
31
31
|
appTree.write(`${projectStorybookRoot}/tsconfig.json`, '{"test": "hello"}');
|
|
32
32
|
return appTree;
|
|
33
33
|
}
|
|
34
|
-
exports.deleteNewConfigurationAndCreateNew = deleteNewConfigurationAndCreateNew;
|
package/src/utils/utilities.js
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.Constants = void 0;
|
|
4
|
+
exports.storybookMajorVersion = storybookMajorVersion;
|
|
5
|
+
exports.getInstalledStorybookVersion = getInstalledStorybookVersion;
|
|
6
|
+
exports.safeFileDelete = safeFileDelete;
|
|
7
|
+
exports.storybookConfigExistsCheck = storybookConfigExistsCheck;
|
|
8
|
+
exports.dedupe = dedupe;
|
|
9
|
+
exports.findStorybookAndBuildTargetsAndCompiler = findStorybookAndBuildTargetsAndCompiler;
|
|
10
|
+
exports.isTheFileAStory = isTheFileAStory;
|
|
11
|
+
exports.getTsSourceFile = getTsSourceFile;
|
|
12
|
+
exports.pleaseUpgrade = pleaseUpgrade;
|
|
4
13
|
const fs_1 = require("fs");
|
|
5
14
|
const js_1 = require("@nx/js");
|
|
6
15
|
const ts = require("typescript");
|
|
@@ -42,7 +51,6 @@ function storybookMajorVersion() {
|
|
|
42
51
|
return undefined;
|
|
43
52
|
}
|
|
44
53
|
}
|
|
45
|
-
exports.storybookMajorVersion = storybookMajorVersion;
|
|
46
54
|
function getInstalledStorybookVersion() {
|
|
47
55
|
try {
|
|
48
56
|
const storybookPackageVersion = require((0, path_1.join)('@storybook/core-server', 'package.json')).version;
|
|
@@ -52,7 +60,6 @@ function getInstalledStorybookVersion() {
|
|
|
52
60
|
return undefined;
|
|
53
61
|
}
|
|
54
62
|
}
|
|
55
|
-
exports.getInstalledStorybookVersion = getInstalledStorybookVersion;
|
|
56
63
|
function safeFileDelete(tree, path) {
|
|
57
64
|
if (tree.exists(path)) {
|
|
58
65
|
tree.delete(path);
|
|
@@ -62,7 +69,6 @@ function safeFileDelete(tree, path) {
|
|
|
62
69
|
return false;
|
|
63
70
|
}
|
|
64
71
|
}
|
|
65
|
-
exports.safeFileDelete = safeFileDelete;
|
|
66
72
|
function storybookConfigExistsCheck(config, projectName) {
|
|
67
73
|
const exists = !!(config && (0, fs_1.statSync)(config).isDirectory());
|
|
68
74
|
if (!exists) {
|
|
@@ -73,11 +79,9 @@ function storybookConfigExistsCheck(config, projectName) {
|
|
|
73
79
|
`);
|
|
74
80
|
}
|
|
75
81
|
}
|
|
76
|
-
exports.storybookConfigExistsCheck = storybookConfigExistsCheck;
|
|
77
82
|
function dedupe(arr) {
|
|
78
83
|
return Array.from(new Set(arr));
|
|
79
84
|
}
|
|
80
|
-
exports.dedupe = dedupe;
|
|
81
85
|
function findStorybookAndBuildTargetsAndCompiler(targets) {
|
|
82
86
|
const returnObject = {};
|
|
83
87
|
const arrayOfBuilders = [
|
|
@@ -157,7 +161,6 @@ function findStorybookAndBuildTargetsAndCompiler(targets) {
|
|
|
157
161
|
}
|
|
158
162
|
return returnObject;
|
|
159
163
|
}
|
|
160
|
-
exports.findStorybookAndBuildTargetsAndCompiler = findStorybookAndBuildTargetsAndCompiler;
|
|
161
164
|
function isTheFileAStory(tree, path) {
|
|
162
165
|
const ext = path.slice(path.lastIndexOf('.'));
|
|
163
166
|
let fileIsStory = false;
|
|
@@ -200,7 +203,6 @@ function isTheFileAStory(tree, path) {
|
|
|
200
203
|
}
|
|
201
204
|
return fileIsStory;
|
|
202
205
|
}
|
|
203
|
-
exports.isTheFileAStory = isTheFileAStory;
|
|
204
206
|
function getTsSourceFile(host, path) {
|
|
205
207
|
const buffer = host.read(path);
|
|
206
208
|
if (!buffer) {
|
|
@@ -210,7 +212,6 @@ function getTsSourceFile(host, path) {
|
|
|
210
212
|
const source = ts.createSourceFile(path, content, ts.ScriptTarget.Latest, true);
|
|
211
213
|
return source;
|
|
212
214
|
}
|
|
213
|
-
exports.getTsSourceFile = getTsSourceFile;
|
|
214
215
|
function pleaseUpgrade() {
|
|
215
216
|
return `
|
|
216
217
|
Storybook 6 is no longer maintained, and not supported in Nx.
|
|
@@ -220,4 +221,3 @@ function pleaseUpgrade() {
|
|
|
220
221
|
https://nx.dev/nx-api/storybook/generators/migrate-7
|
|
221
222
|
`;
|
|
222
223
|
}
|
|
223
|
-
exports.pleaseUpgrade = pleaseUpgrade;
|