@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.
Files changed (125) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/LICENSE +22 -0
  3. package/README.md +63 -0
  4. package/executors.json +26 -0
  5. package/generators.json +58 -0
  6. package/index.d.ts +3 -0
  7. package/index.js +10 -0
  8. package/index.js.map +1 -0
  9. package/migrations.json +294 -0
  10. package/package.json +49 -0
  11. package/presets/cypress.d.ts +22 -0
  12. package/presets/cypress.js +9 -0
  13. package/presets/cypress.js.map +1 -0
  14. package/src/executors/build-storybook/build-storybook.impl.d.ts +7 -0
  15. package/src/executors/build-storybook/build-storybook.impl.js +58 -0
  16. package/src/executors/build-storybook/build-storybook.impl.js.map +1 -0
  17. package/src/executors/build-storybook/compat.d.ts +2 -0
  18. package/src/executors/build-storybook/compat.js +6 -0
  19. package/src/executors/build-storybook/compat.js.map +1 -0
  20. package/src/executors/build-storybook/schema.json +122 -0
  21. package/src/executors/storybook/compat.d.ts +2 -0
  22. package/src/executors/storybook/compat.js +6 -0
  23. package/src/executors/storybook/compat.js.map +1 -0
  24. package/src/executors/storybook/schema.json +94 -0
  25. package/src/executors/storybook/storybook.impl.d.ts +11 -0
  26. package/src/executors/storybook/storybook.impl.js +53 -0
  27. package/src/executors/storybook/storybook.impl.js.map +1 -0
  28. package/src/executors/utils.d.ts +12 -0
  29. package/src/executors/utils.js +148 -0
  30. package/src/executors/utils.js.map +1 -0
  31. package/src/generators/configuration/configuration.d.ts +5 -0
  32. package/src/generators/configuration/configuration.js +191 -0
  33. package/src/generators/configuration/configuration.js.map +1 -0
  34. package/src/generators/configuration/lib/user-prompts.d.ts +6 -0
  35. package/src/generators/configuration/lib/user-prompts.js +90 -0
  36. package/src/generators/configuration/lib/user-prompts.js.map +1 -0
  37. package/src/generators/configuration/lib/util-functions.d.ts +27 -0
  38. package/src/generators/configuration/lib/util-functions.js +359 -0
  39. package/src/generators/configuration/lib/util-functions.js.map +1 -0
  40. package/src/generators/configuration/project-files/.storybook/main.js__tmpl__ +46 -0
  41. package/src/generators/configuration/project-files/.storybook/preview.js__tmpl__ +0 -0
  42. package/src/generators/configuration/project-files/.storybook/tsconfig.json__tmpl__ +26 -0
  43. package/src/generators/configuration/project-files-7/.storybook/main.js__tmpl__ +34 -0
  44. package/src/generators/configuration/project-files-7/.storybook/preview.js__tmpl__ +0 -0
  45. package/src/generators/configuration/project-files-7/.storybook/tsconfig.json__tmpl__ +26 -0
  46. package/src/generators/configuration/project-files-7-ts/.storybook/main.ts__tmpl__ +36 -0
  47. package/src/generators/configuration/project-files-7-ts/.storybook/preview.ts__tmpl__ +0 -0
  48. package/src/generators/configuration/project-files-7-ts/.storybook/tsconfig.json__tmpl__ +28 -0
  49. package/src/generators/configuration/project-files-ts/.storybook/main.ts__tmpl__ +49 -0
  50. package/src/generators/configuration/project-files-ts/.storybook/preview.ts__tmpl__ +0 -0
  51. package/src/generators/configuration/project-files-ts/.storybook/tsconfig.json__tmpl__ +28 -0
  52. package/src/generators/configuration/schema.d.ts +19 -0
  53. package/src/generators/configuration/schema.json +124 -0
  54. package/src/generators/cypress-project/cypress-project.d.ts +14 -0
  55. package/src/generators/cypress-project/cypress-project.js +98 -0
  56. package/src/generators/cypress-project/cypress-project.js.map +1 -0
  57. package/src/generators/cypress-project/files/cypress.config.ts__tpl__ +6 -0
  58. package/src/generators/cypress-project/schema.json +55 -0
  59. package/src/generators/init/init.d.ts +5 -0
  60. package/src/generators/init/init.js +181 -0
  61. package/src/generators/init/init.js.map +1 -0
  62. package/src/generators/init/schema.d.ts +8 -0
  63. package/src/generators/init/schema.json +60 -0
  64. package/src/generators/migrate-7/calling-storybook-cli.d.ts +13 -0
  65. package/src/generators/migrate-7/calling-storybook-cli.js +85 -0
  66. package/src/generators/migrate-7/calling-storybook-cli.js.map +1 -0
  67. package/src/generators/migrate-7/files/storybook-migration-summary.md__tmpl__ +80 -0
  68. package/src/generators/migrate-7/helper-functions.d.ts +69 -0
  69. package/src/generators/migrate-7/helper-functions.js +449 -0
  70. package/src/generators/migrate-7/helper-functions.js.map +1 -0
  71. package/src/generators/migrate-7/migrate-7.d.ts +5 -0
  72. package/src/generators/migrate-7/migrate-7.js +73 -0
  73. package/src/generators/migrate-7/migrate-7.js.map +1 -0
  74. package/src/generators/migrate-7/schema.d.ts +9 -0
  75. package/src/generators/migrate-7/schema.json +35 -0
  76. package/src/migrations/update-13-4-6/set-project-build-config.d.ts +2 -0
  77. package/src/migrations/update-13-4-6/set-project-build-config.js +61 -0
  78. package/src/migrations/update-13-4-6/set-project-build-config.js.map +1 -0
  79. package/src/migrations/update-14-0-0/migrate-defaults-5-to-6/migrate-defaults-5-to-6.d.ts +6 -0
  80. package/src/migrations/update-14-0-0/migrate-defaults-5-to-6/migrate-defaults-5-to-6.js +120 -0
  81. package/src/migrations/update-14-0-0/migrate-defaults-5-to-6/migrate-defaults-5-to-6.js.map +1 -0
  82. package/src/migrations/update-14-0-0/migrate-stories-to-6-2/migrate-stories-to-6-2.d.ts +8 -0
  83. package/src/migrations/update-14-0-0/migrate-stories-to-6-2/migrate-stories-to-6-2.js +294 -0
  84. package/src/migrations/update-14-0-0/migrate-stories-to-6-2/migrate-stories-to-6-2.js.map +1 -0
  85. package/src/migrations/update-14-0-0/migrate-to-storybook-6.d.ts +2 -0
  86. package/src/migrations/update-14-0-0/migrate-to-storybook-6.js +13 -0
  87. package/src/migrations/update-14-0-0/migrate-to-storybook-6.js.map +1 -0
  88. package/src/migrations/update-14-1-8/change-storybook-targets-generator.d.ts +4 -0
  89. package/src/migrations/update-14-1-8/change-storybook-targets-generator.js +105 -0
  90. package/src/migrations/update-14-1-8/change-storybook-targets-generator.js.map +1 -0
  91. package/src/migrations/update-14-1-8/change-storybook-targets.d.ts +2 -0
  92. package/src/migrations/update-14-1-8/change-storybook-targets.js +11 -0
  93. package/src/migrations/update-14-1-8/change-storybook-targets.js.map +1 -0
  94. package/src/migrations/update-15-0-0/add-storybook-inputs.d.ts +2 -0
  95. package/src/migrations/update-15-0-0/add-storybook-inputs.js +47 -0
  96. package/src/migrations/update-15-0-0/add-storybook-inputs.js.map +1 -0
  97. package/src/migrations/update-15-4-6/refactor-executor-options.d.ts +2 -0
  98. package/src/migrations/update-15-4-6/refactor-executor-options.js +67 -0
  99. package/src/migrations/update-15-4-6/refactor-executor-options.js.map +1 -0
  100. package/src/migrations/update-15-5-3/ensure-webpack-package.d.ts +2 -0
  101. package/src/migrations/update-15-5-3/ensure-webpack-package.js +33 -0
  102. package/src/migrations/update-15-5-3/ensure-webpack-package.js.map +1 -0
  103. package/src/migrations/update-15-7-0/add-addon-essentials-to-all.d.ts +24 -0
  104. package/src/migrations/update-15-7-0/add-addon-essentials-to-all.js +278 -0
  105. package/src/migrations/update-15-7-0/add-addon-essentials-to-all.js.map +1 -0
  106. package/src/migrations/update-15-7-0/remove-root-config.d.ts +14 -0
  107. package/src/migrations/update-15-7-0/remove-root-config.js +210 -0
  108. package/src/migrations/update-15-7-0/remove-root-config.js.map +1 -0
  109. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +2 -0
  110. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +13 -0
  111. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js.map +1 -0
  112. package/src/utils/models.d.ts +5 -0
  113. package/src/utils/models.js +3 -0
  114. package/src/utils/models.js.map +1 -0
  115. package/src/utils/test-configs/.storybook/main.js +8 -0
  116. package/src/utils/test-configs/.storybook/tsconfig.json +19 -0
  117. package/src/utils/testing.d.ts +3 -0
  118. package/src/utils/testing.js +38 -0
  119. package/src/utils/testing.js.map +1 -0
  120. package/src/utils/utilities.d.ts +53 -0
  121. package/src/utils/utilities.js +255 -0
  122. package/src/utils/utilities.js.map +1 -0
  123. package/src/utils/versions.d.ts +20 -0
  124. package/src/utils/versions.js +24 -0
  125. package/src/utils/versions.js.map +1 -0
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.changeStorybookTargetsSchematic = exports.changeStorybookTargetsGenerator = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const devkit_1 = require("@nx/devkit");
6
+ const utilities_1 = require("../../utils/utilities");
7
+ function changeStorybookTargetsGenerator(tree) {
8
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
9
+ let changesMade = false;
10
+ let changesMadeToAtLeastOne = false;
11
+ const projects = (0, devkit_1.getProjects)(tree);
12
+ [...projects.entries()].forEach(([projectName, projectConfiguration]) => {
13
+ var _a, _b, _c;
14
+ changesMade = false;
15
+ const { storybookBuildTarget, storybookTarget, ngBuildTarget } = (0, utilities_1.findStorybookAndBuildTargetsAndCompiler)(projectConfiguration.targets);
16
+ if (projectName &&
17
+ storybookTarget &&
18
+ ((_c = (_b = (_a = projectConfiguration === null || projectConfiguration === void 0 ? void 0 : projectConfiguration.targets) === null || _a === void 0 ? void 0 : _a[storybookTarget]) === null || _b === void 0 ? void 0 : _b.options) === null || _c === void 0 ? void 0 : _c.uiFramework) ===
19
+ '@storybook/angular') {
20
+ projectConfiguration.targets[storybookTarget] = updateStorybookTarget(projectConfiguration, storybookTarget, projectName, ngBuildTarget, storybookBuildTarget);
21
+ changesMade = true;
22
+ changesMadeToAtLeastOne = true;
23
+ if (storybookBuildTarget) {
24
+ projectConfiguration.targets[storybookBuildTarget] =
25
+ updateStorybookBuildTarget(projectConfiguration, projectName, ngBuildTarget, storybookBuildTarget);
26
+ }
27
+ else {
28
+ devkit_1.logger.info(`Project ${projectName} does not have a build target configured for Storybook.`);
29
+ }
30
+ }
31
+ else {
32
+ devkit_1.logger.warn(`Could not find a Storybook target for ${projectName}.`);
33
+ }
34
+ if (changesMade) {
35
+ (0, devkit_1.updateProjectConfiguration)(tree, projectName, projectConfiguration);
36
+ }
37
+ });
38
+ if (changesMadeToAtLeastOne) {
39
+ yield (0, devkit_1.formatFiles)(tree);
40
+ }
41
+ });
42
+ }
43
+ exports.changeStorybookTargetsGenerator = changeStorybookTargetsGenerator;
44
+ function updateStorybookTarget(projectConfiguration, storybookTarget, projectName, buildTarget, storybookBuildTarget) {
45
+ var _a;
46
+ const oldStorybookTargetConfig = projectConfiguration.targets[storybookTarget];
47
+ const newStorybookTargetConfig = {
48
+ executor: '@storybook/angular:start-storybook',
49
+ options: {
50
+ port: oldStorybookTargetConfig.options.port,
51
+ configDir: (_a = oldStorybookTargetConfig.options.config) === null || _a === void 0 ? void 0 : _a.configFolder,
52
+ browserTarget: undefined,
53
+ compodoc: false,
54
+ },
55
+ configurations: oldStorybookTargetConfig.configurations,
56
+ };
57
+ const { project, target } = parseTargetStringCustom(oldStorybookTargetConfig.options.projectBuildConfig);
58
+ if (project && target) {
59
+ newStorybookTargetConfig.options.browserTarget =
60
+ oldStorybookTargetConfig.options.projectBuildConfig;
61
+ }
62
+ else {
63
+ newStorybookTargetConfig.options.browserTarget = `${projectName}:${buildTarget ? buildTarget : storybookBuildTarget}`;
64
+ }
65
+ const _b = oldStorybookTargetConfig.options, { uiFramework, outputPath, config, projectBuildConfig } = _b, optionsToCopy = tslib_1.__rest(_b, ["uiFramework", "outputPath", "config", "projectBuildConfig"]);
66
+ newStorybookTargetConfig.options = Object.assign(Object.assign({}, optionsToCopy), newStorybookTargetConfig.options);
67
+ return newStorybookTargetConfig;
68
+ }
69
+ function updateStorybookBuildTarget(projectConfiguration, projectName, buildTarget, storybookBuildTarget) {
70
+ var _a;
71
+ const oldStorybookBuildTargetConfig = projectConfiguration.targets[storybookBuildTarget];
72
+ const newStorybookBuildTargetConfig = {
73
+ executor: '@storybook/angular:build-storybook',
74
+ outputs: oldStorybookBuildTargetConfig.outputs,
75
+ options: {
76
+ outputDir: oldStorybookBuildTargetConfig.options.outputPath,
77
+ configDir: (_a = oldStorybookBuildTargetConfig.options.config) === null || _a === void 0 ? void 0 : _a.configFolder,
78
+ browserTarget: undefined,
79
+ compodoc: false,
80
+ },
81
+ configurations: oldStorybookBuildTargetConfig.configurations,
82
+ };
83
+ const { project, target } = parseTargetStringCustom(oldStorybookBuildTargetConfig.options.projectBuildConfig);
84
+ if (project && target) {
85
+ newStorybookBuildTargetConfig.options.browserTarget =
86
+ oldStorybookBuildTargetConfig.options.projectBuildConfig;
87
+ }
88
+ else {
89
+ newStorybookBuildTargetConfig.options.browserTarget = `${projectName}:${buildTarget ? buildTarget : storybookBuildTarget}`;
90
+ }
91
+ const _b = oldStorybookBuildTargetConfig.options, { uiFramework, outputPath, config, projectBuildConfig } = _b, optionsToCopy = tslib_1.__rest(_b, ["uiFramework", "outputPath", "config", "projectBuildConfig"]);
92
+ newStorybookBuildTargetConfig.options = Object.assign(Object.assign({}, optionsToCopy), newStorybookBuildTargetConfig.options);
93
+ return newStorybookBuildTargetConfig;
94
+ }
95
+ function parseTargetStringCustom(targetString) {
96
+ const [project, target, configuration] = targetString.split(':');
97
+ return {
98
+ project,
99
+ target,
100
+ configuration,
101
+ };
102
+ }
103
+ exports.default = changeStorybookTargetsGenerator;
104
+ exports.changeStorybookTargetsSchematic = (0, devkit_1.convertNxGenerator)(changeStorybookTargetsGenerator);
105
+ //# sourceMappingURL=change-storybook-targets-generator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"change-storybook-targets-generator.js","sourceRoot":"","sources":["../../../../../../packages/storybook/src/migrations/update-14-1-8/change-storybook-targets-generator.ts"],"names":[],"mappings":";;;;AAAA,uCAUoB;AACpB,qDAAgF;AAEhF,SAAsB,+BAA+B,CAAC,IAAU;;QAC9D,IAAI,WAAW,GAAG,KAAK,CAAC;QACxB,IAAI,uBAAuB,GAAG,KAAK,CAAC;QACpC,MAAM,QAAQ,GAAG,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;QACnC,CAAC,GAAG,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,EAAE,oBAAoB,CAAC,EAAE,EAAE;;YACtE,W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
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const change_storybook_targets_generator_1 = require("./change-storybook-targets-generator");
5
+ function changeStorybookTargets(tree) {
6
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
7
+ return (0, change_storybook_targets_generator_1.changeStorybookTargetsGenerator)(tree);
8
+ });
9
+ }
10
+ exports.default = changeStorybookTargets;
11
+ //# sourceMappingURL=change-storybook-targets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"change-storybook-targets.js","sourceRoot":"","sources":["../../../../../../packages/storybook/src/migrations/update-14-1-8/change-storybook-targets.ts"],"names":[],"mappings":";;;AACA,6FAAuF;AAEvF,SAA8B,sBAAsB,CAAC,IAAU;;QAC7D,OAAO,IAAA,oEAA+B,EAAC,IAAI,CAAC,CAAC;IAC/C,CAAC;CAAA;AAFD,yCAEC"}
@@ -0,0 +1,2 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export default function (tree: Tree): Promise<void>;
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const devkit_1 = require("@nx/devkit");
5
+ const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
6
+ function default_1(tree) {
7
+ var _a, _b, _c, _d;
8
+ var _e;
9
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
10
+ const nxJson = (0, devkit_1.readNxJson)(tree);
11
+ const storybookTargets = getStorybookBuildTargets(tree);
12
+ const hasProductionFileset = !!((_a = nxJson.namedInputs) === null || _a === void 0 ? void 0 : _a.production);
13
+ if (storybookTargets.size > 0 && hasProductionFileset) {
14
+ const productionFileset = new Set(nxJson.namedInputs.production);
15
+ for (const exclusion of [
16
+ '!{projectRoot}/.storybook/**/*',
17
+ '!{projectRoot}/**/*.stories.@(js|jsx|ts|tsx|mdx)',
18
+ ]) {
19
+ productionFileset.add(exclusion);
20
+ }
21
+ nxJson.namedInputs.production = Array.from(productionFileset);
22
+ }
23
+ for (const targetName of storybookTargets) {
24
+ (_b = nxJson.targetDefaults) !== null && _b !== void 0 ? _b : (nxJson.targetDefaults = {});
25
+ const storybookTargetDefaults = ((_c = (_e = nxJson.targetDefaults)[targetName]) !== null && _c !== void 0 ? _c : (_e[targetName] = {}));
26
+ (_d = storybookTargetDefaults.inputs) !== null && _d !== void 0 ? _d : (storybookTargetDefaults.inputs = [
27
+ 'default',
28
+ hasProductionFileset ? '^production' : '^default',
29
+ ...(tree.exists('.storybook') ? ['{workspaceRoot}/.storybook/**/*'] : []),
30
+ ]);
31
+ }
32
+ (0, devkit_1.updateNxJson)(tree, nxJson);
33
+ yield (0, devkit_1.formatFiles)(tree);
34
+ });
35
+ }
36
+ exports.default = default_1;
37
+ function getStorybookBuildTargets(tree) {
38
+ const storybookBuildTargets = new Set();
39
+ (0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nrwl/storybook:build', (_, __, target) => {
40
+ storybookBuildTargets.add(target);
41
+ });
42
+ (0, executor_options_utils_1.forEachExecutorOptions)(tree, '@storybook/angular:build-storybook', (_, __, target) => {
43
+ storybookBuildTargets.add(target);
44
+ });
45
+ return storybookBuildTargets;
46
+ }
47
+ //# sourceMappingURL=add-storybook-inputs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-storybook-inputs.js","sourceRoot":"","sources":["../../../../../../packages/storybook/src/migrations/update-15-0-0/add-storybook-inputs.ts"],"names":[],"mappings":";;;AAAA,uCAAyE;AACzE,6FAA0F;AAE1F,mBAA+B,IAAU;;;;QACvC,MAAM,MAAM,GAAG,IAAA,mBAAU,EAAC,IAAI,CAAC,CAAC;QAEhC,MAAM,gBAAgB,GAAG,wBAAwB,CAAC,IAAI,CAAC,CAAC;QACxD,MAAM,oBAAoB,GAAG,CAAC,CAAC,CAAA,MAAA,MAAM,CAAC,WAAW,0CAAE,UAAU,CAAA,CAAC;QAE9D,IAAI,gBAAgB,CAAC,IAAI,GAA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,IAAA,+CAAsB,EACpB,IAAI,EACJ,oCAAoC,EACpC,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE;QAChB,qBAAqB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC,CACF,CAAC;IACF,OAAO,qBAAqB,CAAC;AAC/B,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export default function (tree: Tree): Promise<void>;
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const devkit_1 = require("@nx/devkit");
5
+ const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
6
+ function default_1(tree) {
7
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
8
+ updateNonAngularStorybookBuildTargets(tree);
9
+ updateNonAngularStorybookServeTargets(tree);
10
+ yield (0, devkit_1.formatFiles)(tree);
11
+ });
12
+ }
13
+ exports.default = default_1;
14
+ function updateNonAngularStorybookBuildTargets(tree) {
15
+ (0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nrwl/storybook:build', (_options, projectName, targetName, configuration) => {
16
+ var _a, _b;
17
+ if (!configuration) {
18
+ return;
19
+ }
20
+ const projectConfiguration = (0, devkit_1.readProjectConfiguration)(tree, projectName);
21
+ if (!projectConfiguration.targets[targetName].options) {
22
+ projectConfiguration.targets[targetName].options = {};
23
+ }
24
+ if (!projectConfiguration.targets[targetName].options.configDir) {
25
+ projectConfiguration.targets[targetName].options.configDir =
26
+ (_a = projectConfiguration.targets[targetName].options.config) === null || _a === void 0 ? void 0 : _a.configFolder;
27
+ }
28
+ if (!projectConfiguration.targets[targetName].options.outputDir) {
29
+ projectConfiguration.targets[targetName].options.outputDir =
30
+ projectConfiguration.targets[targetName].options.outputPath;
31
+ }
32
+ if (!projectConfiguration.targets[targetName].options.docs) {
33
+ projectConfiguration.targets[targetName].options.docs =
34
+ projectConfiguration.targets[targetName].options.docsMode;
35
+ }
36
+ projectConfiguration.targets[targetName].outputs =
37
+ (_b = projectConfiguration.targets[targetName].outputs) === null || _b === void 0 ? void 0 : _b.map((output) => output.replace('{options.outputPath}', '{options.outputDir}'));
38
+ delete projectConfiguration.targets[targetName].options.config;
39
+ delete projectConfiguration.targets[targetName].options.outputPath;
40
+ delete projectConfiguration.targets[targetName].options.docsMode;
41
+ (0, devkit_1.updateProjectConfiguration)(tree, projectName, Object.assign({}, projectConfiguration));
42
+ });
43
+ }
44
+ function updateNonAngularStorybookServeTargets(tree) {
45
+ (0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nrwl/storybook:storybook', (_options, projectName, targetName, configuration) => {
46
+ var _a;
47
+ if (!configuration) {
48
+ return;
49
+ }
50
+ const projectConfiguration = (0, devkit_1.readProjectConfiguration)(tree, projectName);
51
+ if (!projectConfiguration.targets[targetName].options) {
52
+ projectConfiguration.targets[targetName].options = {};
53
+ }
54
+ if (!projectConfiguration.targets[targetName].options.configDir) {
55
+ projectConfiguration.targets[targetName].options.configDir =
56
+ (_a = projectConfiguration.targets[targetName].options.config) === null || _a === void 0 ? void 0 : _a.configFolder;
57
+ }
58
+ if (!projectConfiguration.targets[targetName].options.docs) {
59
+ projectConfiguration.targets[targetName].options.docs =
60
+ projectConfiguration.targets[targetName].options.docsMode;
61
+ }
62
+ delete projectConfiguration.targets[targetName].options.config;
63
+ delete projectConfiguration.targets[targetName].options.docsMode;
64
+ (0, devkit_1.updateProjectConfiguration)(tree, projectName, Object.assign({}, projectConfiguration));
65
+ });
66
+ }
67
+ //# sourceMappingURL=refactor-executor-options.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refactor-executor-options.js","sourceRoot":"","sources":["../../../../../../packages/storybook/src/migrations/update-15-4-6/refactor-executor-options.ts"],"names":[],"mappings":";;;AAAA,uCAKoB;AACpB,6FAA0F;AAE1F,mBAA+B,IAAU;;QACvC,qCAAqC,CAAC,IAAI,CAAC,CAAC;QAC5C,qCAA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C,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,MAAM,0CAAE,YAAY,CAAC;SACzE;QAED,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE;YAC1D,oBAAoB,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,IAAI;gBACnD,oBAAoB,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;SAC7D;QAED,OAAO,oBAAoB,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;QAC/D,OAAO,oBAAoB,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;QAEjE,IAAA,mCAA0B,EAAC,IAAI,EAAE,WAAW,oBACvC,oBAAoB,EACvB,CAAC;IACL,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export default function update(tree: Tree): Promise<import("@nx/devkit").GeneratorCallback>;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const devkit_1 = require("@nx/devkit");
5
+ const versions_1 = require("../../utils/versions");
6
+ // Add @nrwl/webpack as needed.
7
+ // See: https://github.com/nrwl/nx/issues/14455
8
+ function update(tree) {
9
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
10
+ const projects = (0, devkit_1.getProjects)(tree);
11
+ const reactPlugin = '@nrwl/react/plugins/storybook';
12
+ let shouldInstall = false;
13
+ for (const [, config] of projects) {
14
+ let sbConfigPath = (0, devkit_1.joinPathFragments)(config.root, '.storybook/main.ts');
15
+ if (!tree.exists(sbConfigPath)) {
16
+ sbConfigPath = (0, devkit_1.joinPathFragments)(config.root, '.storybook/main.js');
17
+ }
18
+ if (!tree.exists(sbConfigPath)) {
19
+ continue;
20
+ }
21
+ const sbConfig = tree.read(sbConfigPath, 'utf-8');
22
+ if (sbConfig.includes(reactPlugin)) {
23
+ shouldInstall = true;
24
+ break;
25
+ }
26
+ }
27
+ if (shouldInstall) {
28
+ return (0, devkit_1.addDependenciesToPackageJson)(tree, {}, { '@nrwl/webpack': versions_1.nxVersion });
29
+ }
30
+ });
31
+ }
32
+ exports.default = update;
33
+ //# sourceMappingURL=ensure-webpack-package.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ensure-webpack-package.js","sourceRoot":"","sources":["../../../../../../packages/storybook/src/migrations/update-15-5-3/ensure-webpack-package.ts"],"names":[],"mappings":";;;AAAA,uCAKoB;AACpB,mDAAiD;AAEjD,+BAA+B;AAC/B,+CAA+C;AAC/C,SAA8B,MAAM,CAAC,IAAU;;QAC7C,MAAM,QAAQ,GAAG,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;QACnC,MAAM,WAAW,GAAG,+BAA+B,CAAC;QACpD,IAAI,aAAa,GAAG,KAAK,CAAC;QAE1B,KAAK,MAAM,CAAC,EAAE,MAAM,CAAC,IAAI,QAAQ,EAAE;YACjC,IAAI,YAAY,GAAG,IAAA,0BAAiB,EAAC,MAAM,CAAC,IAAI,EAAE,oBAAoB,CAAC,CAAC;YAExE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE;gBAC9B,YAAY,GAAG,IAAA,0BAAiB,EAAC,MAAM,CAAC,IAAI,EAAE,oBAAoB,CAAC,CAAC;aACrE;YAED,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE;gBAC9B,SAAS;aACV;YAED,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;YAClD,IAAI,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE;gBAClC,aAAa,GAAG,IAAI,CAAC;gBACrB,MAAM;aACP;SACF;QAED,IAAI,aAAa,EAAE;YACjB,OAAO,IAAA,qCAA4B,EACjC,IAAI,EACJ,EAAE,EACF,EAAE,eAAe,EAAE,oBAAS,EAAE,CAC/B,CAAC;SACH;IACH,CAAC;CAAA;AA9BD,yBA8BC"}
@@ -0,0 +1,24 @@
1
+ import { Tree } from '@nx/devkit';
2
+ import ts = require('typescript');
3
+ /**
4
+ * The purpose of this migrator is to help users move away
5
+ * from the root .storybook/ configuration folder and files.
6
+ *
7
+ * Since we cannot be sure of how users make use of the root Storybook
8
+ * directory, what we are going to do is the following:
9
+ *
10
+ * 1. Make sure that all project-level .storybook/main.js files contain
11
+ * the @storybook/addon-essentials addon.
12
+ * 2. If the root .storybook/main.js file contains the @storybook/addon-essentials remove it
13
+ * from the root
14
+ * 3. If there are things beyond the addons array in the root .storybook/main.js file,
15
+ * then keep it as it is - inform user that they need to manually need to copy over any extra stuff
16
+ * 4. If the root .storybook/main.js file is now empty, inform user that they can delete it safely
17
+ *
18
+ * Point the user to a guide that explains how to all these things.
19
+ */
20
+ export default function (tree: Tree): Promise<void>;
21
+ export declare function getRootMainVariableName(mainJsTs: string): {
22
+ rootMainVariableName: string;
23
+ importExpression: ts.Node;
24
+ };
@@ -0,0 +1,278 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getRootMainVariableName = 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 tsquery_1 = require("@phenomnomnominal/tsquery");
8
+ const remove_root_config_1 = require("./remove-root-config");
9
+ /**
10
+ * The purpose of this migrator is to help users move away
11
+ * from the root .storybook/ configuration folder and files.
12
+ *
13
+ * Since we cannot be sure of how users make use of the root Storybook
14
+ * directory, what we are going to do is the following:
15
+ *
16
+ * 1. Make sure that all project-level .storybook/main.js files contain
17
+ * the @storybook/addon-essentials addon.
18
+ * 2. If the root .storybook/main.js file contains the @storybook/addon-essentials remove it
19
+ * from the root
20
+ * 3. If there are things beyond the addons array in the root .storybook/main.js file,
21
+ * then keep it as it is - inform user that they need to manually need to copy over any extra stuff
22
+ * 4. If the root .storybook/main.js file is now empty, inform user that they can delete it safely
23
+ *
24
+ * Point the user to a guide that explains how to all these things.
25
+ */
26
+ function default_1(tree) {
27
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
28
+ const projectsThatFailedTOAddAddonEssentials = addAddonEssentialsToAllStorybooks(tree);
29
+ if (projectsThatFailedTOAddAddonEssentials.length) {
30
+ devkit_1.logger.info(`
31
+ We could not add the @storybook/addon-essentials addon
32
+ to the following projects' Storybook configurations:
33
+
34
+ ${projectsThatFailedTOAddAddonEssentials.join(', ')}
35
+
36
+ Please add it manually in the addons array of your project's
37
+ .storybook/main.js|ts file.
38
+ `);
39
+ }
40
+ const rootMainJsTsPath = tree.exists('.storybook/main.js')
41
+ ? '.storybook/main.js'
42
+ : tree.exists('.storybook/main.ts')
43
+ ? '.storybook/main.ts'
44
+ : undefined;
45
+ if (rootMainJsTsPath) {
46
+ const addonArrayOrEssentialsRemoved = removeAddonEssentialsFromRootStorybook(tree, rootMainJsTsPath);
47
+ const storiesArrayRemoved = removeStoriesArrayFromRootIfEmpty(tree, rootMainJsTsPath);
48
+ const removedRoot = (0, remove_root_config_1.removeRootConfig)(tree, rootMainJsTsPath);
49
+ if (removedRoot) {
50
+ // Logs are already printed in the removeRootConfig function
51
+ }
52
+ else {
53
+ devkit_1.logger.info(`
54
+ We removed the ${addonArrayOrEssentialsRemoved === 'addons'
55
+ ? 'addons array '
56
+ : '@storybook/addon-essentials addon '}
57
+ ${storiesArrayRemoved ? 'and the stories array ' : ''}
58
+ from the root .storybook/main.js|ts file.
59
+ `);
60
+ }
61
+ }
62
+ devkit_1.logger.info(`
63
+ Read more about our effort to deprecate the root .storybook folder here:
64
+ https://nx.dev/packages/storybook/documents/configuring-storybook
65
+ `);
66
+ yield (0, devkit_1.formatFiles)(tree);
67
+ });
68
+ }
69
+ exports.default = default_1;
70
+ function removeAddonEssentialsFromRootStorybook(tree, rootMainJsTsPath) {
71
+ var _a, _b, _c, _d;
72
+ let rootMainJsTs = tree.read(rootMainJsTsPath, 'utf-8');
73
+ const addonEssentials = (_a = tsquery_1.tsquery.query(rootMainJsTs, 'StringLiteral:has([text="@storybook/addon-essentials"])')) === null || _a === void 0 ? void 0 : _a[0];
74
+ if ((_b = addonEssentials === null || addonEssentials === void 0 ? void 0 : addonEssentials.getText()) === null || _b === void 0 ? void 0 : _b.length) {
75
+ const fullAddonsNode = (_c = tsquery_1.tsquery.query(rootMainJsTs, 'PropertyAssignment:has([name="addons"])')) === null || _c === void 0 ? void 0 : _c[0];
76
+ const stringLiterals = tsquery_1.tsquery.query(fullAddonsNode, 'StringLiteral');
77
+ if ((stringLiterals === null || stringLiterals === void 0 ? void 0 : stringLiterals.length) === 1 &&
78
+ ((_d = stringLiterals === null || stringLiterals === void 0 ? void 0 : stringLiterals[0]) === null || _d === void 0 ? void 0 : _d.getText()) === `'@storybook/addon-essentials'`) {
79
+ rootMainJsTs = (0, devkit_1.applyChangesToString)(rootMainJsTs, [
80
+ {
81
+ type: devkit_1.ChangeType.Delete,
82
+ start: fullAddonsNode.getStart(),
83
+ length: rootMainJsTs[fullAddonsNode.getEnd()] === ','
84
+ ? fullAddonsNode.getText().length + 1
85
+ : fullAddonsNode.getText().length,
86
+ },
87
+ ]);
88
+ tree.write(rootMainJsTsPath, rootMainJsTs);
89
+ return 'addons';
90
+ }
91
+ else {
92
+ rootMainJsTs = (0, devkit_1.applyChangesToString)(rootMainJsTs, [
93
+ {
94
+ type: devkit_1.ChangeType.Delete,
95
+ start: addonEssentials.getStart(),
96
+ length: rootMainJsTs[addonEssentials.getEnd()] === ','
97
+ ? addonEssentials.getText().length + 1
98
+ : addonEssentials.getText().length,
99
+ },
100
+ ]);
101
+ tree.write(rootMainJsTsPath, rootMainJsTs);
102
+ return 'esssentials';
103
+ }
104
+ }
105
+ }
106
+ function addAddonEssentialsToAllStorybooks(tree) {
107
+ const projectsThatFailedTOAddAddonEssentials = [];
108
+ (0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nrwl/storybook:build', (options, projectName) => {
109
+ const failedToAddAddon = addAddon(tree, options, projectName);
110
+ if (failedToAddAddon) {
111
+ projectsThatFailedTOAddAddonEssentials.push(failedToAddAddon);
112
+ }
113
+ });
114
+ (0, executor_options_utils_1.forEachExecutorOptions)(tree, '@storybook/angular:build-storybook', (options, projectName) => {
115
+ const failedToAddAddon = addAddon(tree, options, projectName);
116
+ if (failedToAddAddon) {
117
+ projectsThatFailedTOAddAddonEssentials.push(failedToAddAddon);
118
+ }
119
+ });
120
+ return Array.from(new Set(projectsThatFailedTOAddAddonEssentials));
121
+ }
122
+ function addAddon(tree, options, projectName) {
123
+ const storybookDir = options === null || options === void 0 ? void 0 : options['configDir'];
124
+ if (storybookDir) {
125
+ const mainJsTsPath = tree.exists(`${storybookDir}/main.js`)
126
+ ? `${storybookDir}/main.js`
127
+ : tree.exists(`${storybookDir}/main.ts`)
128
+ ? `${storybookDir}/main.ts`
129
+ : undefined;
130
+ let addedAddons = mainJsTsPath
131
+ ? transformMainJsTs(tree, mainJsTsPath)
132
+ : false;
133
+ if ((storybookDir && !mainJsTsPath) || !addedAddons) {
134
+ return projectName;
135
+ }
136
+ }
137
+ }
138
+ function transformMainJsTs(tree, mainJsTsPath) {
139
+ var _a, _b, _c, _d, _e, _f, _g;
140
+ let mainJsTs = tree.read(mainJsTsPath, 'utf-8');
141
+ const addonsArray = (_a = tsquery_1.tsquery.query(mainJsTs, 'ArrayLiteralExpression:has(Identifier[name="addons"])')) === null || _a === void 0 ? void 0 : _a[0];
142
+ if ((_b = addonsArray === null || addonsArray === void 0 ? void 0 : addonsArray.getText()) === null || _b === void 0 ? void 0 : _b.length) {
143
+ // If addons array does not contain @storybook/addon-essentials, add it
144
+ if (!addonsArray.getText().includes('@storybook/addon-essentials')) {
145
+ mainJsTs = (0, devkit_1.applyChangesToString)(mainJsTs, [
146
+ {
147
+ type: devkit_1.ChangeType.Insert,
148
+ index: addonsArray.getStart() + 1,
149
+ text: `'@storybook/addon-essentials', `,
150
+ },
151
+ ]);
152
+ tree.write(mainJsTsPath, mainJsTs);
153
+ return true;
154
+ }
155
+ return false;
156
+ }
157
+ else {
158
+ // We will add the addons array after the stories array
159
+ // If I have a stories array, that's where my addons need to go
160
+ // And there's no config without stories
161
+ const storiesArray = (_c = tsquery_1.tsquery.query(mainJsTs, 'ArrayLiteralExpression:has(Identifier[name="stories"])')) === null || _c === void 0 ? void 0 : _c[0];
162
+ if ((_d = storiesArray === null || storiesArray === void 0 ? void 0 : storiesArray.getText()) === null || _d === void 0 ? void 0 : _d.length) {
163
+ mainJsTs = (0, devkit_1.applyChangesToString)(mainJsTs, [
164
+ {
165
+ type: devkit_1.ChangeType.Insert,
166
+ index: storiesArray.getEnd(),
167
+ text: `, addons: ['@storybook/addon-essentials']`,
168
+ },
169
+ ]);
170
+ tree.write(mainJsTsPath, mainJsTs);
171
+ return true;
172
+ }
173
+ else {
174
+ /**
175
+ * main.js has potentially a different structure
176
+ * sort of like this:
177
+ * rootMain.addons.push(' ...)
178
+ * rootMain.stories.push(' ...)
179
+ * Like in older versions of Nx
180
+ */
181
+ const { rootMainVariableName, importExpression } = getRootMainVariableName(mainJsTs);
182
+ // If there is a PropertyAccessExpression with the text rootMain.addons
183
+ // then check if it has addon-essentials, if not add it
184
+ const addonsPropertyAccessExpression = (_e = tsquery_1.tsquery.query(mainJsTs, `PropertyAccessExpression:has([expression.name="${rootMainVariableName}"]):has([name="addons"])`)) === null || _e === void 0 ? void 0 : _e[0];
185
+ if (rootMainVariableName && importExpression) {
186
+ if ((addonsPropertyAccessExpression === null || addonsPropertyAccessExpression === void 0 ? void 0 : addonsPropertyAccessExpression.getText()) ===
187
+ `${rootMainVariableName}.addons.push`) {
188
+ const parentCallExpression = addonsPropertyAccessExpression.parent;
189
+ // see if parentCallExpression contains a StringLiteral with the text '@storybook/addon-essentials'
190
+ const hasAddonEssentials = !!((_g = (_f = tsquery_1.tsquery
191
+ .query(parentCallExpression, `StringLiteral:has([text="@storybook/addon-essentials"])`)) === null || _f === void 0 ? void 0 : _f[0]) === null || _g === void 0 ? void 0 : _g.getText());
192
+ if (!hasAddonEssentials) {
193
+ mainJsTs = (0, devkit_1.applyChangesToString)(mainJsTs, [
194
+ {
195
+ type: devkit_1.ChangeType.Insert,
196
+ index: addonsPropertyAccessExpression.getEnd() + 1,
197
+ text: `'@storybook/addon-essentials', `,
198
+ },
199
+ ]);
200
+ tree.write(mainJsTsPath, mainJsTs);
201
+ return true;
202
+ }
203
+ }
204
+ else {
205
+ mainJsTs = (0, devkit_1.applyChangesToString)(mainJsTs, [
206
+ {
207
+ type: devkit_1.ChangeType.Insert,
208
+ index: importExpression.getEnd() + 1,
209
+ text: `${rootMainVariableName}.addons.push('@storybook/addon-essentials');`,
210
+ },
211
+ ]);
212
+ tree.write(mainJsTsPath, mainJsTs);
213
+ return true;
214
+ }
215
+ }
216
+ }
217
+ return false;
218
+ }
219
+ }
220
+ function removeStoriesArrayFromRootIfEmpty(tree, rootMainJsTsPath) {
221
+ var _a;
222
+ if (rootMainJsTsPath) {
223
+ let rootMainJsTs = tree.read(rootMainJsTsPath, 'utf-8');
224
+ const fullStoriesNode = (_a = tsquery_1.tsquery.query(rootMainJsTs, 'PropertyAssignment:has([name="stories"])')) === null || _a === void 0 ? void 0 : _a[0];
225
+ if (!fullStoriesNode) {
226
+ return false;
227
+ }
228
+ const stringLiterals = tsquery_1.tsquery.query(fullStoriesNode, 'StringLiteral');
229
+ if ((stringLiterals === null || stringLiterals === void 0 ? void 0 : stringLiterals.length) === 0) {
230
+ rootMainJsTs = (0, devkit_1.applyChangesToString)(rootMainJsTs, [
231
+ {
232
+ type: devkit_1.ChangeType.Delete,
233
+ start: fullStoriesNode.getStart(),
234
+ length: rootMainJsTs[fullStoriesNode.getEnd()] === ','
235
+ ? fullStoriesNode.getText().length + 1
236
+ : fullStoriesNode.getText().length,
237
+ },
238
+ ]);
239
+ tree.write(rootMainJsTsPath, rootMainJsTs);
240
+ return true;
241
+ }
242
+ }
243
+ }
244
+ function getRootMainVariableName(mainJsTs) {
245
+ var _a, _b, _c, _d;
246
+ const requireVariableStatement = tsquery_1.tsquery.query(mainJsTs, `VariableStatement:has(CallExpression:has(Identifier[name="require"]))`);
247
+ let rootMainVariableName;
248
+ let importExpression;
249
+ if (requireVariableStatement.length) {
250
+ importExpression = requireVariableStatement.find((statement) => {
251
+ var _a, _b;
252
+ const requireCallExpression = tsquery_1.tsquery.query(statement, 'CallExpression:has(Identifier[name="require"])');
253
+ return (_b = (_a = requireCallExpression === null || requireCallExpression === void 0 ? void 0 : requireCallExpression[0]) === null || _a === void 0 ? void 0 : _a.getText()) === null || _b === void 0 ? void 0 : _b.includes('.storybook/main');
254
+ });
255
+ if (importExpression) {
256
+ rootMainVariableName = (_b = (_a = tsquery_1.tsquery
257
+ .query(importExpression, 'Identifier')) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.getText();
258
+ }
259
+ }
260
+ else {
261
+ const importDeclarations = tsquery_1.tsquery.query(mainJsTs, 'ImportDeclaration');
262
+ importExpression = importDeclarations.find((statement) => {
263
+ var _a, _b;
264
+ const stringLiteral = tsquery_1.tsquery.query(statement, 'StringLiteral');
265
+ return (_b = (_a = stringLiteral === null || stringLiteral === void 0 ? void 0 : stringLiteral[0]) === null || _a === void 0 ? void 0 : _a.getText()) === null || _b === void 0 ? void 0 : _b.includes('.storybook/main');
266
+ });
267
+ if (importExpression) {
268
+ rootMainVariableName = (_d = (_c = tsquery_1.tsquery
269
+ .query(importExpression, 'ImportSpecifier')) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.getText();
270
+ }
271
+ }
272
+ return {
273
+ rootMainVariableName,
274
+ importExpression,
275
+ };
276
+ }
277
+ exports.getRootMainVariableName = getRootMainVariableName;
278
+ //# sourceMappingURL=add-addon-essentials-to-all.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-addon-essentials-to-all.js","sourceRoot":"","sources":["../../../../../../packages/storybook/src/migrations/update-15-7-0/add-addon-essentials-to-all.ts"],"names":[],"mappings":";;;;AAAA,uCAMoB;AACpB,6FAA0F;AAC1F,uDAAoD;AACpD,6DAAwD;AAGxD;;;;;;;;;;;;;;;;GAgBG;AAEH,mBAA+B,IAAU;;QACvC,MAAM,sCAAsC,GAC1C,iCAAiC,CAAC,IAAI,CAAC,CAAC;QAE1C,IAAI,sCAAsC,CAAC,MAAM,EAAE;YACjD,eAAM,CAAC,IAAI,CACT;;;;YAIM,sCAAsC,CAAC,IAAI,CAAC,IAAI,CAAC;;;;WAIlD,CACN,CAAC;SACH;QAED,MAAM,gBAAgB,GAAG,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC;YACxD,CAAC,CAAC,oBAAoB;YACtB,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC;gBACnC,CAAC,CAAC,oBAAoB;gBACtB,CAAC,CAAC,SAAS,CAAC;QAEd,IAAI,gBAAgB,EAAE;YACpB,MAAM,6BAA6B,GACjC,sCAAsC,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;YACjE,MAAM,mBAAmB,GAAG,iCAAiC,CAC3D,IAAI,EACJ,gBAAgB,CACjB,CAAC;YAEF,MAAM,WAAW,GAAG,IAAA,qCAAgB,EAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;YAE7D,IAAI,WAAW,EAAE;gBACf,4DAA4D;aAC7D;iBAAM;gBACL,eAAM,CAAC,IAAI,CACT;uBAEA,6BAA6B,KAAK,QAAQ;oBACxC,CAAC,CAAC,eAAe;oBACjB,CAAC,CAAC,oCACN;QACE,mBAAmB,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,EAAE;;OAEpD,CACA,CAAC;aACH;SACF;QAED,eAAM,CAAC,IAAI,CACT;;;KAGC,CACF,CAAC;QAEF,MAAM,IAAA,oBAAW,EAA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