@nx/storybook 23.0.0-beta.15 → 23.0.0-beta.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/migrations.json CHANGED
@@ -19,7 +19,8 @@
19
19
  "storybook": ">=10.0.0"
20
20
  },
21
21
  "description": "Update workspace to use Storybook v10",
22
- "implementation": "./src/migrations/update-22-1-0/migrate-to-storybook-10"
22
+ "implementation": "./src/migrations/update-22-1-0/migrate-to-storybook-10",
23
+ "prompt": "./src/generators/migrate-10/files/ai-instructions-for-cjs-esm.md"
23
24
  }
24
25
  },
25
26
  "packageJsonUpdates": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/storybook",
3
- "version": "23.0.0-beta.15",
3
+ "version": "23.0.0-beta.17",
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,20 +34,20 @@
34
34
  "migrations": "./migrations.json"
35
35
  },
36
36
  "dependencies": {
37
- "@nx/devkit": "23.0.0-beta.15",
37
+ "@nx/devkit": "23.0.0-beta.17",
38
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.15",
42
- "@nx/js": "23.0.0-beta.15",
43
- "@nx/eslint": "23.0.0-beta.15"
41
+ "@nx/cypress": "23.0.0-beta.17",
42
+ "@nx/js": "23.0.0-beta.17",
43
+ "@nx/eslint": "23.0.0-beta.17"
44
44
  },
45
45
  "devDependencies": {
46
- "nx": "23.0.0-beta.15",
46
+ "nx": "23.0.0-beta.17",
47
47
  "storybook": "9.0.6"
48
48
  },
49
49
  "peerDependencies": {
50
- "@nx/web": "23.0.0-beta.15",
50
+ "@nx/web": "23.0.0-beta.17",
51
51
  "storybook": ">=7.0.0 <11.0.0"
52
52
  },
53
53
  "peerDependenciesMeta": {
@@ -1 +1 @@
1
- {"version":3,"file":"util-functions.d.ts","sourceRoot":"","sources":["../../../../../../../packages/storybook/src/generators/configuration/lib/util-functions.ts"],"names":[],"mappings":"AAAA,OAAO,EAWL,IAAI,EAML,MAAM,YAAY,CAAC;AASpB,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAgBpD,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,WAAW,EACxB,gBAAgB,EAAE,OAAO,QAwC1B;AAED,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,MAAM,EACnB,gBAAgB,EAAE,OAAO,QAmD1B;AAED,wBAAsB,eAAe,CACnC,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,wBAAwB,iBAqB/B;AAED,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,OAAO,EACtB,OAAO,EAAE,YAAY,GAAG,KAAK,QAuH9B;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,IAAI,QAe9C;AAED,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,wBAAwB,QAoCjC;AAED,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,wBAAwB,QAqCjC;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,wBAAwB,QAqE5E;AAED,wBAAgB,eAAe,CAC7B,MAAM,EAAE,wBAAwB,GAC/B,wBAAwB,CAU1B;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,IAAI,QAoCnD;AAED,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ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;AAED,wBAAgB,wBAAwB,CACtC,WAAW,EAAE,MAAM,EACnB,yBAAyB,EAAE,MAAM,EACjC,IAAI,EAAE,IAAI,QAmEX"}
1
+ {"version":3,"file":"util-functions.d.ts","sourceRoot":"","sources":["../../../../../../../packages/storybook/src/generators/configuration/lib/util-functions.ts"],"names":[],"mappings":"AAAA,OAAO,EAWL,IAAI,EAML,MAAM,YAAY,CAAC;AASpB,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAepD,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,WAAW,EACxB,gBAAgB,EAAE,OAAO,QAwC1B;AAED,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,MAAM,EACnB,gBAAgB,EAAE,OAAO,QAmD1B;AAED,wBAAsB,eAAe,CACnC,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,wBAAwB,iBAqB/B;AAED,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,OAAO,EACtB,OAAO,EAAE,YAAY,GAAG,KAAK,QAuH9B;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,IAAI,QAe9C;AAED,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,wBAAwB,QAoCjC;AAED,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,wBAAwB,QAqCjC;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,wBAAwB,QAqE5E;AAED,wBAAgB,eAAe,CAC7B,MAAM,EAAE,wBAAwB,GAC/B,wBAAwB,CAU1B;AAED,wBAAgB,yBAAyB,CAAC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M,GAAG,SAAS,CASpB;AAED,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAS/D;AAED,wBAAgB,wBAAwB,CACtC,WAAW,EAAE,MAAM,EACnB,yBAAyB,EAAE,MAAM,EACjC,IAAI,EAAE,IAAI,QAmEX"}
@@ -25,10 +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 internal_1 = require("@nx/devkit/internal");
31
- const internal_2 = require("@nx/js/internal");
28
+ const internal_1 = require("@nx/eslint/internal");
29
+ const internal_2 = require("@nx/devkit/internal");
30
+ const internal_3 = require("@nx/js/internal");
32
31
  const DEFAULT_PORT = 4400;
33
32
  function addStorybookTarget(tree, projectName, uiFramework, interactionTests) {
34
33
  const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, projectName);
@@ -127,7 +126,7 @@ async function addStaticTarget(tree, opts) {
127
126
  function createStorybookTsconfigFile(tree, projectRoot, uiFramework, isRootProject, mainDir) {
128
127
  const storybookMajorVersion = (0, utilities_1.storybookMajorVersion)(tree);
129
128
  const offset = (0, devkit_1.offsetFromRoot)(projectRoot);
130
- const useTsSolution = (0, internal_2.isUsingTsSolutionSetup)(tree);
129
+ const useTsSolution = (0, internal_3.isUsingTsSolutionSetup)(tree);
131
130
  // First let's check if old configuration file exists
132
131
  // If it exists, let's rename it and move it to the new location
133
132
  const oldStorybookTsConfigPath = (0, devkit_1.joinPathFragments)(projectRoot, '.storybook/tsconfig.json');
@@ -176,7 +175,7 @@ function createStorybookTsconfigFile(tree, projectRoot, uiFramework, isRootProje
176
175
  ],
177
176
  };
178
177
  if (useTsSolution) {
179
- const runtimeConfig = (0, internal_2.findRuntimeTsConfigName)(projectRoot, tree);
178
+ const runtimeConfig = (0, internal_3.findRuntimeTsConfigName)(projectRoot, tree);
180
179
  if (runtimeConfig) {
181
180
  storybookTsConfig.references ??= [];
182
181
  storybookTsConfig.references.push({
@@ -288,14 +287,14 @@ function configureTsSolutionConfig(tree, schema) {
288
287
  function updateLintConfig(tree, schema) {
289
288
  const { project: projectName } = schema;
290
289
  const { root } = (0, devkit_1.readProjectConfiguration)(tree, projectName);
291
- const eslintFile = (0, eslint_file_1.findEslintFile)(tree, root);
290
+ const eslintFile = (0, internal_1.findEslintFile)(tree, root);
292
291
  if (!eslintFile) {
293
292
  return;
294
293
  }
295
294
  const parserConfigPath = (0, path_1.join)(root, schema.uiFramework === '@storybook/angular'
296
295
  ? '.storybook/tsconfig.json'
297
296
  : 'tsconfig.storybook.json');
298
- if ((0, flat_config_1.useFlatConfig)(tree)) {
297
+ if ((0, internal_1.useFlatConfig)(tree)) {
299
298
  let config = tree.read(eslintFile, 'utf-8');
300
299
  const projectRegex = RegExp(/project:\s?\[?['"](.*)['"]\]?/g);
301
300
  let match;
@@ -374,7 +373,7 @@ function addStorybookToNamedInputs(tree) {
374
373
  }
375
374
  function addStorybookToTargetDefaults(tree, setCache = true) {
376
375
  const nxJson = (0, devkit_1.readNxJson)(tree) ?? {};
377
- const existing = (0, internal_1.normalizeTargetDefaults)(nxJson.targetDefaults).find((e) => e.target === 'build-storybook' &&
376
+ const existing = (0, internal_2.normalizeTargetDefaults)(nxJson.targetDefaults).find((e) => e.target === 'build-storybook' &&
378
377
  e.executor === undefined &&
379
378
  e.projects === undefined &&
380
379
  e.plugin === undefined);
@@ -396,7 +395,7 @@ function addStorybookToTargetDefaults(tree, setCache = true) {
396
395
  if (!inputs.includes('{projectRoot}/tsconfig.storybook.json')) {
397
396
  inputs.push('{projectRoot}/tsconfig.storybook.json');
398
397
  }
399
- (0, internal_1.upsertTargetDefault)(tree, nxJson, {
398
+ (0, internal_2.upsertTargetDefault)(tree, nxJson, {
400
399
  target: 'build-storybook',
401
400
  ...(setCache && existing?.cache === undefined ? { cache: true } : {}),
402
401
  inputs,
@@ -404,7 +403,7 @@ function addStorybookToTargetDefaults(tree, setCache = true) {
404
403
  (0, devkit_1.updateNxJson)(tree, nxJson);
405
404
  }
406
405
  function createProjectStorybookDir(tree, projectName, uiFramework, js, tsConfiguration, root, projectType, projectIsRootProjectInStandaloneWorkspace, interactionTests, mainDir, isNextJs, usesSwc, usesVite, viteConfigFilePath, hasPlugin, viteConfigFileName, usesReactNative) {
407
- let projectDirectory = (0, internal_2.getProjectType)(tree, root, projectType) ===
406
+ let projectDirectory = (0, internal_3.getProjectType)(tree, root, projectType) ===
408
407
  'application'
409
408
  ? isNextJs
410
409
  ? 'components'
@@ -432,7 +431,7 @@ function createProjectStorybookDir(tree, projectName, uiFramework, js, tsConfigu
432
431
  interactionTests,
433
432
  mainDir,
434
433
  isNextJs: isNextJs &&
435
- (0, internal_2.getProjectType)(tree, root, projectType) ===
434
+ (0, internal_3.getProjectType)(tree, root, projectType) ===
436
435
  'application',
437
436
  usesSwc,
438
437
  usesVite,
@@ -459,7 +458,7 @@ function getTsConfigPath(tree, projectName, path) {
459
458
  const { root, projectType } = (0, devkit_1.readProjectConfiguration)(tree, projectName);
460
459
  return (0, path_1.join)(root, path?.length > 0
461
460
  ? path
462
- : (0, internal_2.getProjectType)(tree, root, projectType) === 'application'
461
+ : (0, internal_3.getProjectType)(tree, root, projectType) === 'application'
463
462
  ? 'tsconfig.app.json'
464
463
  : 'tsconfig.lib.json');
465
464
  }
@@ -569,7 +568,7 @@ function renameAndMoveOldTsConfig(projectRoot, pathToStorybookConfigFile, tree)
569
568
  return json;
570
569
  });
571
570
  }
572
- const eslintFile = (0, eslint_file_1.findEslintFile)(tree, projectRoot);
571
+ const eslintFile = (0, internal_1.findEslintFile)(tree, projectRoot);
573
572
  if (eslintFile) {
574
573
  const fileName = (0, devkit_1.joinPathFragments)(projectRoot, eslintFile);
575
574
  const config = tree.read(fileName, 'utf-8');
@@ -1 +1 @@
1
- {"version":3,"file":"migrate-10.d.ts","sourceRoot":"","sources":["../../../../../../packages/storybook/src/generators/migrate-10/migrate-10.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,IAAI,EAAE,MAAM,YAAY,CAAC;AAIjE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAIlC,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,iBA+BlE;AAED,eAAe,kBAAkB,CAAC"}
1
+ {"version":3,"file":"migrate-10.d.ts","sourceRoot":"","sources":["../../../../../../packages/storybook/src/generators/migrate-10/migrate-10.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,IAAI,EAAE,MAAM,YAAY,CAAC;AAIjE,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAIlC,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,iBAmClE;AAED,eAAe,kBAAkB,CAAC"}
@@ -19,6 +19,9 @@ async function migrate10Generator(tree, schema) {
19
19
  return;
20
20
  }
21
21
  (0, calling_storybook_cli_1.callUpgrade)(schema);
22
+ if (schema.skipAiInstructions) {
23
+ return;
24
+ }
22
25
  const pathToAiInstructions = (0, path_1.join)(__dirname, 'files', 'ai-instructions-for-cjs-esm.md');
23
26
  if (!(0, fs_1.existsSync)(pathToAiInstructions)) {
24
27
  return;
@@ -1,4 +1,5 @@
1
1
  export interface Schema {
2
2
  autoAcceptAllPrompts?: boolean;
3
3
  configDirs?: string[];
4
+ skipAiInstructions?: boolean;
4
5
  }
@@ -14,6 +14,11 @@
14
14
  "type": "array",
15
15
  "description": "Directory(ies) where to load Storybook configurations from. Use this if you want to customize the Storybook projects you'd like to migrate.",
16
16
  "default": []
17
+ },
18
+ "skipAiInstructions": {
19
+ "type": "boolean",
20
+ "description": "Skip writing the AI migration instructions file to `tools/ai-migrations/`.",
21
+ "default": false
17
22
  }
18
23
  },
19
24
  "examplesFile": "../../../docs/migrate-10-generator-examples.md"
@@ -1,3 +1,3 @@
1
1
  import { Tree } from '@nx/devkit';
2
- export default function migrateToStorybook10(tree: Tree): Promise<string[]>;
2
+ export default function migrateToStorybook10(tree: Tree): Promise<void>;
3
3
  //# sourceMappingURL=migrate-to-storybook-10.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"migrate-to-storybook-10.d.ts","sourceRoot":"","sources":["../../../../../../packages/storybook/src/migrations/update-22-1-0/migrate-to-storybook-10.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAOlC,wBAA8B,oBAAoB,CAAC,IAAI,EAAE,IAAI,qBAkB5D"}
1
+ {"version":3,"file":"migrate-to-storybook-10.d.ts","sourceRoot":"","sources":["../../../../../../packages/storybook/src/migrations/update-22-1-0/migrate-to-storybook-10.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAIlC,wBAA8B,oBAAoB,CAAC,IAAI,EAAE,IAAI,iBAc5D"}
@@ -16,9 +16,6 @@ async function migrateToStorybook10(tree) {
16
16
  });
17
17
  await (0, migrate_10_1.default)(tree, {
18
18
  autoAcceptAllPrompts: true,
19
+ skipAiInstructions: true,
19
20
  });
20
- return [
21
- `Storybook 10 requires Storybook Configs to use ESM.`,
22
- `We created 'tools/ai-migrations/MIGRATE_STORYBOOK_10.md' with instructions for an AI Agent to convert CJS Storybook Configs to ESM in your workspace.`,
23
- ];
24
21
  }