@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,449 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.logResult = exports.afterMigration = exports.checkWebComponentsInstalled = exports.checkStorybookInstalled = exports.handleMigrationResult = exports.prepareFiles = exports.getAllStorybookInfo = exports.changeCoreCommonImportToFramework = exports.removeUiFrameworkFromProjectJson = exports.removeTypecastFromMainTs = exports.normalizeViteConfigFilePathWithTree = exports.addViteConfigFilePathInFrameworkOptions = exports.removeViteTsConfigPathsPlugin = exports.removePathResolvesFromNextConfig = exports.writeFile = exports.onlyShowGuide = 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 fs = require("fs");
9
+ const fileutils_1 = require("nx/src/utils/fileutils");
10
+ const fs_1 = require("fs");
11
+ const path_1 = require("path");
12
+ function onlyShowGuide(storybookProjects) {
13
+ devkit_1.output.log({
14
+ title: 'Storybook 7 Migration Guide',
15
+ bodyLines: [
16
+ `You can run the following commands manually to upgrade your Storybook projects to Storybook 7:`,
17
+ ``,
18
+ `1. Call the Storybook upgrade script:`,
19
+ `npx storybook@next upgrade --prerelease`,
20
+ ``,
21
+ `2. Call the Nx generator to prepare your files for migration:`,
22
+ `nx g @nrwl/storybook:migrate-7 --onlyPrepare`,
23
+ ``,
24
+ `3. Call the Storybook automigrate scripts:`,
25
+ `Run the following commands for each Storybook project:`,
26
+ ...Object.entries(storybookProjects).map(([_projectName, storybookProjectInfo]) => {
27
+ return `npx sb@next automigrate --config-dir ${storybookProjectInfo.configDir} --renderer ${storybookProjectInfo.uiFramework}`;
28
+ }),
29
+ ``,
30
+ `4. Call the Nx generator to finish the migration:`,
31
+ `nx g @nrwl/storybook:migrate-7 --afterMigration`,
32
+ ],
33
+ });
34
+ }
35
+ exports.onlyShowGuide = onlyShowGuide;
36
+ function writeFile(file) {
37
+ if ((file === null || file === void 0 ? void 0 : file.path) && (file === null || file === void 0 ? void 0 : file.content)) {
38
+ fs.writeFileSync(file.path, file.content);
39
+ }
40
+ }
41
+ exports.writeFile = writeFile;
42
+ function removePathResolvesFromNextConfig(tree, mainJsTsPath) {
43
+ var _a, _b;
44
+ let mainJsTs = tree.read(mainJsTsPath, 'utf-8');
45
+ const hasNextConfig = tsquery_1.tsquery.query(mainJsTs, `PropertyAssignment:has(Identifier:has([name="nextConfigPath"]))`);
46
+ const nextConfigPathAssignment = hasNextConfig === null || hasNextConfig === void 0 ? void 0 : hasNextConfig.find((propertyAssignment) => {
47
+ return propertyAssignment.getText().startsWith('nextConfigPath');
48
+ });
49
+ if (!nextConfigPathAssignment) {
50
+ // No nextConfigPath found, nothing to do
51
+ return;
52
+ }
53
+ const pathResolve = (_a = tsquery_1.tsquery.query(nextConfigPathAssignment, `CallExpression:has(PropertyAccessExpression:has([name="path"]):has([name="resolve"]))`)) === null || _a === void 0 ? void 0 : _a[0];
54
+ if (pathResolve) {
55
+ const getStringLiteral = (_b = tsquery_1.tsquery.query(pathResolve, 'StringLiteral')) === null || _b === void 0 ? void 0 : _b[0];
56
+ if (getStringLiteral) {
57
+ mainJsTs = (0, devkit_1.applyChangesToString)(mainJsTs, [
58
+ {
59
+ type: devkit_1.ChangeType.Delete,
60
+ start: pathResolve.getStart(),
61
+ length: pathResolve.getText().length,
62
+ },
63
+ {
64
+ type: devkit_1.ChangeType.Insert,
65
+ index: pathResolve.getStart(),
66
+ text: getStringLiteral.getText(),
67
+ },
68
+ ]);
69
+ return {
70
+ path: mainJsTsPath,
71
+ content: mainJsTs,
72
+ };
73
+ }
74
+ }
75
+ }
76
+ exports.removePathResolvesFromNextConfig = removePathResolvesFromNextConfig;
77
+ function removeViteTsConfigPathsPlugin(tree, mainJsTsPath) {
78
+ let mainJsTs = tree.read(mainJsTsPath, 'utf-8');
79
+ const { vitePluginVariableName, importExpression } = getViteTsConfigPathsNameAndImport(mainJsTs);
80
+ const viteTsConfigPathsPluginParent = tsquery_1.tsquery.query(mainJsTs, `CallExpression:has(Identifier[name="${vitePluginVariableName}"])`);
81
+ const viteTsConfigPathsPlugin = viteTsConfigPathsPluginParent === null || viteTsConfigPathsPluginParent === void 0 ? void 0 : viteTsConfigPathsPluginParent.find((callExpression) => {
82
+ return callExpression.getText().startsWith(vitePluginVariableName);
83
+ });
84
+ if (viteTsConfigPathsPlugin && importExpression) {
85
+ mainJsTs = (0, devkit_1.applyChangesToString)(mainJsTs, [
86
+ {
87
+ type: devkit_1.ChangeType.Delete,
88
+ start: viteTsConfigPathsPlugin.getStart(),
89
+ length: mainJsTs[viteTsConfigPathsPlugin.getEnd()] === ','
90
+ ? viteTsConfigPathsPlugin.getText().length + 1
91
+ : viteTsConfigPathsPlugin.getText().length,
92
+ },
93
+ {
94
+ type: devkit_1.ChangeType.Delete,
95
+ start: importExpression.getStart(),
96
+ length: importExpression.getText().length,
97
+ },
98
+ ]);
99
+ tree.write(mainJsTsPath, mainJsTs);
100
+ removePluginsArrayIfEmpty(tree, mainJsTsPath);
101
+ }
102
+ }
103
+ exports.removeViteTsConfigPathsPlugin = removeViteTsConfigPathsPlugin;
104
+ function getViteTsConfigPathsNameAndImport(mainJsTs) {
105
+ var _a, _b, _c, _d;
106
+ const requireVariableStatement = tsquery_1.tsquery.query(mainJsTs, `VariableStatement:has(CallExpression:has(Identifier[name="require"]))`);
107
+ let vitePluginVariableName;
108
+ let importExpression;
109
+ if (requireVariableStatement === null || requireVariableStatement === void 0 ? void 0 : requireVariableStatement.length) {
110
+ importExpression = requireVariableStatement.find((statement) => {
111
+ var _a, _b;
112
+ const requireCallExpression = tsquery_1.tsquery.query(statement, 'CallExpression:has(Identifier[name="require"])');
113
+ 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('vite-tsconfig-paths');
114
+ });
115
+ if (importExpression) {
116
+ vitePluginVariableName = (_b = (_a = tsquery_1.tsquery
117
+ .query(importExpression, 'Identifier')) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.getText();
118
+ }
119
+ }
120
+ else {
121
+ const importDeclarations = tsquery_1.tsquery.query(mainJsTs, 'ImportDeclaration');
122
+ importExpression = importDeclarations === null || importDeclarations === void 0 ? void 0 : importDeclarations.find((statement) => {
123
+ var _a, _b;
124
+ const stringLiteral = tsquery_1.tsquery.query(statement, 'StringLiteral');
125
+ 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('vite-tsconfig-paths');
126
+ });
127
+ if (importExpression) {
128
+ vitePluginVariableName = (_d = (_c = tsquery_1.tsquery
129
+ .query(importExpression, 'Identifier')) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.getText();
130
+ }
131
+ }
132
+ return {
133
+ vitePluginVariableName,
134
+ importExpression,
135
+ };
136
+ }
137
+ function removePluginsArrayIfEmpty(tree, mainJsTsPath) {
138
+ var _a, _b, _c, _d;
139
+ let mainJsTs = tree.read(mainJsTsPath, 'utf-8');
140
+ const viteFinalMethodDeclaration = (_a = tsquery_1.tsquery.query(mainJsTs, `MethodDeclaration:has([name="viteFinal"])`)) === null || _a === void 0 ? void 0 : _a[0];
141
+ if (!viteFinalMethodDeclaration) {
142
+ return;
143
+ }
144
+ const pluginsPropertyAssignment = (_b = tsquery_1.tsquery.query(viteFinalMethodDeclaration, `PropertyAssignment:has(Identifier:has([name="plugins"]))`)) === null || _b === void 0 ? void 0 : _b[0];
145
+ if (!pluginsPropertyAssignment) {
146
+ return;
147
+ }
148
+ const pluginsArrayLiteralExpression = (_c = tsquery_1.tsquery.query(pluginsPropertyAssignment, `ArrayLiteralExpression`)) === null || _c === void 0 ? void 0 : _c[0];
149
+ if (((_d = pluginsArrayLiteralExpression === null || pluginsArrayLiteralExpression === void 0 ? void 0 : pluginsArrayLiteralExpression.getText()) === null || _d === void 0 ? void 0 : _d.replace(/\s/g, '')) === '[]') {
150
+ mainJsTs = (0, devkit_1.applyChangesToString)(mainJsTs, [
151
+ {
152
+ type: devkit_1.ChangeType.Delete,
153
+ start: pluginsPropertyAssignment.getStart(),
154
+ length: mainJsTs[pluginsPropertyAssignment.getEnd()] === ','
155
+ ? pluginsPropertyAssignment.getText().length + 1
156
+ : pluginsPropertyAssignment.getText().length,
157
+ },
158
+ ]);
159
+ tree.write(mainJsTsPath, mainJsTs);
160
+ }
161
+ }
162
+ function addViteConfigFilePathInFrameworkOptions(tree, mainJsTsPath, viteConfigPath) {
163
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
164
+ let mainJsTs = tree.read(mainJsTsPath, 'utf-8');
165
+ const viteFramework = (_h = (_f = (_d = (_b = (_a = tsquery_1.tsquery.query(mainJsTs, `PropertyAssignment:has(Identifier:has([name="framework"])):has(StringLiteral:has([text="@storybook/react-vite"]))`)) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : (_c = tsquery_1.tsquery.query(mainJsTs, `PropertyAssignment:has(Identifier:has([name="framework"])):has(StringLiteral:has([text="@storybook/web-components-vite"]))`)) === null || _c === void 0 ? void 0 : _c[0]) !== null && _d !== void 0 ? _d : (_e = tsquery_1.tsquery.query(mainJsTs, `PropertyAssignment:has(Identifier:has([name="framework"])):has(StringLiteral:has([text="@storybook/svelte-vite"]))`)) === null || _e === void 0 ? void 0 : _e[0]) !== null && _f !== void 0 ? _f : (_g = tsquery_1.tsquery.query(mainJsTs, `PropertyAssignment:has(Identifier:has([name="framework"])):has(StringLiteral:has([text="@storybook/vue-vite"]))`)) === null || _g === void 0 ? void 0 : _g[0]) !== null && _h !== void 0 ? _h : (_j = tsquery_1.tsquery.query(mainJsTs, `PropertyAssignment:has(Identifier:has([name="framework"])):has(StringLiteral:has([text="@storybook/vue3-vite"]))`)) === null || _j === void 0 ? void 0 : _j[0];
166
+ if (viteFramework) {
167
+ const optionsPropertyAssignments = tsquery_1.tsquery.query(viteFramework, `PropertyAssignment:has(Identifier:has([name="options"]))`);
168
+ const frameworkOptionsPropertyAssignment = optionsPropertyAssignments === null || optionsPropertyAssignments === void 0 ? void 0 : optionsPropertyAssignments.find((expression) => {
169
+ return expression.getText().startsWith('options');
170
+ });
171
+ if (frameworkOptionsPropertyAssignment) {
172
+ const objectLiteralExpression = (_k = tsquery_1.tsquery.query(frameworkOptionsPropertyAssignment, `ObjectLiteralExpression`)) === null || _k === void 0 ? void 0 : _k[0];
173
+ mainJsTs = (0, devkit_1.applyChangesToString)(mainJsTs, [
174
+ {
175
+ type: devkit_1.ChangeType.Insert,
176
+ index: objectLiteralExpression.getStart() + 1,
177
+ text: `
178
+ builder: {
179
+ viteConfigPath: '${viteConfigPath}',
180
+ },
181
+ `,
182
+ },
183
+ ]);
184
+ tree.write(mainJsTsPath, mainJsTs);
185
+ }
186
+ else {
187
+ const objectLiteralExpression = (_l = tsquery_1.tsquery.query(viteFramework, `ObjectLiteralExpression`)) === null || _l === void 0 ? void 0 : _l[0];
188
+ if (!objectLiteralExpression) {
189
+ return;
190
+ }
191
+ mainJsTs = (0, devkit_1.applyChangesToString)(mainJsTs, [
192
+ {
193
+ type: devkit_1.ChangeType.Insert,
194
+ index: objectLiteralExpression.getStart() + 1,
195
+ text: ` options: {
196
+ builder: {
197
+ viteConfigPath: '${viteConfigPath}',
198
+ },
199
+ },
200
+ `,
201
+ },
202
+ ]);
203
+ tree.write(mainJsTsPath, mainJsTs);
204
+ }
205
+ }
206
+ }
207
+ exports.addViteConfigFilePathInFrameworkOptions = addViteConfigFilePathInFrameworkOptions;
208
+ function normalizeViteConfigFilePathWithTree(tree, projectRoot, configFile) {
209
+ return configFile && tree.exists(configFile)
210
+ ? configFile
211
+ : tree.exists((0, devkit_1.joinPathFragments)(`${projectRoot}/vite.config.ts`))
212
+ ? (0, devkit_1.joinPathFragments)(`${projectRoot}/vite.config.ts`)
213
+ : tree.exists((0, devkit_1.joinPathFragments)(`${projectRoot}/vite.config.js`))
214
+ ? (0, devkit_1.joinPathFragments)(`${projectRoot}/vite.config.js`)
215
+ : undefined;
216
+ }
217
+ exports.normalizeViteConfigFilePathWithTree = normalizeViteConfigFilePathWithTree;
218
+ function removeTypecastFromMainTs(tree, mainTsPath) {
219
+ let mainTs = tree.read(mainTsPath, 'utf-8');
220
+ mainTs = mainTs.replace(/as StorybookConfig/g, '');
221
+ return {
222
+ path: mainTsPath,
223
+ content: mainTs,
224
+ };
225
+ }
226
+ exports.removeTypecastFromMainTs = removeTypecastFromMainTs;
227
+ function removeUiFrameworkFromProjectJson(tree) {
228
+ (0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nrwl/storybook:build', (options, projectName, targetName) => {
229
+ if (projectName && (options === null || options === void 0 ? void 0 : options['uiFramework'])) {
230
+ const projectConfiguration = (0, devkit_1.readProjectConfiguration)(tree, projectName);
231
+ delete projectConfiguration.targets[targetName].options['uiFramework'];
232
+ (0, devkit_1.updateProjectConfiguration)(tree, projectName, projectConfiguration);
233
+ }
234
+ });
235
+ (0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nrwl/storybook:storybook', (options, projectName, targetName) => {
236
+ if (projectName && (options === null || options === void 0 ? void 0 : options['uiFramework'])) {
237
+ const projectConfiguration = (0, devkit_1.readProjectConfiguration)(tree, projectName);
238
+ delete projectConfiguration.targets[targetName].options['uiFramework'];
239
+ (0, devkit_1.updateProjectConfiguration)(tree, projectName, projectConfiguration);
240
+ }
241
+ });
242
+ }
243
+ exports.removeUiFrameworkFromProjectJson = removeUiFrameworkFromProjectJson;
244
+ function changeCoreCommonImportToFramework(tree, mainTsPath) {
245
+ var _a, _b, _c, _d;
246
+ let mainTs = tree.read(mainTsPath, 'utf-8');
247
+ const importDeclarations = (_a = tsquery_1.tsquery.query(mainTs, 'ImportDeclaration:has(ImportSpecifier:has([text="StorybookConfig"]))')) === null || _a === void 0 ? void 0 : _a[0];
248
+ if (!importDeclarations) {
249
+ return;
250
+ }
251
+ const storybookConfigImportPackage = (_b = tsquery_1.tsquery.query(importDeclarations, 'StringLiteral')) === null || _b === void 0 ? void 0 : _b[0];
252
+ if ((storybookConfigImportPackage === null || storybookConfigImportPackage === void 0 ? void 0 : storybookConfigImportPackage.getText()) === `'@storybook/core-common'`) {
253
+ const frameworkPropertyAssignment = (_c = tsquery_1.tsquery.query(mainTs, `PropertyAssignment:has(Identifier:has([text="framework"]))`)) === null || _c === void 0 ? void 0 : _c[0];
254
+ if (!frameworkPropertyAssignment) {
255
+ return;
256
+ }
257
+ const propertyAssignments = tsquery_1.tsquery.query(frameworkPropertyAssignment, `PropertyAssignment:has(Identifier:has([text="name"]))`);
258
+ const namePropertyAssignment = propertyAssignments === null || propertyAssignments === void 0 ? void 0 : propertyAssignments.find((expression) => {
259
+ return expression.getText().startsWith('name');
260
+ });
261
+ if (!namePropertyAssignment) {
262
+ return;
263
+ }
264
+ const frameworkName = (_d = tsquery_1.tsquery.query(namePropertyAssignment, `StringLiteral`)) === null || _d === void 0 ? void 0 : _d[0];
265
+ if (frameworkName) {
266
+ mainTs = (0, devkit_1.applyChangesToString)(mainTs, [
267
+ {
268
+ type: devkit_1.ChangeType.Delete,
269
+ start: storybookConfigImportPackage.getStart(),
270
+ length: storybookConfigImportPackage.getWidth(),
271
+ },
272
+ {
273
+ type: devkit_1.ChangeType.Insert,
274
+ index: storybookConfigImportPackage.getStart(),
275
+ text: frameworkName.getText(),
276
+ },
277
+ ]);
278
+ tree.write(mainTsPath, mainTs);
279
+ }
280
+ }
281
+ }
282
+ exports.changeCoreCommonImportToFramework = changeCoreCommonImportToFramework;
283
+ function getAllStorybookInfo(tree) {
284
+ const allStorybookDirs = {};
285
+ (0, executor_options_utils_1.forEachExecutorOptions)(tree, '@nrwl/storybook:build', (options, projectName) => {
286
+ var _a, _b, _c;
287
+ if (projectName && (options === null || options === void 0 ? void 0 : options['configDir'])) {
288
+ const projectConfiguration = (0, devkit_1.readProjectConfiguration)(tree, projectName);
289
+ allStorybookDirs[projectName] = {
290
+ configDir: options === null || options === void 0 ? void 0 : options['configDir'],
291
+ uiFramework: options === null || options === void 0 ? void 0 : options['uiFramework'],
292
+ viteConfigFilePath: normalizeViteConfigFilePathWithTree(tree, projectConfiguration.root, (_c = (_b = (_a = projectConfiguration.targets) === null || _a === void 0 ? void 0 : _a.build) === null || _b === void 0 ? void 0 : _b.options) === null || _c === void 0 ? void 0 : _c.configFile),
293
+ };
294
+ }
295
+ });
296
+ (0, executor_options_utils_1.forEachExecutorOptions)(tree, '@storybook/angular:build-storybook', (options, projectName) => {
297
+ if (projectName && (options === null || options === void 0 ? void 0 : options['configDir'])) {
298
+ allStorybookDirs[projectName] = {
299
+ configDir: options === null || options === void 0 ? void 0 : options['configDir'],
300
+ uiFramework: '@storybook/angular',
301
+ };
302
+ }
303
+ });
304
+ return allStorybookDirs;
305
+ }
306
+ exports.getAllStorybookInfo = getAllStorybookInfo;
307
+ function prepareFiles(tree, allStorybookProjects) {
308
+ devkit_1.output.log({
309
+ title: `Preparing Storybook files.`,
310
+ bodyLines: [
311
+ `Nx will make some adjustments to the Storybook configuration files of your workspace`,
312
+ `so that the Storybook automigration scripts can run successfully.`,
313
+ `The adjustments are:`,
314
+ ` - Remove the "as StorybookConfig" typecast from the main.ts files, if any`,
315
+ ` - Remove the "path.resolve" calls from the Next.js Storybook configuration, if any`,
316
+ ],
317
+ color: 'blue',
318
+ });
319
+ Object.entries(allStorybookProjects).forEach(([projectName, storybookProjectInfo]) => {
320
+ const mainJsTsPath = tree.exists(`${storybookProjectInfo.configDir}/main.js`)
321
+ ? `${storybookProjectInfo.configDir}/main.js`
322
+ : tree.exists(`${storybookProjectInfo.configDir}/main.ts`)
323
+ ? `${storybookProjectInfo.configDir}/main.ts`
324
+ : undefined;
325
+ if (!mainJsTsPath) {
326
+ devkit_1.output.error({
327
+ title: `Failed to prepare Storybook files for ${projectName}.`,
328
+ bodyLines: [
329
+ `Could not find main.js or main.ts in ${storybookProjectInfo.configDir}`,
330
+ `Skipping project ${projectName}.`,
331
+ ],
332
+ });
333
+ }
334
+ if (mainJsTsPath.endsWith('.ts')) {
335
+ writeFile(removeTypecastFromMainTs(tree, mainJsTsPath));
336
+ }
337
+ writeFile(removePathResolvesFromNextConfig(tree, mainJsTsPath));
338
+ });
339
+ devkit_1.output.log({
340
+ title: `Files prepared successfully!`,
341
+ bodyLines: [`Nx prepared your files successfully.`],
342
+ color: 'green',
343
+ });
344
+ }
345
+ exports.prepareFiles = prepareFiles;
346
+ function handleMigrationResult(migrateResult, allStorybookProjects) {
347
+ var _a, _b, _c, _d;
348
+ if ((0, fileutils_1.fileExists)((0, path_1.join)(devkit_1.workspaceRoot, 'migration-storybook.log')) &&
349
+ ((_a = Object.keys(migrateResult.successfulProjects)) === null || _a === void 0 ? void 0 : _a.length)) {
350
+ const sbLogFile = (0, fs_1.readFileSync)((0, path_1.join)(devkit_1.workspaceRoot, 'migration-storybook.log'), 'utf-8');
351
+ Object.keys(migrateResult.successfulProjects).forEach((projectName) => {
352
+ if (sbLogFile.includes(`The migration failed to update your ${allStorybookProjects[projectName].configDir}`)) {
353
+ migrateResult.failedProjects[projectName] =
354
+ migrateResult.successfulProjects[projectName];
355
+ delete migrateResult.successfulProjects[projectName];
356
+ }
357
+ });
358
+ }
359
+ if (((_b = Object.keys(allStorybookProjects)) === null || _b === void 0 ? void 0 : _b.length) ===
360
+ ((_c = Object.keys(migrateResult.successfulProjects)) === null || _c === void 0 ? void 0 : _c.length) ||
361
+ ((_d = Object.keys(migrateResult.failedProjects)) === null || _d === void 0 ? void 0 : _d.length) === 0) {
362
+ devkit_1.output.log({
363
+ title: `Storybook configuration migrated.`,
364
+ bodyLines: [
365
+ `☑️ The automigrate command was successful.`,
366
+ `All your projects were migrated successfully.`,
367
+ ],
368
+ color: 'green',
369
+ });
370
+ }
371
+ else {
372
+ if (Object.keys(migrateResult.failedProjects).length) {
373
+ if (Object.keys(migrateResult.failedProjects).length) {
374
+ devkit_1.output.log({
375
+ title: `Storybook configuration migrated.`,
376
+ bodyLines: [
377
+ `☑️ The automigrate command was successful.`,
378
+ `The following projects were migrated successfully:`,
379
+ ...Object.keys(migrateResult.successfulProjects).map((project) => ` - ${project}`),
380
+ ],
381
+ color: 'green',
382
+ });
383
+ }
384
+ devkit_1.output.log({
385
+ title: `Failed migrations.`,
386
+ bodyLines: [
387
+ `There were some projects that were not migrated successfully.`,
388
+ `⚠️ The following projects were not migrated successfully:`,
389
+ ...Object.keys(migrateResult.failedProjects).map((project) => ` - ${project}`),
390
+ `You can run the following commands to migrate them manually:`,
391
+ ...Object.entries(migrateResult.failedProjects).map(([_project, command]) => `- ${command}`),
392
+ ],
393
+ color: 'red',
394
+ });
395
+ }
396
+ }
397
+ return migrateResult;
398
+ }
399
+ exports.handleMigrationResult = handleMigrationResult;
400
+ function checkStorybookInstalled(packageJson) {
401
+ return ((packageJson.dependencies['@storybook/core-server'] ||
402
+ packageJson.devDependencies['@storybook/core-server']) &&
403
+ (packageJson.dependencies['@nrwl/storybook'] ||
404
+ packageJson.devDependencies['@nrwl/storybook']));
405
+ }
406
+ exports.checkStorybookInstalled = checkStorybookInstalled;
407
+ function checkWebComponentsInstalled(packageJson) {
408
+ return (packageJson.dependencies['@storybook/web-components'] ||
409
+ packageJson.devDependencies['@storybook/web-components-vite'] ||
410
+ packageJson.dependencies['@storybook/web-components-vite'] ||
411
+ packageJson.devDependencies['@storybook/web-components-webpack5'] ||
412
+ packageJson.dependencies['@storybook/web-components-webpack5']);
413
+ }
414
+ exports.checkWebComponentsInstalled = checkWebComponentsInstalled;
415
+ function afterMigration(tree, allStorybookProjects) {
416
+ Object.entries(allStorybookProjects).forEach(([_projectName, storybookProjectInfo]) => tslib_1.__awaiter(this, void 0, void 0, function* () {
417
+ const mainJsTsPath = tree.exists(`${storybookProjectInfo.configDir}/main.js`)
418
+ ? `${storybookProjectInfo.configDir}/main.js`
419
+ : tree.exists(`${storybookProjectInfo.configDir}/main.ts`)
420
+ ? `${storybookProjectInfo.configDir}/main.ts`
421
+ : undefined;
422
+ removeViteTsConfigPathsPlugin(tree, mainJsTsPath);
423
+ if (storybookProjectInfo.viteConfigFilePath) {
424
+ addViteConfigFilePathInFrameworkOptions(tree, mainJsTsPath, storybookProjectInfo.viteConfigFilePath);
425
+ }
426
+ changeCoreCommonImportToFramework(tree, mainJsTsPath);
427
+ }));
428
+ }
429
+ exports.afterMigration = afterMigration;
430
+ function logResult(tree, migrationSummary) {
431
+ var _a, _b, _c, _d;
432
+ devkit_1.output.log({
433
+ title: `Migration complete!`,
434
+ bodyLines: [
435
+ `🎉 Your Storybook configuration has been migrated to Storybook 7.0.0!`,
436
+ `📖 You can see a summary of the tasks that were performed in the storybook-migration-summary.md file in the root of your workspace.`,
437
+ ],
438
+ color: 'green',
439
+ });
440
+ (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files'), '.', {
441
+ tmpl: '',
442
+ successfulProjects: (_a = Object.entries(migrationSummary === null || migrationSummary === void 0 ? void 0 : migrationSummary.successfulProjects)) === null || _a === void 0 ? void 0 : _a.map(([_projectName, command]) => command),
443
+ failedProjects: (_b = Object.entries(migrationSummary === null || migrationSummary === void 0 ? void 0 : migrationSummary.failedProjects)) === null || _b === void 0 ? void 0 : _b.map(([_projectName, command]) => command),
444
+ hasFailedProjects: ((_c = Object.keys(migrationSummary === null || migrationSummary === void 0 ? void 0 : migrationSummary.failedProjects)) === null || _c === void 0 ? void 0 : _c.length) > 0,
445
+ hasSuccessfulProjects: ((_d = Object.keys(migrationSummary === null || migrationSummary === void 0 ? void 0 : migrationSummary.successfulProjects)) === null || _d === void 0 ? void 0 : _d.length) > 0,
446
+ });
447
+ }
448
+ exports.logResult = logResult;
449
+ //# sourceMappingURL=helper-functions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helper-functions.js","sourceRoot":"","sources":["../../../../../../packages/storybook/src/generators/migrate-7/helper-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AAkB,EAAE,MAAA,MAAM,CAAC,OAAO,CAChC,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,kBAAkB,CACrC,0CAAE,GAAG,CAAC,CAAC,CAAC,YAAY,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC;QAC5C,cAAc,EAAE,MAAA,MAAM,CAAC,OAAO,CAAC,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,cAAc,CAAC,0CAAE,GAAG,CACnE,CAAC,CAAC,YAAY,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,OAAO,CACrC;QACD,iBAAiB,EACf,CAAA,MAAA,MAAM,CAAC,IAAI,CAAC,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,cAAc,CAAC,0CAAE,MAAM,IAAG,CAAC;QAC3D,qBAAqB,EACnB,CAAA,MAAA,MAAM,CAAC,IAAI,CAAC,gBAAgB,aAAhB,gBAAgB,uBAAhB,gBAAgB,CAAE,kBAAkB,CAAC,0CAAE,MAAM,IAAG,CAAC;KAChE,CAAC,CAAC;AACL,CAAC;AA7BD,8BA6BC"}
@@ -0,0 +1,5 @@
1
+ import { GeneratorCallback, Tree } from '@nx/devkit';
2
+ import { Schema } from './schema';
3
+ export declare function migrate7Generator(tree: Tree, schema: Schema): Promise<GeneratorCallback>;
4
+ export default migrate7Generator;
5
+ export declare const migrate7Schematic: (generatorOptions: Schema) => (tree: any, context: any) => Promise<any>;
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.migrate7Schematic = exports.migrate7Generator = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const devkit_1 = require("@nx/devkit");
6
+ const output_1 = require("nx/src/utils/output");
7
+ const versions_1 = require("../../utils/versions");
8
+ const calling_storybook_cli_1 = require("./calling-storybook-cli");
9
+ const helper_functions_1 = require("./helper-functions");
10
+ function migrate7Generator(tree, schema) {
11
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
12
+ const tasks = [];
13
+ const packageJson = (0, devkit_1.readJson)(tree, 'package.json');
14
+ if (!(0, helper_functions_1.checkStorybookInstalled)(packageJson)) {
15
+ output_1.output.error({
16
+ title: 'No Storybook packages installed',
17
+ bodyLines: [
18
+ `🚨 Nx did not find any Storybook packages installed in your workspace.`,
19
+ `So no migration is necessary.`,
20
+ ],
21
+ });
22
+ return;
23
+ }
24
+ const allStorybookProjects = (0, helper_functions_1.getAllStorybookInfo)(tree);
25
+ let migrateResult;
26
+ if (schema.onlyShowListOfCommands) {
27
+ (0, helper_functions_1.onlyShowGuide)(allStorybookProjects);
28
+ return;
29
+ }
30
+ if (!schema.afterMigration) {
31
+ if (!schema.noUpgrade) {
32
+ (0, calling_storybook_cli_1.callUpgrade)(schema);
33
+ }
34
+ if (Object.entries(allStorybookProjects).length) {
35
+ (0, helper_functions_1.prepareFiles)(tree, allStorybookProjects);
36
+ if (schema.onlyPrepare) {
37
+ return;
38
+ }
39
+ migrateResult = (0, calling_storybook_cli_1.callAutomigrate)(allStorybookProjects, schema);
40
+ migrateResult = (0, helper_functions_1.handleMigrationResult)(migrateResult, allStorybookProjects);
41
+ }
42
+ }
43
+ output_1.output.log({
44
+ title: `Final adjustments`,
45
+ bodyLines: [
46
+ `We are now running some final adjustments to your configuration files.`,
47
+ `The adjustments are:`,
48
+ ` - Remove the "vite-tsconfig-paths" plugin from the Storybook configuration files since it's no longer needed`,
49
+ ` - Add the "viteConfigPath" option to the Storybook builder, where needed`,
50
+ ` - Change the import package for the StorybookConfig type to be framework specific`,
51
+ ` - Add the "lit" package to your workspace, if you are using Web Components`,
52
+ ` - Remove the "uiFramework" option from your project's Storybook targets`,
53
+ ],
54
+ color: 'blue',
55
+ });
56
+ if (Object.entries(allStorybookProjects).length) {
57
+ (0, helper_functions_1.afterMigration)(tree, allStorybookProjects);
58
+ }
59
+ if ((0, helper_functions_1.checkWebComponentsInstalled)(packageJson)) {
60
+ tasks.push((0, devkit_1.addDependenciesToPackageJson)(tree, {}, { lit: versions_1.litVersion }));
61
+ }
62
+ (0, helper_functions_1.removeUiFrameworkFromProjectJson)(tree);
63
+ if (!schema.afterMigration) {
64
+ (0, helper_functions_1.logResult)(tree, migrateResult);
65
+ }
66
+ yield (0, devkit_1.formatFiles)(tree);
67
+ return (0, devkit_1.runTasksInSerial)(...tasks);
68
+ });
69
+ }
70
+ exports.migrate7Generator = migrate7Generator;
71
+ exports.default = migrate7Generator;
72
+ exports.migrate7Schematic = (0, devkit_1.convertNxGenerator)(migrate7Generator);
73
+ //# sourceMappingURL=migrate-7.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrate-7.js","sourceRoot":"","sources":["../../../../../../packages/storybook/src/generators/migrate-7/migrate-7.ts"],"names":[],"mappings":";;;;AAAA,uCAQoB;AAEpB,gDAA6C;AAC7C,mDAAkD;AAClD,mEAAuE;AACvE,yDAU4B;AAG5B,SAAsB,iBAAiB,CAAC,IAAU,EAAE,MAAc;;QAChE,MAAM,KAAK,GAAwB,EAAE,CAAC;QAEtC,MAAM,WAAW,GAAG,IAAA,iBAAQ,EAAC,IAAI,EAAE,cAAc,CAAC,CAAC;QACnD,IAAI,CAAC,IAAA,0CAAuB,EAAC,WAAW,CAAC,EAAE;YACzC,eAAM,CAAC,KAAK,CAAC;gBACX,KAAK,EAAE,iCAAiC;gBACxC,SAAS,EAAE;oBACT,wEAAwE;oBACxE,+BAA+B;iBAChC;aACF,CAAC,CAAC;YACH,OAAO;SACR;QAED,MAAM,oBAAoB,GAMtB,IAAA,sCAAmB,EAAC,IAAI,CAAC,CAAC;QAE9B,IAAI,aAGH,CAAC;QACF,IAAI,MAAM,CAAC,sBAAsB,EAAE;YACjC,IAAA,gCAAa,EAAC,oBAAoB,CAAC,CAAC;YACpC,OAAO;SACR;QACD,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE;YAC1B,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE;gBACrB,IAAA,mCAAW,E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QAAA,iBAAiB,GAAG,IAAA,2BAAkB,EAAC,iBAAiB,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { UiFramework, UiFramework7 } from '../../utils/models';
2
+
3
+ export interface Schema {
4
+ autoAcceptAllPrompts?: boolean;
5
+ onlyShowListOfCommands?: boolean;
6
+ noUpgrade?: boolean;
7
+ onlyPrepare?: boolean;
8
+ afterMigration?: boolean;
9
+ }
@@ -0,0 +1,35 @@
1
+ {
2
+ "cli": "nx",
3
+ "title": "Migrate Storybook to version 7.",
4
+ "description": "Migrate Storybook to version 7.",
5
+ "$id": "migrate-7",
6
+ "type": "object",
7
+ "properties": {
8
+ "autoAcceptAllPrompts": {
9
+ "type": "boolean",
10
+ "description": "Say yes to all the prompts from the Storybook CLI migration scripts.",
11
+ "default": false
12
+ },
13
+ "onlyShowListOfCommands": {
14
+ "type": "boolean",
15
+ "description": "Only show the steps that you need to follow in order to migrate. This does NOT make any changes to your code.",
16
+ "default": false
17
+ },
18
+ "noUpgrade": {
19
+ "type": "boolean",
20
+ "description": "Skip upgrading Storybook packages. Only use this option if you are already on version 7, and you do not want the latest beta.",
21
+ "default": false
22
+ },
23
+ "onlyPrepare": {
24
+ "type": "boolean",
25
+ "description": "Only run the Nx scripts that will prepare your Storybook configuration files for the Storybook CLI automigration.",
26
+ "default": false
27
+ },
28
+ "afterMigration": {
29
+ "type": "boolean",
30
+ "description": "Only run the Nx post-migration scripts that make the final adjustments to your workspace.",
31
+ "default": false
32
+ }
33
+ },
34
+ "examplesFile": "../../../docs/migrate-7-generator-examples.md"
35
+ }
@@ -0,0 +1,2 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export default function setProjectBuildConfig(tree: Tree): Promise<void>;