@nx/storybook 23.0.0-beta.2 → 23.0.0-beta.21

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 (51) hide show
  1. package/migrations.json +17 -1
  2. package/package.json +9 -9
  3. package/src/executors/build-storybook/build-storybook.impl.d.ts.map +1 -1
  4. package/src/executors/build-storybook/build-storybook.impl.js +2 -4
  5. package/src/executors/build-storybook/schema.json +1 -0
  6. package/src/executors/storybook/schema.json +1 -0
  7. package/src/executors/storybook/storybook.impl.d.ts.map +1 -1
  8. package/src/executors/storybook/storybook.impl.js +2 -4
  9. package/src/generators/configuration/configuration.d.ts.map +1 -1
  10. package/src/generators/configuration/configuration.js +8 -7
  11. package/src/generators/configuration/lib/ensure-dependencies.d.ts.map +1 -1
  12. package/src/generators/configuration/lib/ensure-dependencies.js +4 -15
  13. package/src/generators/configuration/lib/util-functions.d.ts.map +1 -1
  14. package/src/generators/configuration/lib/util-functions.js +39 -35
  15. package/src/generators/convert-to-inferred/convert-to-inferred.d.ts.map +1 -1
  16. package/src/generators/convert-to-inferred/convert-to-inferred.js +7 -6
  17. package/src/generators/convert-to-inferred/lib/build-post-target-transformer.d.ts +1 -1
  18. package/src/generators/convert-to-inferred/lib/build-post-target-transformer.d.ts.map +1 -1
  19. package/src/generators/convert-to-inferred/lib/build-post-target-transformer.js +6 -9
  20. package/src/generators/convert-to-inferred/lib/serve-post-target-transformer.d.ts +1 -1
  21. package/src/generators/convert-to-inferred/lib/serve-post-target-transformer.d.ts.map +1 -1
  22. package/src/generators/convert-to-inferred/lib/serve-post-target-transformer.js +4 -6
  23. package/src/generators/convert-to-inferred/lib/utils.d.ts +77 -37
  24. package/src/generators/convert-to-inferred/lib/utils.d.ts.map +1 -1
  25. package/src/generators/convert-to-inferred/lib/utils.js +35 -40
  26. package/src/generators/init/init.d.ts.map +1 -1
  27. package/src/generators/init/init.js +7 -7
  28. package/src/generators/init/schema.json +1 -1
  29. package/src/generators/migrate-10/migrate-10.d.ts.map +1 -1
  30. package/src/generators/migrate-10/migrate-10.js +5 -0
  31. package/src/generators/migrate-10/schema.d.ts +1 -0
  32. package/src/generators/migrate-10/schema.json +5 -0
  33. package/src/generators/migrate-9/migrate-9.d.ts.map +1 -1
  34. package/src/generators/migrate-9/migrate-9.js +2 -0
  35. package/src/migrations/update-22-1-0/migrate-to-storybook-10.d.ts +1 -1
  36. package/src/migrations/update-22-1-0/migrate-to-storybook-10.d.ts.map +1 -1
  37. package/src/migrations/update-22-1-0/migrate-to-storybook-10.js +1 -4
  38. package/src/plugins/plugin.d.ts.map +1 -1
  39. package/src/plugins/plugin.js +61 -27
  40. package/src/utils/assert-supported-storybook-version.d.ts +3 -0
  41. package/src/utils/assert-supported-storybook-version.d.ts.map +1 -0
  42. package/src/utils/assert-supported-storybook-version.js +8 -0
  43. package/src/utils/deprecation.d.ts +6 -0
  44. package/src/utils/deprecation.d.ts.map +1 -0
  45. package/src/utils/deprecation.js +21 -0
  46. package/src/utils/utilities.d.ts +1 -4
  47. package/src/utils/utilities.d.ts.map +1 -1
  48. package/src/utils/utilities.js +5 -84
  49. package/src/utils/versions.d.ts +9 -0
  50. package/src/utils/versions.d.ts.map +1 -1
  51. package/src/utils/versions.js +47 -1
package/migrations.json CHANGED
@@ -3,12 +3,18 @@
3
3
  "update-21-2-0-migrate-storybook-v9": {
4
4
  "cli": "nx",
5
5
  "version": "21.2.0-beta.3",
6
+ "requires": {
7
+ "storybook": ">=9.0.0 <10.0.0"
8
+ },
6
9
  "description": "Update workspace to use Storybook v9",
7
10
  "implementation": "./src/migrations/update-21-1-0/update-sb-9"
8
11
  },
9
12
  "update-21-2-0-remove-addon-dependencies": {
10
13
  "cli": "nx",
11
14
  "version": "21.2.0-beta.3",
15
+ "requires": {
16
+ "storybook": ">=9.0.0 <10.0.0"
17
+ },
12
18
  "description": "Remove deprecated Storybook addon dependencies",
13
19
  "implementation": "./src/migrations/update-21-2-0/remove-addon-dependencies"
14
20
  },
@@ -19,12 +25,16 @@
19
25
  "storybook": ">=10.0.0"
20
26
  },
21
27
  "description": "Update workspace to use Storybook v10",
22
- "implementation": "./src/migrations/update-22-1-0/migrate-to-storybook-10"
28
+ "implementation": "./src/migrations/update-22-1-0/migrate-to-storybook-10",
29
+ "prompt": "./src/generators/migrate-10/files/ai-instructions-for-cjs-esm.md"
23
30
  }
24
31
  },
25
32
  "packageJsonUpdates": {
26
33
  "20.2.0": {
27
34
  "version": "20.2.0-beta.5",
35
+ "requires": {
36
+ "storybook": ">=8.0.0 <9.0.0"
37
+ },
28
38
  "packages": {
29
39
  "@storybook/test-runner": {
30
40
  "version": "^0.19.0",
@@ -282,6 +292,9 @@
282
292
  },
283
293
  "20.8.0": {
284
294
  "version": "20.8.0-beta.0",
295
+ "requires": {
296
+ "storybook": ">=8.0.0 <9.0.0"
297
+ },
285
298
  "packages": {
286
299
  "@storybook/test-runner": {
287
300
  "version": "^0.22.0",
@@ -539,6 +552,9 @@
539
552
  },
540
553
  "21.1.0": {
541
554
  "version": "22.1.0-beta.3",
555
+ "requires": {
556
+ "storybook": ">=8.0.0 <9.0.0"
557
+ },
542
558
  "packages": {
543
559
  "@storybook/angular": {
544
560
  "version": "^9.0.5",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/storybook",
3
- "version": "23.0.0-beta.2",
3
+ "version": "23.0.0-beta.21",
4
4
  "private": false,
5
5
  "description": "The Nx Plugin for Storybook contains executors and generators for allowing your workspace to use the powerful Storybook integration testing & documenting capabilities.",
6
6
  "repository": {
@@ -34,21 +34,21 @@
34
34
  "migrations": "./migrations.json"
35
35
  },
36
36
  "dependencies": {
37
- "@nx/devkit": "23.0.0-beta.2",
38
- "@phenomnomnominal/tsquery": "~6.1.4",
37
+ "@nx/devkit": "23.0.0-beta.21",
38
+ "@phenomnomnominal/tsquery": "~6.2.0",
39
39
  "semver": "^7.6.3",
40
40
  "tslib": "^2.3.0",
41
- "@nx/cypress": "23.0.0-beta.2",
42
- "@nx/js": "23.0.0-beta.2",
43
- "@nx/eslint": "23.0.0-beta.2"
41
+ "@nx/cypress": "23.0.0-beta.21",
42
+ "@nx/js": "23.0.0-beta.21",
43
+ "@nx/eslint": "23.0.0-beta.21"
44
44
  },
45
45
  "devDependencies": {
46
- "nx": "23.0.0-beta.2",
46
+ "nx": "23.0.0-beta.21",
47
47
  "storybook": "9.0.6"
48
48
  },
49
49
  "peerDependencies": {
50
- "@nx/web": "23.0.0-beta.2",
51
- "storybook": ">=7.0.0 <11.0.0"
50
+ "@nx/web": "23.0.0-beta.21",
51
+ "storybook": ">=8.0.0 <11.0.0"
52
52
  },
53
53
  "peerDependenciesMeta": {
54
54
  "@nx/web": {
@@ -1 +1 @@
1
- {"version":3,"file":"build-storybook.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/storybook/src/executors/build-storybook/build-storybook.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAU,MAAM,YAAY,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAS3D,wBAA8B,sBAAsB,CAClD,OAAO,EAAE,UAAU,EACnB,OAAO,EAAE,eAAe;;GAczB"}
1
+ {"version":3,"file":"build-storybook.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/storybook/src/executors/build-storybook/build-storybook.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAU,MAAM,YAAY,CAAC;AACrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAQ3D,wBAA8B,sBAAsB,CAClD,OAAO,EAAE,UAAU,EACnB,OAAO,EAAE,eAAe;;GAYzB"}
@@ -37,12 +37,10 @@ exports.default = buildStorybookExecutor;
37
37
  const devkit_1 = require("@nx/devkit");
38
38
  const utilities_1 = require("../../utils/utilities");
39
39
  const semver_1 = require("semver");
40
+ const deprecation_1 = require("../../utils/deprecation");
40
41
  async function buildStorybookExecutor(options, context) {
42
+ (0, deprecation_1.warnStorybookBuildExecutorDeprecation)();
41
43
  (0, utilities_1.storybookConfigExistsCheck)(options.configDir, context.projectName);
42
- const storybookMajor = (0, utilities_1.storybookMajorVersion)();
43
- if (storybookMajor > 0 && storybookMajor <= 7) {
44
- throw (0, utilities_1.pleaseUpgrade)();
45
- }
46
44
  const buildOptions = options;
47
45
  devkit_1.logger.info(`NX Storybook builder starting ...`);
48
46
  await runInstance(buildOptions);
@@ -5,6 +5,7 @@
5
5
  "cli": "nx",
6
6
  "description": "Build storybook in production mode.",
7
7
  "type": "object",
8
+ "x-deprecated": "The `@nx/storybook:build` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/storybook:convert-to-inferred` to migrate to the `@nx/storybook/plugin` inferred plugin. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.",
8
9
  "presets": [
9
10
  {
10
11
  "name": "Default minimum setup",
@@ -6,6 +6,7 @@
6
6
  "cli": "nx",
7
7
  "description": "Serve up Storybook in development mode.",
8
8
  "type": "object",
9
+ "x-deprecated": "The `@nx/storybook:storybook` executor is deprecated and will be removed in Nx v24. Run `nx g @nx/storybook:convert-to-inferred` to migrate to the `@nx/storybook/plugin` inferred plugin. See https://nx.dev/docs/guides/tasks--caching/convert-to-inferred for details.",
9
10
  "presets": [
10
11
  {
11
12
  "name": "Default minimum setup",
@@ -1 +1 @@
1
- {"version":3,"file":"storybook.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/storybook/src/executors/storybook/storybook.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAU,MAAM,YAAY,CAAC;AAOrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAG3D,wBAA+B,iBAAiB,CAC9C,OAAO,EAAE,UAAU,EACnB,OAAO,EAAE,eAAe,GACvB,cAAc,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC3C,CAAC,CAmBD"}
1
+ {"version":3,"file":"storybook.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/storybook/src/executors/storybook/storybook.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAU,MAAM,YAAY,CAAC;AAKrD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAI3D,wBAA+B,iBAAiB,CAC9C,OAAO,EAAE,UAAU,EACnB,OAAO,EAAE,eAAe,GACvB,cAAc,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC3C,CAAC,CAgBD"}
@@ -36,11 +36,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.default = storybookExecutor;
37
37
  const utilities_1 = require("../../utils/utilities");
38
38
  const semver_1 = require("semver");
39
+ const deprecation_1 = require("../../utils/deprecation");
39
40
  async function* storybookExecutor(options, context) {
40
- const storybookMajor = (0, utilities_1.storybookMajorVersion)();
41
- if (storybookMajor > 0 && storybookMajor <= 7) {
42
- throw (0, utilities_1.pleaseUpgrade)();
43
- }
41
+ (0, deprecation_1.warnStorybookExecutorDeprecation)();
44
42
  (0, utilities_1.storybookConfigExistsCheck)(options.configDir, context.projectName);
45
43
  const buildOptions = options;
46
44
  const result = await runInstance(buildOptions);
@@ -1 +1 @@
1
- {"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../../../../../packages/storybook/src/generators/configuration/configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EAKjB,IAAI,EACL,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAuCpD,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,wBAAwB,8BAGjC;AAED,wBAAsB,8BAA8B,CAClD,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,wBAAwB,8BA4KpC;AAwBD,eAAe,sBAAsB,CAAC"}
1
+ {"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../../../../../packages/storybook/src/generators/configuration/configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EAKjB,IAAI,EACL,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAuCpD,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,wBAAwB,8BAGjC;AAED,wBAAsB,8BAA8B,CAClD,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,wBAAwB,8BA6KpC;AAwBD,eAAe,sBAAsB,CAAC"}
@@ -5,21 +5,21 @@ exports.configurationGeneratorInternal = configurationGeneratorInternal;
5
5
  const devkit_1 = require("@nx/devkit");
6
6
  const js_1 = require("@nx/js");
7
7
  const init_1 = require("../init/init");
8
+ const deprecation_1 = require("../../utils/deprecation");
9
+ const assert_supported_storybook_version_1 = require("../../utils/assert-supported-storybook-version");
8
10
  const util_functions_1 = require("./lib/util-functions");
9
11
  const utilities_1 = require("../../utils/utilities");
10
12
  const versions_1 = require("../../utils/versions");
11
13
  const ensure_dependencies_1 = require("./lib/ensure-dependencies");
12
14
  const edit_root_tsconfig_1 = require("./lib/edit-root-tsconfig");
13
- const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
15
+ const internal_1 = require("@nx/js/internal");
14
16
  function configurationGenerator(tree, schema) {
15
17
  return configurationGeneratorInternal(tree, { addPlugin: false, ...schema });
16
18
  }
17
19
  async function configurationGeneratorInternal(tree, rawSchema) {
20
+ (0, assert_supported_storybook_version_1.assertSupportedStorybookVersion)(tree);
18
21
  const storybookMajor = (0, utilities_1.storybookMajorVersion)(tree);
19
- if (storybookMajor > 0 && storybookMajor === 7) {
20
- throw new Error((0, utilities_1.pleaseUpgrade)());
21
- }
22
- else if (storybookMajor === 8) {
22
+ if (storybookMajor === 8) {
23
23
  devkit_1.logger.warn(`Support for Storybook 8 is deprecated. Please upgrade to Storybook 9. See https://nx.dev/nx-api/storybook/generators/migrate-9 for more details.`);
24
24
  }
25
25
  const schema = normalizeSchema(tree, rawSchema);
@@ -62,7 +62,7 @@ async function configurationGeneratorInternal(tree, rawSchema) {
62
62
  ? p === '@nx/storybook/plugin'
63
63
  : p.plugin === '@nx/storybook/plugin');
64
64
  const mainDir = !!nextConfigFilePath &&
65
- (0, ts_solution_setup_1.getProjectType)(tree, root, projectType) === 'application'
65
+ (0, internal_1.getProjectType)(tree, root, projectType) === 'application'
66
66
  ? 'components'
67
67
  : 'src';
68
68
  const usesVite = !!viteConfigFilePath || schema.uiFramework?.endsWith('-vite');
@@ -82,6 +82,7 @@ async function configurationGeneratorInternal(tree, rawSchema) {
82
82
  }
83
83
  let devDeps = {};
84
84
  if (!hasPlugin || schema.addExplicitTargets) {
85
+ (0, deprecation_1.warnStorybookExecutorGenerating)();
85
86
  if (schema.uiFramework === '@storybook/angular') {
86
87
  (0, util_functions_1.addAngularStorybookTarget)(tree, schema.project, schema.interactionTests);
87
88
  }
@@ -115,7 +116,7 @@ async function configurationGeneratorInternal(tree, rawSchema) {
115
116
  // the nxViteTsPaths plugin to register the tsconfig paths in Vite.
116
117
  devDeps['@nx/vite'] = versions_1.nxVersion;
117
118
  }
118
- tasks.push((0, devkit_1.addDependenciesToPackageJson)(tree, {}, devDeps));
119
+ tasks.push((0, devkit_1.addDependenciesToPackageJson)(tree, {}, devDeps, undefined, true));
119
120
  if (!schema.skipFormat) {
120
121
  await (0, devkit_1.formatFiles)(tree);
121
122
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ensure-dependencies.d.ts","sourceRoot":"","sources":["../../../../../../../packages/storybook/src/generators/configuration/lib/ensure-dependencies.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAYpB,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAE1D,MAAM,MAAM,yBAAyB,GAAG;IACtC,WAAW,CAAC,EAAE,wBAAwB,CAAC,aAAa,CAAC,CAAC;CACvD,CAAC;AAEF,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,yBAAyB,0CAuFnC"}
1
+ {"version":3,"file":"ensure-dependencies.d.ts","sourceRoot":"","sources":["../../../../../../../packages/storybook/src/generators/configuration/lib/ensure-dependencies.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAMpB,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAE1D,MAAM,MAAM,yBAAyB,GAAG;IACtC,WAAW,CAAC,EAAE,wBAAwB,CAAC,aAAa,CAAC,CAAC;CACvD,CAAC;AAEF,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,yBAAyB,0CA8EnC"}
@@ -2,14 +2,15 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ensureDependencies = ensureDependencies;
4
4
  const devkit_1 = require("@nx/devkit");
5
- const semver_1 = require("semver");
6
5
  const utilities_1 = require("../../../utils/utilities");
7
6
  const versions_1 = require("../../../utils/versions");
8
7
  function ensureDependencies(tree, options) {
9
8
  const storybookVersionToInstall = (0, utilities_1.getInstalledStorybookVersion)(tree);
10
9
  const installedStorybookMajorVersion = (0, utilities_1.storybookMajorVersion)(tree);
11
10
  const dependencies = {};
12
- const devDependencies = installedStorybookMajorVersion < 9
11
+ // Storybook v8 ships `@storybook/core-server` and `@storybook/addon-essentials`
12
+ // as separate packages; v9 folds them into `storybook`.
13
+ const devDependencies = installedStorybookMajorVersion === 8
13
14
  ? {
14
15
  '@storybook/core-server': storybookVersionToInstall,
15
16
  '@storybook/addon-essentials': storybookVersionToInstall,
@@ -18,18 +19,6 @@ function ensureDependencies(tree, options) {
18
19
  const packageJson = (0, devkit_1.readJson)(tree, 'package.json');
19
20
  packageJson.dependencies ??= {};
20
21
  packageJson.devDependencies ??= {};
21
- if (!(0, semver_1.gte)((0, semver_1.coerce)(storybookVersionToInstall), '8.0.0')) {
22
- // Needed for Storybook 7
23
- // https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#react-peer-dependencies-required
24
- if (!packageJson.dependencies['react'] &&
25
- !packageJson.devDependencies['react']) {
26
- dependencies['react'] = versions_1.reactVersion;
27
- }
28
- if (!packageJson.dependencies['react-dom'] &&
29
- !packageJson.devDependencies['react-dom']) {
30
- dependencies['react-dom'] = versions_1.reactVersion;
31
- }
32
- }
33
22
  if (options.uiFramework) {
34
23
  devDependencies[options.uiFramework] = storybookVersionToInstall;
35
24
  const isPnpm = (0, devkit_1.detectPackageManager)(tree.root) === 'pnpm';
@@ -67,5 +56,5 @@ function ensureDependencies(tree, options) {
67
56
  }
68
57
  }
69
58
  }
70
- return (0, devkit_1.addDependenciesToPackageJson)(tree, dependencies, devDependencies);
59
+ return (0, devkit_1.addDependenciesToPackageJson)(tree, dependencies, devDependencies, undefined, true);
71
60
  }
@@ -1 +1 @@
1
- {"version":3,"file":"util-functions.d.ts","sourceRoot":"","sources":["../../../../../../../packages/storybook/src/generators/configuration/lib/util-functions.ts"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"util-functions.d.ts","sourceRoot":"","sources":["../../../../../../../packages/storybook/src/generators/configuration/lib/util-functions.ts"],"names":[],"mappings":"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"}
@@ -25,9 +25,9 @@ const devkit_1 = require("@nx/devkit");
25
25
  const path_1 = require("path");
26
26
  const utilities_1 = require("../../../utils/utilities");
27
27
  const versions_1 = require("../../../utils/versions");
28
- const eslint_file_1 = require("@nx/eslint/src/generators/utils/eslint-file");
29
- const flat_config_1 = require("@nx/eslint/src/utils/flat-config");
30
- const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
28
+ const internal_1 = require("@nx/eslint/internal");
29
+ const internal_2 = require("@nx/devkit/internal");
30
+ const internal_3 = require("@nx/js/internal");
31
31
  const DEFAULT_PORT = 4400;
32
32
  function addStorybookTarget(tree, projectName, uiFramework, interactionTests) {
33
33
  const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, projectName);
@@ -126,7 +126,7 @@ async function addStaticTarget(tree, opts) {
126
126
  function createStorybookTsconfigFile(tree, projectRoot, uiFramework, isRootProject, mainDir) {
127
127
  const storybookMajorVersion = (0, utilities_1.storybookMajorVersion)(tree);
128
128
  const offset = (0, devkit_1.offsetFromRoot)(projectRoot);
129
- const useTsSolution = (0, ts_solution_setup_1.isUsingTsSolutionSetup)(tree);
129
+ const useTsSolution = (0, internal_3.isUsingTsSolutionSetup)(tree);
130
130
  // First let's check if old configuration file exists
131
131
  // If it exists, let's rename it and move it to the new location
132
132
  const oldStorybookTsConfigPath = (0, devkit_1.joinPathFragments)(projectRoot, '.storybook/tsconfig.json');
@@ -175,7 +175,7 @@ function createStorybookTsconfigFile(tree, projectRoot, uiFramework, isRootProje
175
175
  ],
176
176
  };
177
177
  if (useTsSolution) {
178
- const runtimeConfig = (0, ts_solution_setup_1.findRuntimeTsConfigName)(projectRoot, tree);
178
+ const runtimeConfig = (0, internal_3.findRuntimeTsConfigName)(projectRoot, tree);
179
179
  if (runtimeConfig) {
180
180
  storybookTsConfig.references ??= [];
181
181
  storybookTsConfig.references.push({
@@ -287,14 +287,14 @@ function configureTsSolutionConfig(tree, schema) {
287
287
  function updateLintConfig(tree, schema) {
288
288
  const { project: projectName } = schema;
289
289
  const { root } = (0, devkit_1.readProjectConfiguration)(tree, projectName);
290
- const eslintFile = (0, eslint_file_1.findEslintFile)(tree, root);
290
+ const eslintFile = (0, internal_1.findEslintFile)(tree, root);
291
291
  if (!eslintFile) {
292
292
  return;
293
293
  }
294
294
  const parserConfigPath = (0, path_1.join)(root, schema.uiFramework === '@storybook/angular'
295
295
  ? '.storybook/tsconfig.json'
296
296
  : 'tsconfig.storybook.json');
297
- if ((0, flat_config_1.useFlatConfig)(tree)) {
297
+ if ((0, internal_1.useFlatConfig)(tree)) {
298
298
  let config = tree.read(eslintFile, 'utf-8');
299
299
  const projectRegex = RegExp(/project:\s?\[?['"](.*)['"]\]?/g);
300
300
  let match;
@@ -372,34 +372,38 @@ function addStorybookToNamedInputs(tree) {
372
372
  }
373
373
  }
374
374
  function addStorybookToTargetDefaults(tree, setCache = true) {
375
- const nxJson = (0, devkit_1.readNxJson)(tree);
376
- nxJson.targetDefaults ??= {};
377
- nxJson.targetDefaults['build-storybook'] ??= {};
378
- if (setCache) {
379
- nxJson.targetDefaults['build-storybook'].cache ??= true;
380
- }
381
- nxJson.targetDefaults['build-storybook'].inputs ??= [
382
- 'default',
383
- nxJson.namedInputs && 'production' in nxJson.namedInputs
384
- ? '^production'
385
- : '^default',
386
- ];
387
- if (!nxJson.targetDefaults['build-storybook'].inputs.includes('{projectRoot}/.storybook/**/*')) {
388
- nxJson.targetDefaults['build-storybook'].inputs.push('{projectRoot}/.storybook/**/*');
389
- }
390
- // Delete the !{projectRoot}/.storybook/**/* glob from build-storybook
391
- // because we want to rebuild Storybook if the .storybook folder changes
392
- const index = nxJson.targetDefaults['build-storybook'].inputs.indexOf('!{projectRoot}/.storybook/**/*');
393
- if (index !== -1) {
394
- nxJson.targetDefaults['build-storybook'].inputs.splice(index, 1);
395
- }
396
- if (!nxJson.targetDefaults['build-storybook'].inputs.includes('{projectRoot}/tsconfig.storybook.json')) {
397
- nxJson.targetDefaults['build-storybook'].inputs.push('{projectRoot}/tsconfig.storybook.json');
398
- }
375
+ const nxJson = (0, devkit_1.readNxJson)(tree) ?? {};
376
+ const existing = (0, internal_2.normalizeTargetDefaults)(nxJson.targetDefaults).find((e) => e.target === 'build-storybook' &&
377
+ e.executor === undefined &&
378
+ e.projects === undefined &&
379
+ e.plugin === undefined);
380
+ const inputs = existing?.inputs
381
+ ? [...existing.inputs]
382
+ : [
383
+ 'default',
384
+ nxJson.namedInputs && 'production' in nxJson.namedInputs
385
+ ? '^production'
386
+ : '^default',
387
+ ];
388
+ if (!inputs.includes('{projectRoot}/.storybook/**/*')) {
389
+ inputs.push('{projectRoot}/.storybook/**/*');
390
+ }
391
+ // Drop the negation glob so Storybook rebuilds when .storybook changes.
392
+ const negatedIndex = inputs.indexOf('!{projectRoot}/.storybook/**/*');
393
+ if (negatedIndex !== -1)
394
+ inputs.splice(negatedIndex, 1);
395
+ if (!inputs.includes('{projectRoot}/tsconfig.storybook.json')) {
396
+ inputs.push('{projectRoot}/tsconfig.storybook.json');
397
+ }
398
+ (0, internal_2.upsertTargetDefault)(tree, nxJson, {
399
+ target: 'build-storybook',
400
+ ...(setCache && existing?.cache === undefined ? { cache: true } : {}),
401
+ inputs,
402
+ });
399
403
  (0, devkit_1.updateNxJson)(tree, nxJson);
400
404
  }
401
405
  function createProjectStorybookDir(tree, projectName, uiFramework, js, tsConfiguration, root, projectType, projectIsRootProjectInStandaloneWorkspace, interactionTests, mainDir, isNextJs, usesSwc, usesVite, viteConfigFilePath, hasPlugin, viteConfigFileName, usesReactNative) {
402
- let projectDirectory = (0, ts_solution_setup_1.getProjectType)(tree, root, projectType) ===
406
+ let projectDirectory = (0, internal_3.getProjectType)(tree, root, projectType) ===
403
407
  'application'
404
408
  ? isNextJs
405
409
  ? 'components'
@@ -427,7 +431,7 @@ function createProjectStorybookDir(tree, projectName, uiFramework, js, tsConfigu
427
431
  interactionTests,
428
432
  mainDir,
429
433
  isNextJs: isNextJs &&
430
- (0, ts_solution_setup_1.getProjectType)(tree, root, projectType) ===
434
+ (0, internal_3.getProjectType)(tree, root, projectType) ===
431
435
  'application',
432
436
  usesSwc,
433
437
  usesVite,
@@ -454,7 +458,7 @@ function getTsConfigPath(tree, projectName, path) {
454
458
  const { root, projectType } = (0, devkit_1.readProjectConfiguration)(tree, projectName);
455
459
  return (0, path_1.join)(root, path?.length > 0
456
460
  ? path
457
- : (0, ts_solution_setup_1.getProjectType)(tree, root, projectType) === 'application'
461
+ : (0, internal_3.getProjectType)(tree, root, projectType) === 'application'
458
462
  ? 'tsconfig.app.json'
459
463
  : 'tsconfig.lib.json');
460
464
  }
@@ -564,7 +568,7 @@ function renameAndMoveOldTsConfig(projectRoot, pathToStorybookConfigFile, tree)
564
568
  return json;
565
569
  });
566
570
  }
567
- const eslintFile = (0, eslint_file_1.findEslintFile)(tree, projectRoot);
571
+ const eslintFile = (0, internal_1.findEslintFile)(tree, projectRoot);
568
572
  if (eslintFile) {
569
573
  const fileName = (0, devkit_1.joinPathFragments)(projectRoot, eslintFile);
570
574
  const config = tree.read(fileName, 'utf-8');
@@ -1 +1 @@
1
- {"version":3,"file":"convert-to-inferred.d.ts","sourceRoot":"","sources":["../../../../../../packages/storybook/src/generators/convert-to-inferred/convert-to-inferred.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAWpB,UAAU,MAAM;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,mDAkDlE;AAED,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"convert-to-inferred.d.ts","sourceRoot":"","sources":["../../../../../../packages/storybook/src/generators/convert-to-inferred/convert-to-inferred.ts"],"names":[],"mappings":"AAKA,OAAO,EAKL,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAOpB,UAAU,MAAM;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,mDAsDlE;AAED,eAAe,iBAAiB,CAAC"}
@@ -1,17 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.convertToInferred = convertToInferred;
4
+ const internal_1 = require("@nx/devkit/internal");
4
5
  const devkit_1 = require("@nx/devkit");
5
- const aggregate_log_util_1 = require("@nx/devkit/src/generators/plugin-migrations/aggregate-log-util");
6
- const executor_to_plugin_migrator_1 = require("@nx/devkit/src/generators/plugin-migrations/executor-to-plugin-migrator");
7
6
  const build_post_target_transformer_1 = require("./lib/build-post-target-transformer");
8
7
  const serve_post_target_transformer_1 = require("./lib/serve-post-target-transformer");
9
8
  const plugin_1 = require("../../plugins/plugin");
10
9
  const versions_1 = require("../../utils/versions");
10
+ const assert_supported_storybook_version_1 = require("../../utils/assert-supported-storybook-version");
11
11
  async function convertToInferred(tree, options) {
12
+ (0, assert_supported_storybook_version_1.assertSupportedStorybookVersion)(tree);
12
13
  const projectGraph = await (0, devkit_1.createProjectGraphAsync)();
13
- const migrationLogs = new aggregate_log_util_1.AggregatedLog();
14
- const migratedProjects = await (0, executor_to_plugin_migrator_1.migrateProjectExecutorsToPlugin)(tree, projectGraph, '@nx/storybook/plugin', plugin_1.createNodesV2, {
14
+ const migrationLogs = new internal_1.AggregatedLog();
15
+ const migratedProjects = await (0, internal_1.migrateProjectExecutorsToPlugin)(tree, projectGraph, '@nx/storybook/plugin', plugin_1.createNodesV2, {
15
16
  buildStorybookTargetName: 'build-storybook',
16
17
  serveStorybookTargetName: 'storybook',
17
18
  staticStorybookTargetName: 'static-storybook',
@@ -33,12 +34,12 @@ async function convertToInferred(tree, options) {
33
34
  },
34
35
  ], options.project);
35
36
  if (migratedProjects.size === 0) {
36
- throw new executor_to_plugin_migrator_1.NoTargetsToMigrateError();
37
+ throw new internal_1.NoTargetsToMigrateError();
37
38
  }
38
39
  if (!options.skipFormat) {
39
40
  await (0, devkit_1.formatFiles)(tree);
40
41
  }
41
- const installTask = (0, devkit_1.addDependenciesToPackageJson)(tree, {}, { storybook: versions_1.storybookVersion });
42
+ const installTask = (0, devkit_1.addDependenciesToPackageJson)(tree, {}, { storybook: versions_1.storybookVersion }, undefined, true);
42
43
  return (0, devkit_1.runTasksInSerial)(installTask, () => {
43
44
  migrationLogs.flushLogs();
44
45
  });
@@ -1,5 +1,5 @@
1
1
  import { TargetConfiguration, Tree } from '@nx/devkit';
2
- import { AggregatedLog } from '@nx/devkit/src/generators/plugin-migrations/aggregate-log-util';
2
+ import { AggregatedLog } from '@nx/devkit/internal';
3
3
  export declare function buildPostTargetTransformer(migrationLogs: AggregatedLog): (target: TargetConfiguration, tree: Tree, projectDetails: {
4
4
  projectName: string;
5
5
  root: string;
@@ -1 +1 @@
1
- {"version":3,"file":"build-post-target-transformer.d.ts","sourceRoot":"","sources":["../../../../../../../packages/storybook/src/generators/convert-to-inferred/lib/build-post-target-transformer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,mBAAmB,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAM1E,OAAO,EAAE,aAAa,EAAE,MAAM,gEAAgE,CAAC;AAW/F,wBAAgB,0BAA0B,CAAC,aAAa,EAAE,aAAa,IAEnE,QAAQ,mBAAmB,EAC3B,MAAM,IAAI,EACV,gBAAgB;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EACrD,6BAA6B,mBAAmB,8BAgHnD"}
1
+ {"version":3,"file":"build-post-target-transformer.d.ts","sourceRoot":"","sources":["../../../../../../../packages/storybook/src/generators/convert-to-inferred/lib/build-post-target-transformer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,mBAAmB,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,EAGL,aAAa,EACd,MAAM,qBAAqB,CAAC;AAW7B,wBAAgB,0BAA0B,CAAC,aAAa,EAAE,aAAa,IAEnE,QAAQ,mBAAmB,EAC3B,MAAM,IAAI,EACV,gBAAgB;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EACrD,6BAA6B,mBAAmB,8BAgHnD"}
@@ -2,10 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.buildPostTargetTransformer = buildPostTargetTransformer;
4
4
  const devkit_1 = require("@nx/devkit");
5
- const plugin_migration_utils_1 = require("@nx/devkit/src/generators/plugin-migrations/plugin-migration-utils");
5
+ const internal_1 = require("@nx/devkit/internal");
6
6
  const tsquery_1 = require("@phenomnomnominal/tsquery");
7
7
  const utils_1 = require("./utils");
8
- const utils_2 = require("./utils");
9
8
  function buildPostTargetTransformer(migrationLogs) {
10
9
  return (target, tree, projectDetails, inferredTargetConfiguration) => {
11
10
  let defaultConfigDir = (0, devkit_1.joinPathFragments)(projectDetails.root, '.storybook');
@@ -28,7 +27,7 @@ function buildPostTargetTransformer(migrationLogs) {
28
27
  const configuration = target.configurations[configurationName];
29
28
  if (configuration.configDir &&
30
29
  configuration.configDir !==
31
- (0, plugin_migration_utils_1.toProjectRelativePath)(defaultConfigDir, projectDetails.root)) {
30
+ (0, internal_1.toProjectRelativePath)(defaultConfigDir, projectDetails.root)) {
32
31
  const configFilePath = (0, utils_1.getConfigFilePath)(tree, (0, devkit_1.joinPathFragments)(projectDetails.root, configuration.configDir));
33
32
  (0, utils_1.addConfigValuesToConfigFile)(tree, configFilePath, configValues);
34
33
  (0, utils_1.ensureViteConfigPathIsRelative)(tree, configFilePath, projectDetails.projectName, projectDetails.root, '@nx/storybook:build', migrationLogs);
@@ -50,7 +49,7 @@ function buildPostTargetTransformer(migrationLogs) {
50
49
  }
51
50
  }
52
51
  if (target.outputs) {
53
- (0, plugin_migration_utils_1.processTargetOutputs)(target, [{ newName: 'output-dir', oldName: 'outputDir' }], inferredTargetConfiguration, {
52
+ (0, internal_1.processTargetOutputs)(target, [{ newName: 'output-dir', oldName: 'outputDir' }], inferredTargetConfiguration, {
54
53
  projectName: projectDetails.projectName,
55
54
  projectRoot: projectDetails.root,
56
55
  });
@@ -66,10 +65,10 @@ function handlePropertiesFromTargetOptions(tree, options, defaultConfigDir, proj
66
65
  if (options.configDir !== defaultConfigDir) {
67
66
  configDir = options.configDir;
68
67
  }
69
- options.configDir = (0, plugin_migration_utils_1.toProjectRelativePath)(options.configDir, projectRoot);
68
+ options.configDir = (0, internal_1.toProjectRelativePath)(options.configDir, projectRoot);
70
69
  }
71
70
  if (options.outputDir) {
72
- options.outputDir = (0, plugin_migration_utils_1.toProjectRelativePath)(options.outputDir, projectRoot);
71
+ options.outputDir = (0, internal_1.toProjectRelativePath)(options.outputDir, projectRoot);
73
72
  }
74
73
  if ('styles' in options) {
75
74
  delete options.styles;
@@ -87,9 +86,7 @@ function handlePropertiesFromTargetOptions(tree, options, defaultConfigDir, proj
87
86
  moveStaticDirToConfigFile(tree, configDir, projectName, migrationLogs, configDir === defaultConfigDir);
88
87
  delete options.staticDir;
89
88
  }
90
- const storybookPropMappings = (0, utils_2.getInstalledPackageVersionInfo)(tree, 'storybook')?.major === 8
91
- ? utils_1.STORYBOOK_PROP_MAPPINGS.v8
92
- : utils_1.STORYBOOK_PROP_MAPPINGS.v7;
89
+ const storybookPropMappings = (0, utils_1.getStorybookPropMappings)(tree);
93
90
  for (const [prevKey, newKey] of Object.entries(storybookPropMappings)) {
94
91
  if (prevKey in options) {
95
92
  let prevValue = options[prevKey];
@@ -1,5 +1,5 @@
1
1
  import { TargetConfiguration, Tree } from '@nx/devkit';
2
- import { AggregatedLog } from '@nx/devkit/src/generators/plugin-migrations/aggregate-log-util';
2
+ import { AggregatedLog } from '@nx/devkit/internal';
3
3
  export declare function servePostTargetTransformer(migrationLogs: AggregatedLog): (target: TargetConfiguration, tree: Tree, projectDetails: {
4
4
  projectName: string;
5
5
  root: string;
@@ -1 +1 @@
1
- {"version":3,"file":"serve-post-target-transformer.d.ts","sourceRoot":"","sources":["../../../../../../../packages/storybook/src/generators/convert-to-inferred/lib/serve-post-target-transformer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,mBAAmB,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,gEAAgE,CAAC;AAQ/F,wBAAgB,0BAA0B,CAAC,aAAa,EAAE,aAAa,IAEnE,QAAQ,mBAAmB,EAC3B,MAAM,IAAI,EACV,gBAAgB;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EACrD,6BAA6B,mBAAmB,8BAyEnD"}
1
+ {"version":3,"file":"serve-post-target-transformer.d.ts","sourceRoot":"","sources":["../../../../../../../packages/storybook/src/generators/convert-to-inferred/lib/serve-post-target-transformer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,mBAAmB,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAyB,MAAM,qBAAqB,CAAC;AAM3E,wBAAgB,0BAA0B,CAAC,aAAa,EAAE,aAAa,IAEnE,QAAQ,mBAAmB,EAC3B,MAAM,IAAI,EACV,gBAAgB;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EACrD,6BAA6B,mBAAmB,8BAyEnD"}
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.servePostTargetTransformer = servePostTargetTransformer;
4
4
  const devkit_1 = require("@nx/devkit");
5
- const plugin_migration_utils_1 = require("@nx/devkit/src/generators/plugin-migrations/plugin-migration-utils");
5
+ const internal_1 = require("@nx/devkit/internal");
6
6
  const utils_1 = require("./utils");
7
7
  function servePostTargetTransformer(migrationLogs) {
8
8
  return (target, tree, projectDetails, inferredTargetConfiguration) => {
@@ -39,10 +39,10 @@ function servePostTargetTransformer(migrationLogs) {
39
39
  }
40
40
  function handlePropertiesFromTargetOptions(tree, options, projectName, projectRoot, migrationLogs) {
41
41
  if ('configDir' in options) {
42
- options.configDir = (0, plugin_migration_utils_1.toProjectRelativePath)(options.configDir, projectRoot);
42
+ options.configDir = (0, internal_1.toProjectRelativePath)(options.configDir, projectRoot);
43
43
  }
44
44
  if (options.outputDir) {
45
- options.outputDir = (0, plugin_migration_utils_1.toProjectRelativePath)(options.outputDir, projectRoot);
45
+ options.outputDir = (0, internal_1.toProjectRelativePath)(options.outputDir, projectRoot);
46
46
  }
47
47
  if ('uiFramework' in options) {
48
48
  delete options.uiFramework;
@@ -80,9 +80,7 @@ function handlePropertiesFromTargetOptions(tree, options, projectName, projectRo
80
80
  options.docs = options.docsMode;
81
81
  delete options.docsMode;
82
82
  }
83
- const storybookPropMappings = (0, utils_1.getInstalledPackageVersionInfo)(tree, 'storybook')?.major === 8
84
- ? utils_1.STORYBOOK_PROP_MAPPINGS.v8
85
- : utils_1.STORYBOOK_PROP_MAPPINGS.v7;
83
+ const storybookPropMappings = (0, utils_1.getStorybookPropMappings)(tree);
86
84
  for (const [prevKey, newKey] of Object.entries(storybookPropMappings)) {
87
85
  if (prevKey in options) {
88
86
  let prevValue = options[prevKey];