@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,61 @@
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 utilities_1 = require("../../utils/utilities");
6
+ function setProjectBuildConfig(tree) {
7
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
8
+ let changesMade = false;
9
+ const projects = (0, devkit_1.getProjects)(tree);
10
+ [...projects.entries()].forEach(([projectName, projectConfiguration]) => {
11
+ var _a, _b, _c;
12
+ if (!projectConfiguration.targets) {
13
+ return;
14
+ }
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
+ if (ngBuildTarget) {
21
+ if (!projectConfiguration.targets[storybookTarget].options
22
+ .projectBuildConfig) {
23
+ projectConfiguration.targets[storybookTarget].options.projectBuildConfig = projectName;
24
+ changesMade = true;
25
+ }
26
+ if (storybookBuildTarget &&
27
+ !projectConfiguration.targets[storybookBuildTarget].options
28
+ .projectBuildConfig) {
29
+ projectConfiguration.targets[storybookBuildTarget].options.projectBuildConfig = projectName;
30
+ changesMade = true;
31
+ }
32
+ }
33
+ else {
34
+ if (storybookBuildTarget) {
35
+ if (!projectConfiguration.targets[storybookTarget].options
36
+ .projectBuildConfig) {
37
+ projectConfiguration.targets[storybookTarget].options.projectBuildConfig = `${projectName}:${storybookBuildTarget}`;
38
+ changesMade = true;
39
+ }
40
+ if (!projectConfiguration.targets[storybookBuildTarget].options
41
+ .projectBuildConfig) {
42
+ projectConfiguration.targets[storybookBuildTarget].options.projectBuildConfig = `${projectName}:${storybookBuildTarget}`;
43
+ changesMade = true;
44
+ }
45
+ }
46
+ else {
47
+ devkit_1.logger.warn(`Could not find a build target for ${projectName}.`);
48
+ }
49
+ }
50
+ if (changesMade) {
51
+ (0, devkit_1.updateProjectConfiguration)(tree, projectName, projectConfiguration);
52
+ }
53
+ }
54
+ });
55
+ if (changesMade) {
56
+ yield (0, devkit_1.formatFiles)(tree);
57
+ }
58
+ });
59
+ }
60
+ exports.default = setProjectBuildConfig;
61
+ //# sourceMappingURL=set-project-build-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"set-project-build-config.js","sourceRoot":"","sources":["../../../../../../packages/storybook/src/migrations/update-13-4-6/set-project-build-config.ts"],"names":[],"mappings":";;;AAAA,uCAMoB;AACpB,qDAAgF;AAEhF,SAA8B,qBAAqB,CAAC,IAAU;;QAC5D,IAAI,WAAW,GAAG,KAAK,CAAC;QACxB,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,IAAI,CAAC,oBAAoB,CAAC,OAAO,EAAE;gBACjC,OAAO;aACR;YACD,MAAM,EAAE,oBAAoB,EAAE,eAAe,EAAE,aAAa,EAAE,GAC5D,IAAA,mDAAuC,EAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;YACxE,IACE,WAAW;gBACX,eAAe;gBACf,CAAA,MAAA,MAAA,MAAA,oBAAoB,aAApB,oBAAoB,uBAApB,oBAAoB,CAAE,OAAO,0CAAG,eAAe,CAAC,0CAAE,OAAO,0CAAE,WAAW;oBACpE,oBAAoB,EACtB;gBACA,IAAI,aAAa,EAAE;oBACjB,IACE,CAAC,oBAAoB,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,OAAO;yBACnD,kBAAkB,EACrB;wBACA,oBAAoB,CAAC,OAAO,CAC1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ratorCallback, Tree } from '@nx/devkit';
2
+ import { StorybookConfigureSchema } from '../../../generators/configuration/schema';
3
+ export declare function migrateDefaultsGenerator(tree: Tree): GeneratorCallback;
4
+ export declare function migrateAllStorybookInstances(tree: Tree): void;
5
+ export declare function migrateStorybookInstance(tree: Tree, projectName: string, uiFramework: StorybookConfigureSchema['uiFramework'], configFolder?: string): void;
6
+ export declare function moveDirectory(tree: Tree, from: string, to: string): void;
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.moveDirectory = exports.migrateStorybookInstance = exports.migrateAllStorybookInstances = exports.migrateDefaultsGenerator = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const semver_1 = require("semver");
6
+ const semver_2 = require("@nx/devkit/src/utils/semver");
7
+ const versions_1 = require("../../../utils/versions");
8
+ const util_functions_1 = require("../../../generators/configuration/lib/util-functions");
9
+ const utilities_1 = require("../../../utils/utilities");
10
+ function migrateDefaultsGenerator(tree) {
11
+ migrateAllStorybookInstances(tree);
12
+ return upgradeStorybookPackagesInPackageJson(tree);
13
+ }
14
+ exports.migrateDefaultsGenerator = migrateDefaultsGenerator;
15
+ function migrateAllStorybookInstances(tree) {
16
+ devkit_1.logger.debug('adding .storybook folder to project');
17
+ const projects = (0, devkit_1.getProjects)(tree);
18
+ const projectsThatHaveStorybookConfiguration = [...projects.entries()]
19
+ .filter(([_, projectConfig]) => {
20
+ var _a, _b, _c;
21
+ return ((_a = projectConfig === null || projectConfig === void 0 ? void 0 : projectConfig.targets) === null || _a === void 0 ? void 0 : _a.storybook) &&
22
+ ((_c = (_b = projectConfig === null || projectConfig === void 0 ? void 0 : projectConfig.targets) === null || _b === void 0 ? void 0 : _b.storybook) === null || _c === void 0 ? void 0 : _c.executor) !==
23
+ '@nrwl/react-native:storybook';
24
+ })
25
+ .map(([projectName, projectConfig]) => {
26
+ var _a, _b, _c, _d, _e, _f, _g, _h;
27
+ return {
28
+ name: projectName,
29
+ uiFramework: (_c = (_b = (_a = projectConfig === null || projectConfig === void 0 ? void 0 : projectConfig.targets) === null || _a === void 0 ? void 0 : _a.storybook) === null || _b === void 0 ? void 0 : _b.options) === null || _c === void 0 ? void 0 : _c.uiFramework,
30
+ configFolder: (_h = (_g = (_f = (_e = (_d = projectConfig === null || projectConfig === void 0 ? void 0 : projectConfig.targets) === null || _d === void 0 ? void 0 : _d.storybook) === null || _e === void 0 ? void 0 : _e.options) === null || _f === void 0 ? void 0 : _f.config) === null || _g === void 0 ? void 0 : _g.configFolder) !== null && _h !== void 0 ? _h : '',
31
+ };
32
+ });
33
+ for (const projectWithStorybook of projectsThatHaveStorybookConfiguration) {
34
+ migrateStorybookInstance(tree, projectWithStorybook.name, projectWithStorybook.uiFramework, projectWithStorybook.configFolder);
35
+ }
36
+ }
37
+ exports.migrateAllStorybookInstances = migrateAllStorybookInstances;
38
+ function migrateStorybookInstance(tree, projectName, uiFramework, configFolder) {
39
+ migrateProjectLevelStorybookInstance(tree, projectName, uiFramework, configFolder);
40
+ }
41
+ exports.migrateStorybookInstance = migrateStorybookInstance;
42
+ function maybeUpdateVersion(tree) {
43
+ let needsInstall = false;
44
+ (0, devkit_1.updateJson)(tree, 'package.json', (json) => {
45
+ const ignoredStorybookPackages = [
46
+ '@storybook/builder-vite',
47
+ '@storybook/jest',
48
+ '@storybook/react-native',
49
+ '@storybook/storybook-deployer',
50
+ '@storybook/test-runner',
51
+ '@storybook/testing-library',
52
+ '@storybook/testing-angular',
53
+ '@storybook/testing-react',
54
+ '@storybook/testing-vue',
55
+ '@storybook/testing-vue3',
56
+ '@storybook/addon-notes',
57
+ '@storybook/addon-postcss',
58
+ ];
59
+ json.dependencies = json.dependencies || {};
60
+ json.devDependencies = json.devDependencies || {};
61
+ const allStorybookPackagesInDependencies = Object.keys(json.dependencies).filter((packageName) => packageName.startsWith('@storybook/') &&
62
+ !ignoredStorybookPackages.includes(packageName));
63
+ const allStorybookPackagesInDevDependencies = Object.keys(json.devDependencies).filter((packageName) => packageName.startsWith('@storybook/') &&
64
+ !ignoredStorybookPackages.includes(packageName));
65
+ const storybookPackages = [
66
+ ...allStorybookPackagesInDependencies,
67
+ ...allStorybookPackagesInDevDependencies,
68
+ ];
69
+ storybookPackages.forEach((storybookPackageName) => {
70
+ if (json.dependencies[storybookPackageName]) {
71
+ const version = (0, semver_2.checkAndCleanWithSemver)(storybookPackageName, json.dependencies[storybookPackageName]);
72
+ if ((0, semver_1.lte)(version, '6.0.0')) {
73
+ json.dependencies[storybookPackageName] = versions_1.storybookVersion;
74
+ needsInstall = true;
75
+ }
76
+ }
77
+ if (json.devDependencies[storybookPackageName]) {
78
+ const version = (0, semver_2.checkAndCleanWithSemver)(storybookPackageName, json.devDependencies[storybookPackageName]);
79
+ if ((0, semver_1.lte)(version, '6.0.0')) {
80
+ json.devDependencies[storybookPackageName] = versions_1.storybookVersion;
81
+ needsInstall = true;
82
+ }
83
+ }
84
+ });
85
+ return json;
86
+ });
87
+ if (needsInstall) {
88
+ return () => (0, devkit_1.installPackagesTask)(tree);
89
+ }
90
+ }
91
+ function upgradeStorybookPackagesInPackageJson(tree) {
92
+ /**
93
+ * Should upgrade all @storybook/* packages in package.json
94
+ */
95
+ return maybeUpdateVersion(tree);
96
+ }
97
+ function moveOldFiles(tree, configFolderDir) {
98
+ moveDirectory(tree, configFolderDir, configFolderDir.replace('.storybook', '.old_storybook'));
99
+ }
100
+ function migrateProjectLevelStorybookInstance(tree, projectName, uiFramework, configFolder) {
101
+ const old_folder_exists_already = tree.exists(configFolder === null || configFolder === void 0 ? void 0 : configFolder.replace('.storybook', '.old_storybook'));
102
+ const new_config_exists_already = tree.exists(`${configFolder}/main.js`);
103
+ if (old_folder_exists_already || new_config_exists_already) {
104
+ return;
105
+ }
106
+ moveOldFiles(tree, configFolder);
107
+ if (tree.exists(configFolder)) {
108
+ return;
109
+ }
110
+ const { projectType, targets, root } = (0, devkit_1.readProjectConfiguration)(tree, projectName);
111
+ const { nextBuildTarget, compiler } = (0, utilities_1.findStorybookAndBuildTargetsAndCompiler)(targets);
112
+ (0, util_functions_1.createProjectStorybookDir)(tree, projectName, uiFramework, false, false, root, projectType, false, !!nextBuildTarget, compiler === 'swc');
113
+ }
114
+ function moveDirectory(tree, from, to) {
115
+ (0, devkit_1.visitNotIgnoredFiles)(tree, from, (file) => {
116
+ tree.rename(file, file.replace(from, to));
117
+ });
118
+ }
119
+ exports.moveDirectory = moveDirectory;
120
+ //# sourceMappingURL=migrate-defaults-5-to-6.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrate-defaults-5-to-6.js","sourceRoot":"","sources":["../../../../../../../packages/storybook/src/migrations/update-14-0-0/migrate-defaults-5-to-6/migrate-defaults-5-to-6.ts"],"names":[],"mappings":";;;AAAA,uCASoB;AACpB,mCAA6B;AAC7B,wDAAsE;AACtE,sDAA2D;AAC3D,yFAAiG;AAEjG,wDAAmF;AAEnF,SAAgB,wBAAwB,CAAC,IAAU;IACjD,4BAA4B,CAAC,IAAI,CAAC,CAAC;IACnC,OAAO,qCAAqC,CAAC,IAAI,CAAC,CAAC;AACrD,CAAC;AAHD,4DAGC;AAED,SAAgB,4BAA4B,CAAC,IAAU;IACrD,eAAM,CAAC,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACpD,MAAM,QAAQ,GAAG,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IACnC,MAAM,sCAAsC,GAItC,CAAC,GAAG,QAAQ,CAAC,OAAO,EAAE,CAAC;SAC1B,MAAM,CACL,CAAC,CAAC,CAAC,EAAE,aAAa,CAAC,EAAE,EAAE;;QACrB,OAAA,CAAA,MAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,OAAO,0CAAE,SAAS;YACjC,CAAA,MAAA,MAAA,aAAa,aAAb,aAAa,uBAAb,aAAa,CAAE,OAAO,0CAAE,SAAS,0CAAE,QAAQ;gBACzC,8BAA8B,CAAA;KAAA,CACnC;SACA,GAAG,CAAC,CAAC,CAAC,WAAW,E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WAAW,EACX,KAAK,EACL,CAAC,CAAC,eAAe,EACjB,QAAQ,KAAK,KAAK,CACnB,CAAC;AACJ,CAAC;AAED,SAAgB,aAAa,CAAC,IAAU,EAAE,IAAY,EAAE,EAAU;IAChE,IAAA,6BAAoB,EAAC,IAAI,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE;QACxC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;AACL,CAAC;AAJD,sCAIC"}
@@ -0,0 +1,8 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export declare function migrateStoriesTo62Generator(tree: Tree): Promise<void>;
3
+ export declare function findAllAngularProjectsWithStorybookConfiguration(tree: Tree): {
4
+ name: string;
5
+ configFolder: string;
6
+ projectRoot: string;
7
+ projectSrc: string;
8
+ }[];
@@ -0,0 +1,294 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findAllAngularProjectsWithStorybookConfiguration = exports.migrateStoriesTo62Generator = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const devkit_1 = require("@nx/devkit");
6
+ const fileutils_1 = require("@nx/workspace/src/utilities/fileutils");
7
+ const typescript_1 = require("nx/src/utils/typescript");
8
+ const path_1 = require("path");
9
+ const typescript_2 = require("typescript");
10
+ const utilities_1 = require("../../../utils/utilities");
11
+ const ts = require("typescript");
12
+ function migrateStoriesTo62Generator(tree) {
13
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
14
+ let allComponentsWithStories = [];
15
+ const result = findAllAngularProjectsWithStorybookConfiguration(tree);
16
+ result === null || result === void 0 ? void 0 : result.forEach((angularProjectWithStorybook) => {
17
+ const componentResult = findAllComponentsWithStoriesForSpecificProject(tree, angularProjectWithStorybook.projectRoot);
18
+ allComponentsWithStories = [
19
+ ...allComponentsWithStories,
20
+ ...componentResult,
21
+ ];
22
+ });
23
+ allComponentsWithStories === null || allComponentsWithStories === void 0 ? void 0 : allComponentsWithStories.forEach((componentInfo) => {
24
+ changeSyntaxOfStory(tree, componentInfo.componentStoryPath);
25
+ });
26
+ yield (0, devkit_1.formatFiles)(tree);
27
+ });
28
+ }
29
+ exports.migrateStoriesTo62Generator = migrateStoriesTo62Generator;
30
+ function findAllAngularProjectsWithStorybookConfiguration(tree) {
31
+ var _a, _b;
32
+ const projects = (0, devkit_1.getProjects)(tree);
33
+ const projectsThatHaveStorybookConfiguration = (_b = (_a = [...projects.entries()]) === null || _a === void 0 ? void 0 : _a.filter(([_, projectConfig]) => {
34
+ var _a, _b, _c;
35
+ return ((_c = (_b = (_a = projectConfig === null || projectConfig === void 0 ? void 0 : projectConfig.targets) === null || _a === void 0 ? void 0 : _a.storybook) === null || _b === void 0 ? void 0 : _b.options) === null || _c === void 0 ? void 0 : _c.uiFramework) ===
36
+ '@storybook/angular';
37
+ })) === null || _b === void 0 ? void 0 : _b.map(([projectName, projectConfig]) => {
38
+ var _a, _b, _c;
39
+ return {
40
+ name: projectName,
41
+ configFolder: (_c = (_b = (_a = projectConfig.targets.storybook) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.config) === null || _c === void 0 ? void 0 : _c.configFolder,
42
+ projectRoot: projectConfig.root,
43
+ projectSrc: projectConfig.sourceRoot,
44
+ };
45
+ });
46
+ return projectsThatHaveStorybookConfiguration;
47
+ }
48
+ exports.findAllAngularProjectsWithStorybookConfiguration = findAllAngularProjectsWithStorybookConfiguration;
49
+ function findAllComponentsWithStoriesForSpecificProject(tree, projectPath) {
50
+ let moduleFilePaths = [];
51
+ (0, devkit_1.visitNotIgnoredFiles)(tree, projectPath, (filePath) => {
52
+ if (filePath === null || filePath === void 0 ? void 0 : filePath.endsWith('.module.ts')) {
53
+ moduleFilePaths.push(filePath);
54
+ }
55
+ });
56
+ let componentFileInfos = [];
57
+ moduleFilePaths === null || moduleFilePaths === void 0 ? void 0 : moduleFilePaths.map((moduleFilePath) => {
58
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
59
+ const file = (0, utilities_1.getTsSourceFile)(tree, moduleFilePath);
60
+ const ngModuleDecorators = (0, typescript_1.findNodes)(file, ts.SyntaxKind.Decorator);
61
+ if (ngModuleDecorators.length === 0) {
62
+ return;
63
+ }
64
+ const ngModuleDecorator = ngModuleDecorators[0];
65
+ const ngModuleNode = (_a = ngModuleDecorator === null || ngModuleDecorator === void 0 ? void 0 : ngModuleDecorator.getChildren()) === null || _a === void 0 ? void 0 : _a.find((node) => {
66
+ var _a;
67
+ return (_a = node === null || node === void 0 ? void 0 : node.getText()) === null || _a === void 0 ? void 0 : _a.startsWith('NgModule');
68
+ });
69
+ const ngModulePropertiesObject = (_b = ngModuleNode === null || ngModuleNode === void 0 ? void 0 : ngModuleNode.getChildren()) === null || _b === void 0 ? void 0 : _b.find((node) => {
70
+ return node.kind === typescript_2.SyntaxKind.SyntaxList;
71
+ });
72
+ const ngModuleProperties = (_d = (_c = ngModulePropertiesObject === null || ngModulePropertiesObject === void 0 ? void 0 : ngModulePropertiesObject.getChildren()[0]) === null || _c === void 0 ? void 0 : _c.getChildren()) === null || _d === void 0 ? void 0 : _d.find((node) => {
73
+ var _a;
74
+ return (_a = node === null || node === void 0 ? void 0 : node.getText()) === null || _a === void 0 ? void 0 : _a.includes('declarations');
75
+ });
76
+ const declarationsPropertyAssignment = (_e = ngModuleProperties === null || ngModuleProperties === void 0 ? void 0 : ngModuleProperties.getChildren()) === null || _e === void 0 ? void 0 : _e.find((node) => {
77
+ var _a;
78
+ return (_a = node === null || node === void 0 ? void 0 : node.getText()) === null || _a === void 0 ? void 0 : _a.startsWith('declarations');
79
+ });
80
+ if (!declarationsPropertyAssignment) {
81
+ devkit_1.logger.warn((0, devkit_1.stripIndents) `No components declared in ${moduleFilePath}.`);
82
+ }
83
+ let declarationArray = (_f = declarationsPropertyAssignment === null || declarationsPropertyAssignment === void 0 ? void 0 : declarationsPropertyAssignment.getChildren()) === null || _f === void 0 ? void 0 : _f.find((node) => node.kind === typescript_2.SyntaxKind.ArrayLiteralExpression);
84
+ if (!declarationArray) {
85
+ // Attempt to follow a variable instead of the literal
86
+ const declarationVariable = (_g = declarationsPropertyAssignment === null || declarationsPropertyAssignment === void 0 ? void 0 : declarationsPropertyAssignment.getChildren()) === null || _g === void 0 ? void 0 : _g.filter((node) => node.kind === typescript_2.SyntaxKind.Identifier)[1];
87
+ const variableName = declarationVariable === null || declarationVariable === void 0 ? void 0 : declarationVariable.getText();
88
+ const variableDeclaration = (_h = (0, typescript_1.findNodes)(file, typescript_2.SyntaxKind.VariableDeclaration)) === null || _h === void 0 ? void 0 : _h.find((variableDeclaration) => {
89
+ var _a;
90
+ const identifier = (_a = variableDeclaration === null || variableDeclaration === void 0 ? void 0 : variableDeclaration.getChildren()) === null || _a === void 0 ? void 0 : _a.find((node) => node.kind === typescript_2.SyntaxKind.Identifier);
91
+ return (identifier === null || identifier === void 0 ? void 0 : identifier.getText()) === variableName;
92
+ });
93
+ if (variableDeclaration) {
94
+ declarationArray = (_j = variableDeclaration === null || variableDeclaration === void 0 ? void 0 : variableDeclaration.getChildren()) === null || _j === void 0 ? void 0 : _j.find((node) => node.kind === typescript_2.SyntaxKind.ArrayLiteralExpression);
95
+ }
96
+ }
97
+ const declaredComponents = (_p = (_o = (_m = (_l = (_k = declarationArray === null || declarationArray === void 0 ? void 0 : declarationArray.getChildren()) === null || _k === void 0 ? void 0 : _k.find((node) => node.kind === typescript_2.SyntaxKind.SyntaxList)) === null || _l === void 0 ? void 0 : _l.getChildren()) === null || _m === void 0 ? void 0 : _m.filter((node) => node.kind === typescript_2.SyntaxKind.Identifier)) === null || _o === void 0 ? void 0 : _o.map((node) => node === null || node === void 0 ? void 0 : node.getText())) === null || _p === void 0 ? void 0 : _p.filter((name) => name === null || name === void 0 ? void 0 : name.endsWith('Component'));
98
+ const imports = (_q = file.statements) === null || _q === void 0 ? void 0 : _q.filter((statement) => statement.kind === typescript_2.SyntaxKind.ImportDeclaration);
99
+ const modulePath = moduleFilePath.slice(0, moduleFilePath === null || moduleFilePath === void 0 ? void 0 : moduleFilePath.lastIndexOf('/'));
100
+ let componentInfo = declaredComponents === null || declaredComponents === void 0 ? void 0 : declaredComponents.map((componentName) => {
101
+ var _a, _b, _c;
102
+ try {
103
+ const importStatement = imports === null || imports === void 0 ? void 0 : imports.find((statement) => {
104
+ var _a, _b, _c, _d, _e, _f, _g;
105
+ const namedImports = (_c = (_b = (_a = statement === null || statement === void 0 ? void 0 : statement.getChildren()) === null || _a === void 0 ? void 0 : _a.find((node) => node.kind === typescript_2.SyntaxKind.ImportClause)) === null || _b === void 0 ? void 0 : _b.getChildren()) === null || _c === void 0 ? void 0 : _c.find((node) => node.kind === typescript_2.SyntaxKind.NamedImports);
106
+ if (namedImports === undefined)
107
+ return false;
108
+ const importedIdentifiers = (_g = (_f = (_e = (_d = namedImports === null || namedImports === void 0 ? void 0 : namedImports.getChildren()) === null || _d === void 0 ? void 0 : _d.find((node) => node.kind === typescript_2.SyntaxKind.SyntaxList)) === null || _e === void 0 ? void 0 : _e.getChildren()) === null || _f === void 0 ? void 0 : _f.filter((node) => node.kind === typescript_2.SyntaxKind.ImportSpecifier)) === null || _g === void 0 ? void 0 : _g.map((node) => node === null || node === void 0 ? void 0 : node.getText());
109
+ return importedIdentifiers === null || importedIdentifiers === void 0 ? void 0 : importedIdentifiers.includes(componentName);
110
+ });
111
+ const fullPath = (_c = (_b = (_a = importStatement === null || importStatement === void 0 ? void 0 : importStatement.getChildren()) === null || _a === void 0 ? void 0 : _a.find((node) => node.kind === typescript_2.SyntaxKind.StringLiteral)) === null || _b === void 0 ? void 0 : _b.getText()) === null || _c === void 0 ? void 0 : _c.slice(1, -1);
112
+ // if it is a directory, search recursively for the component
113
+ let fullCmpImportPath = moduleFilePath === null || moduleFilePath === void 0 ? void 0 : moduleFilePath.slice(0, moduleFilePath === null || moduleFilePath === void 0 ? void 0 : moduleFilePath.lastIndexOf('/'));
114
+ if (fullCmpImportPath === null || fullCmpImportPath === void 0 ? void 0 : fullCmpImportPath.startsWith('/')) {
115
+ fullCmpImportPath = fullCmpImportPath === null || fullCmpImportPath === void 0 ? void 0 : fullCmpImportPath.slice(1, fullCmpImportPath.length);
116
+ }
117
+ let componentImportPath = (0, path_1.join)((0, path_1.normalize)(fullCmpImportPath), fullPath);
118
+ let path = null;
119
+ let componentFileName = null;
120
+ let componentStoryPath = null;
121
+ let storyExists = false;
122
+ let componentExists = false;
123
+ /**
124
+ * Here we want to remove the <component-name>.component
125
+ * part of the path, to just keep the
126
+ * apps/<project-name>/src/app/<component-name>
127
+ * or
128
+ * libs/<project-name>/src/lib/<component-name>
129
+ * part of the path
130
+ */
131
+ componentImportPath = componentImportPath.slice(0, componentImportPath.lastIndexOf('/'));
132
+ (0, devkit_1.visitNotIgnoredFiles)(tree, componentImportPath, (componentFilePath) => {
133
+ if (componentFilePath === null || componentFilePath === void 0 ? void 0 : componentFilePath.endsWith('.ts')) {
134
+ const content = tree.read(componentFilePath).toString('utf-8');
135
+ if ((content === null || content === void 0 ? void 0 : content.indexOf(`class ${componentName}`)) > -1) {
136
+ componentExists = true;
137
+ path = componentFilePath;
138
+ componentFileName =
139
+ (componentFilePath === null || componentFilePath === void 0 ? void 0 : componentFilePath.slice((componentFilePath === null || componentFilePath === void 0 ? void 0 : componentFilePath.lastIndexOf('/')) + 1, componentFilePath === null || componentFilePath === void 0 ? void 0 : componentFilePath.lastIndexOf('.'))) + '.ts';
140
+ }
141
+ if (componentFilePath === null || componentFilePath === void 0 ? void 0 : componentFilePath.endsWith('.stories.ts')) {
142
+ componentStoryPath = componentFilePath;
143
+ storyExists = true;
144
+ }
145
+ }
146
+ });
147
+ if (!storyExists || !componentExists) {
148
+ path = null;
149
+ componentFileName = null;
150
+ componentStoryPath = null;
151
+ }
152
+ if (path !== null) {
153
+ return {
154
+ componentName: componentName,
155
+ componentPath: path,
156
+ componentFileName,
157
+ componentStoryPath: componentStoryPath,
158
+ };
159
+ }
160
+ else {
161
+ const path = fullPath === null || fullPath === void 0 ? void 0 : fullPath.slice(0, fullPath === null || fullPath === void 0 ? void 0 : fullPath.lastIndexOf('/'));
162
+ const componentFileName = (fullPath === null || fullPath === void 0 ? void 0 : fullPath.slice((fullPath === null || fullPath === void 0 ? void 0 : fullPath.lastIndexOf('/')) + 1)) + '.ts';
163
+ componentStoryPath = fullPath + '.stories.ts';
164
+ if ((0, fileutils_1.fileExists)(componentStoryPath)) {
165
+ return {
166
+ componentName: componentName,
167
+ componentPath: path + componentFileName,
168
+ componentFileName,
169
+ componentStoryPath: componentStoryPath,
170
+ };
171
+ }
172
+ else {
173
+ return undefined;
174
+ }
175
+ }
176
+ }
177
+ catch (e) {
178
+ devkit_1.logger.warn(`Could not find file for ${componentName}. Error: ${e}`);
179
+ return undefined;
180
+ }
181
+ });
182
+ if (componentInfo) {
183
+ componentInfo = componentInfo === null || componentInfo === void 0 ? void 0 : componentInfo.filter((info) => info !== undefined);
184
+ componentFileInfos = [...componentFileInfos, ...componentInfo];
185
+ }
186
+ });
187
+ return componentFileInfos;
188
+ }
189
+ function changeSyntaxOfStory(tree, storyFilePath) {
190
+ var _a, _b, _c;
191
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
192
+ const file = (0, utilities_1.getTsSourceFile)(tree, storyFilePath);
193
+ const appFileContent = tree.read(storyFilePath, 'utf-8');
194
+ let newContents = appFileContent;
195
+ const storiesVariableDeclaration = (0, typescript_1.findNodes)(file, [
196
+ ts.SyntaxKind.VariableDeclaration,
197
+ ]);
198
+ const storiesExportDefault = (0, typescript_1.findNodes)(file, [
199
+ ts.SyntaxKind.ExportAssignment,
200
+ ]);
201
+ const defaultExportNode = storiesExportDefault[0];
202
+ const defaultExportObject = (_a = defaultExportNode === null || defaultExportNode === void 0 ? void 0 : defaultExportNode.getChildren()) === null || _a === void 0 ? void 0 : _a.find((node) => {
203
+ return node.kind === typescript_2.SyntaxKind.ObjectLiteralExpression;
204
+ });
205
+ const defaultPropertiesList = (_b = defaultExportObject === null || defaultExportObject === void 0 ? void 0 : defaultExportObject.getChildren()) === null || _b === void 0 ? void 0 : _b.find((node) => {
206
+ return node.kind === typescript_2.SyntaxKind.SyntaxList;
207
+ });
208
+ const hasTitle = (_c = defaultPropertiesList === null || defaultPropertiesList === void 0 ? void 0 : defaultPropertiesList.getChildren()) === null || _c === void 0 ? void 0 : _c.find((node) => {
209
+ return (node.kind === typescript_2.SyntaxKind.PropertyAssignment &&
210
+ node.getText().startsWith('title'));
211
+ });
212
+ /**
213
+ * A component node will look like this:
214
+ *
215
+ * component: MyTestComponent
216
+ *
217
+ * And this is what we need to remove.
218
+ */
219
+ let firstComponentNode;
220
+ /**
221
+ * The result of ts.Node.getStart() will give us the index
222
+ * of that node in the whole original file.
223
+ * While we're editing that file, the getStart() will
224
+ * still reference the original file. So, during deletion,
225
+ * it would go and delete characters using the original index.
226
+ *
227
+ * We need to save the length of the characters that have been removed
228
+ * so far, so that we can substract it from the index.
229
+ * Since it's parsing the file linearly and in order, then this
230
+ * logic works.
231
+ * */
232
+ let lengthOfRemovalsSoFar = 0;
233
+ storiesVariableDeclaration === null || storiesVariableDeclaration === void 0 ? void 0 : storiesVariableDeclaration.forEach((oneStory) => {
234
+ var _a, _b, _c, _d, _e, _f;
235
+ const oneExportedStoryArrowFunction = (_a = oneStory === null || oneStory === void 0 ? void 0 : oneStory.getChildren()) === null || _a === void 0 ? void 0 : _a.find((node) => {
236
+ return node.kind === typescript_2.SyntaxKind.ArrowFunction;
237
+ });
238
+ const inParenthesis = (_b = oneExportedStoryArrowFunction === null || oneExportedStoryArrowFunction === void 0 ? void 0 : oneExportedStoryArrowFunction.getChildren()) === null || _b === void 0 ? void 0 : _b.find((node) => {
239
+ return node.kind === typescript_2.SyntaxKind.ParenthesizedExpression;
240
+ });
241
+ const objectLiteralOfStory = (_c = inParenthesis === null || inParenthesis === void 0 ? void 0 : inParenthesis.getChildren()) === null || _c === void 0 ? void 0 : _c.find((node) => {
242
+ return node.kind === typescript_2.SyntaxKind.ObjectLiteralExpression;
243
+ });
244
+ const propertiesList = (_d = objectLiteralOfStory === null || objectLiteralOfStory === void 0 ? void 0 : objectLiteralOfStory.getChildren()) === null || _d === void 0 ? void 0 : _d.find((node) => {
245
+ return node.kind === typescript_2.SyntaxKind.SyntaxList;
246
+ });
247
+ const hasComponentDeclared = (_e = propertiesList === null || propertiesList === void 0 ? void 0 : propertiesList.getChildren()) === null || _e === void 0 ? void 0 : _e.find((node) => {
248
+ return (node.kind === typescript_2.SyntaxKind.PropertyAssignment &&
249
+ node.getText().startsWith('component'));
250
+ });
251
+ if (hasComponentDeclared) {
252
+ /**
253
+ * Here I am saving the first component to appear
254
+ * in the case where we have multiple stories
255
+ */
256
+ if (!firstComponentNode) {
257
+ firstComponentNode = hasComponentDeclared;
258
+ }
259
+ /**
260
+ * Here we are performing the following check:
261
+ * If the component we will be adding in the default declaration
262
+ * which is the first component that we find
263
+ * is the same for this story as well,
264
+ * then remove it.
265
+ */
266
+ if (hasComponentDeclared.getText() === firstComponentNode.getText()) {
267
+ const indexOfPropertyName = hasComponentDeclared.getStart();
268
+ const lengthOfRemoval = ((_f = hasComponentDeclared === null || hasComponentDeclared === void 0 ? void 0 : hasComponentDeclared.getText()) === null || _f === void 0 ? void 0 : _f.length) + 1;
269
+ newContents = (0, devkit_1.applyChangesToString)(newContents, [
270
+ {
271
+ type: devkit_1.ChangeType.Delete,
272
+ start: indexOfPropertyName - lengthOfRemovalsSoFar,
273
+ length: lengthOfRemoval,
274
+ },
275
+ ]);
276
+ lengthOfRemovalsSoFar = lengthOfRemovalsSoFar + lengthOfRemoval;
277
+ }
278
+ }
279
+ });
280
+ if (hasTitle && firstComponentNode) {
281
+ const indexOfPropertyName = hasTitle.getEnd();
282
+ newContents = (0, devkit_1.applyChangesToString)(newContents, [
283
+ {
284
+ type: devkit_1.ChangeType.Insert,
285
+ index: indexOfPropertyName + 2,
286
+ text: firstComponentNode.getText() + ',',
287
+ },
288
+ ]);
289
+ tree.write(storyFilePath, newContents);
290
+ }
291
+ yield (0, devkit_1.formatFiles)(tree);
292
+ });
293
+ }
294
+ //# sourceMappingURL=migrate-stories-to-6-2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrate-stories-to-6-2.js","sourceRoot":"","sources":["../../../../../../../packages/storybook/src/migrations/update-14-0-0/migrate-stories-to-6-2/migrate-stories-to-6-2.ts"],"names":[],"mappings":";;;;AAAA,uCASoB;AACpB,qEAAmE;AACnE,wDAAoD;AACpD,+BAAuC;AACvC,2CAAwC;AACxC,wDAA2D;AAC3D,iCAAkC;AAElC,SAAsB,2BAA2B,CAAC,IAAU;;QAC1D,IAAI,wBAAwB,GAKtB,EAAE,CAAC;QACT,MAAM,MAAM,GAKN,gDAAgD,CAAC,IAAI,CAAC,CAAC;QAC7D,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,OAAO,CACb,CAAC,2BAKA,EAAE,EAAE;YACH,MAAM,eAAe,GAAG,8CAA8C,CACpE,IAAI,EACJ,2BAA2B,CAAC,WAAW,CACxC,CAAC;YACF,wBAAwB,GAAG;gBACzB,GAAG,wBAAwB;gBAC3B,GAAG,eAAe;aACnB,CAAC;QACJ,CAAC,CACF,CAAC;QACF,wBAAwB,aAAxB,wBAAwB,uBAAxB,wBAAwB,CAAE,OAAO,CAAC,CAAC,aAAa,EAAE,EAAE;YAClD,mBAAmB,CAAC,IAAI,EAAE,aAAa,CAAC,kBAAkB,CAAC,CAAC;QAC9D,CAAC,CAAC,CAAC;QACH,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CAAA;AAlCD,kEAkCC;AAED,SAAgB,gDAAgD,CAAC,IAAU;;IAMzE,MAAM,QAAQ,GAAG,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IACnC,MAAM,sCAAsC,GAKtC,MAAA,MAAA,CAAC,GAAG,QAAQ,CAAC,OAAO,EAAE,C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AM,EAAE,eAAe;yBACxB;qBACF,CAAC,CAAC;oBACH,qBAAqB,GAAG,qBAAqB,GAAG,eAAe,CAAC;iBACjE;aACF;QACH,CAAC,CAAC,CAAC;QAEH,IAAI,QAAQ,IAAI,kBAAkB,EAAE;YAClC,MAAM,mBAAmB,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC;YAC9C,WAAW,GAAG,IAAA,6BAAoB,EAAC,WAAW,EAAE;gBAC9C;oBACE,IAAI,EAAE,mBAAU,CAAC,MAAM;oBACvB,KAAK,EAAE,mBAAmB,GAAG,CAAC;oBAC9B,IAAI,EAAE,kBAAkB,CAAC,OAAO,EAAE,GAAG,GAAG;iBACzC;aACF,CAAC,CAAC;YACH,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;SACxC;QAED,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;;CACzB"}
@@ -0,0 +1,2 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export default function migrateToStorybook6(tree: Tree): Promise<import("@nx/devkit").GeneratorCallback>;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ const migrate_defaults_5_to_6_1 = require("./migrate-defaults-5-to-6/migrate-defaults-5-to-6");
5
+ const migrate_stories_to_6_2_1 = require("./migrate-stories-to-6-2/migrate-stories-to-6-2");
6
+ function migrateToStorybook6(tree) {
7
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
8
+ (0, migrate_stories_to_6_2_1.migrateStoriesTo62Generator)(tree);
9
+ return (0, migrate_defaults_5_to_6_1.migrateDefaultsGenerator)(tree);
10
+ });
11
+ }
12
+ exports.default = migrateToStorybook6;
13
+ //# sourceMappingURL=migrate-to-storybook-6.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrate-to-storybook-6.js","sourceRoot":"","sources":["../../../../../../packages/storybook/src/migrations/update-14-0-0/migrate-to-storybook-6.ts"],"names":[],"mappings":";;;AACA,+FAA6F;AAC7F,4FAA8F;AAE9F,SAA8B,mBAAmB,CAAC,IAAU;;QAC1D,IAAA,oDAA2B,EAAC,IAAI,CAAC,CAAC;QAClC,OAAO,IAAA,kDAAwB,EAAC,IAAI,CAAC,CAAC;IACxC,CAAC;CAAA;AAHD,sCAGC"}
@@ -0,0 +1,4 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export declare function changeStorybookTargetsGenerator(tree: Tree): Promise<void>;
3
+ export default changeStorybookTargetsGenerator;
4
+ export declare const changeStorybookTargetsSchematic: (generatorOptions: any) => (tree: any, context: any) => Promise<any>;