@nx/storybook 16.10.0 → 17.0.0-beta.2

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 (32) hide show
  1. package/migrations.json +0 -171
  2. package/package.json +6 -7
  3. package/src/executors/build-storybook/build-storybook.impl.d.ts +1 -2
  4. package/src/executors/build-storybook/build-storybook.impl.js +13 -47
  5. package/src/executors/build-storybook/schema.json +0 -13
  6. package/src/executors/storybook/storybook.impl.d.ts +1 -2
  7. package/src/executors/storybook/storybook.impl.js +18 -45
  8. package/src/generators/configuration/configuration.js +1 -1
  9. package/src/generators/configuration/lib/util-functions.d.ts +6 -7
  10. package/src/generators/configuration/lib/util-functions.js +3 -11
  11. package/src/generators/configuration/schema.d.ts +2 -2
  12. package/src/generators/init/init.js +5 -12
  13. package/src/generators/init/schema.d.ts +2 -2
  14. package/src/generators/migrate-7/schema.d.ts +0 -2
  15. package/src/utils/models.d.ts +1 -4
  16. package/src/utils/utilities.js +3 -2
  17. package/src/executors/utils.d.ts +0 -6
  18. package/src/executors/utils.js +0 -132
  19. package/src/migrations/update-13-4-6/set-project-build-config.d.ts +0 -2
  20. package/src/migrations/update-13-4-6/set-project-build-config.js +0 -56
  21. package/src/migrations/update-14-0-0/migrate-defaults-5-to-6/migrate-defaults-5-to-6.d.ts +0 -6
  22. package/src/migrations/update-14-0-0/migrate-defaults-5-to-6/migrate-defaults-5-to-6.js +0 -117
  23. package/src/migrations/update-14-0-0/migrate-stories-to-6-2/migrate-stories-to-6-2.d.ts +0 -8
  24. package/src/migrations/update-14-0-0/migrate-stories-to-6-2/migrate-stories-to-6-2.js +0 -316
  25. package/src/migrations/update-14-0-0/migrate-to-storybook-6.d.ts +0 -2
  26. package/src/migrations/update-14-0-0/migrate-to-storybook-6.js +0 -9
  27. package/src/migrations/update-14-1-8/change-storybook-targets-generator.d.ts +0 -4
  28. package/src/migrations/update-14-1-8/change-storybook-targets-generator.js +0 -104
  29. package/src/migrations/update-14-1-8/change-storybook-targets.d.ts +0 -2
  30. package/src/migrations/update-14-1-8/change-storybook-targets.js +0 -7
  31. package/src/utils/test-configs/.storybook/main.js +0 -8
  32. package/src/utils/test-configs/.storybook/tsconfig.json +0 -19
package/migrations.json CHANGED
@@ -1,23 +1,5 @@
1
1
  {
2
2
  "generators": {
3
- "update-13.4.6": {
4
- "version": "13.4.6-beta.1",
5
- "cli": "nx",
6
- "description": "Add projectBuildConfig option to project's Storybook config.",
7
- "factory": "./src/migrations/update-13-4-6/set-project-build-config"
8
- },
9
- "update-14.0.0": {
10
- "version": "14.0.0",
11
- "cli": "nx",
12
- "description": "Migrate Storybook to v6",
13
- "factory": "./src/migrations/update-14-0-0/migrate-to-storybook-6"
14
- },
15
- "update-14.1.8": {
16
- "version": "14.1.8",
17
- "cli": "nx",
18
- "description": "Change storybook targets for Angular projects to use @storybook/angular executors",
19
- "factory": "./src/migrations/update-14-1-8/change-storybook-targets"
20
- },
21
3
  "update-15.0.8-add-storybook-inputs": {
22
4
  "cli": "nx",
23
5
  "version": "15.0.0-beta.0",
@@ -741,159 +723,6 @@
741
723
  "alwaysAddToPackageJson": false
742
724
  }
743
725
  }
744
- },
745
- "14.3.2": {
746
- "version": "14.3.2-beta.1",
747
- "packages": {
748
- "@storybook/core-server": {
749
- "version": "~6.5.9",
750
- "alwaysAddToPackageJson": true
751
- },
752
- "@storybook/angular": {
753
- "version": "~6.5.9",
754
- "alwaysAddToPackageJson": false
755
- },
756
- "@storybook/react": {
757
- "version": "~6.5.9",
758
- "alwaysAddToPackageJson": false
759
- },
760
- "@storybook/web": {
761
- "version": "~6.5.9",
762
- "alwaysAddToPackageJson": false
763
- },
764
- "@storybook/addon-essentials": {
765
- "version": "~6.5.9",
766
- "alwaysAddToPackageJson": false
767
- },
768
- "@storybook/builder-webpack5": {
769
- "version": "~6.5.9",
770
- "alwaysAddToPackageJson": true
771
- },
772
- "@storybook/manager-webpack5": {
773
- "version": "~6.5.9",
774
- "alwaysAddToPackageJson": true
775
- }
776
- }
777
- },
778
- "14.2.0": {
779
- "version": "14.2.0-beta.6",
780
- "packages": {
781
- "@storybook/core-server": {
782
- "version": "~6.5.4",
783
- "alwaysAddToPackageJson": true
784
- },
785
- "@storybook/angular": {
786
- "version": "~6.5.4",
787
- "alwaysAddToPackageJson": false
788
- },
789
- "@storybook/react": {
790
- "version": "~6.5.4",
791
- "alwaysAddToPackageJson": false
792
- },
793
- "@storybook/web": {
794
- "version": "~6.5.4",
795
- "alwaysAddToPackageJson": false
796
- },
797
- "@storybook/addon-essentials": {
798
- "version": "~6.5.4",
799
- "alwaysAddToPackageJson": false
800
- },
801
- "@storybook/builder-webpack5": {
802
- "version": "~6.5.4",
803
- "alwaysAddToPackageJson": true
804
- },
805
- "@storybook/manager-webpack5": {
806
- "version": "~6.5.4",
807
- "alwaysAddToPackageJson": true
808
- }
809
- }
810
- },
811
- "13.10.0": {
812
- "version": "13.10.0-beta.0",
813
- "packages": {
814
- "@storybook/core-server": {
815
- "version": "~6.4.12",
816
- "alwaysAddToPackageJson": true
817
- },
818
- "@storybook/react-native": {
819
- "version": "^6.0.1-beta.5",
820
- "alwaysAddToPackageJson": false
821
- },
822
- "@storybook/addon-ondevice-actions": {
823
- "version": "^6.0.1-beta.5",
824
- "alwaysAddToPackageJson": false
825
- },
826
- "@storybook/addon-ondevice-backgrounds": {
827
- "version": "^6.0.1-beta.5",
828
- "alwaysAddToPackageJson": false
829
- },
830
- "@storybook/addon-ondevice-controls": {
831
- "version": "^6.0.1-beta.5",
832
- "alwaysAddToPackageJson": false
833
- },
834
- "@storybook/addon-ondevice-notes": {
835
- "version": "^6.0.1-beta.5",
836
- "alwaysAddToPackageJson": false
837
- }
838
- }
839
- },
840
- "13.4.5": {
841
- "version": "13.4.5-beta.1",
842
- "packages": {
843
- "@storybook/angular": {
844
- "version": "~6.4.12",
845
- "alwaysAddToPackageJson": false
846
- },
847
- "@storybook/react": {
848
- "version": "~6.4.12",
849
- "alwaysAddToPackageJson": false
850
- },
851
- "@storybook/web": {
852
- "version": "~6.4.12",
853
- "alwaysAddToPackageJson": false
854
- },
855
- "@storybook/addon-essentials": {
856
- "version": "~6.4.12",
857
- "alwaysAddToPackageJson": false
858
- },
859
- "@storybook/builder-webpack5": {
860
- "version": "~6.4.12",
861
- "alwaysAddToPackageJson": true
862
- },
863
- "@storybook/manager-webpack5": {
864
- "version": "~6.4.12",
865
- "alwaysAddToPackageJson": true
866
- }
867
- }
868
- },
869
- "13.3.0": {
870
- "version": "13.3.0-beta.3",
871
- "packages": {
872
- "@storybook/angular": {
873
- "version": "~6.4.5",
874
- "alwaysAddToPackageJson": false
875
- },
876
- "@storybook/react": {
877
- "version": "~6.4.5",
878
- "alwaysAddToPackageJson": false
879
- },
880
- "@storybook/web": {
881
- "version": "~6.4.5",
882
- "alwaysAddToPackageJson": false
883
- },
884
- "@storybook/addon-essentials": {
885
- "version": "~6.4.5",
886
- "alwaysAddToPackageJson": false
887
- },
888
- "@storybook/builder-webpack5": {
889
- "version": "~6.4.5",
890
- "alwaysAddToPackageJson": true
891
- },
892
- "@storybook/manager-webpack5": {
893
- "version": "~6.4.5",
894
- "alwaysAddToPackageJson": true
895
- }
896
- }
897
726
  }
898
727
  }
899
728
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/storybook",
3
- "version": "16.10.0",
3
+ "version": "17.0.0-beta.2",
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": {
@@ -33,12 +33,11 @@
33
33
  "@phenomnomnominal/tsquery": "~5.0.1",
34
34
  "semver": "7.5.3",
35
35
  "tslib": "^2.3.0",
36
- "@nx/cypress": "16.10.0",
37
- "@nx/devkit": "16.10.0",
38
- "@nx/js": "16.10.0",
39
- "@nx/linter": "16.10.0",
40
- "@nx/workspace": "16.10.0",
41
- "@nrwl/storybook": "16.10.0"
36
+ "@nx/cypress": "17.0.0-beta.2",
37
+ "@nx/devkit": "17.0.0-beta.2",
38
+ "@nx/js": "17.0.0-beta.2",
39
+ "@nx/linter": "17.0.0-beta.2",
40
+ "@nrwl/storybook": "17.0.0-beta.2"
42
41
  },
43
42
  "publishConfig": {
44
43
  "access": "public"
@@ -1,6 +1,5 @@
1
1
  import { ExecutorContext } from '@nx/devkit';
2
2
  import { CLIOptions } from '@storybook/types';
3
- import { CommonNxStorybookConfig } from '../../utils/models';
4
- export default function buildStorybookExecutor(options: CLIOptions & CommonNxStorybookConfig, context: ExecutorContext): Promise<{
3
+ export default function buildStorybookExecutor(options: CLIOptions, context: ExecutorContext): Promise<{
5
4
  success: boolean;
6
5
  }>;
@@ -3,59 +3,25 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const devkit_1 = require("@nx/devkit");
4
4
  const build = require("@storybook/core-server");
5
5
  const utilities_1 = require("../../utils/utilities");
6
- const utils_1 = require("../utils");
7
6
  async function buildStorybookExecutor(options, context) {
8
7
  (0, utilities_1.storybookConfigExistsCheck)(options.configDir, context.projectName);
9
8
  const storybook7 = (0, utilities_1.storybookMajorVersion)() === 7;
10
- if (storybook7) {
11
- const buildOptions = options;
12
- devkit_1.logger.info(`NX Storybook builder starting ...`);
13
- await runInstance(buildOptions, storybook7);
14
- devkit_1.logger.info(`NX Storybook builder finished ...`);
15
- devkit_1.logger.info(`NX Storybook files available in ${buildOptions.outputDir}`);
16
- return { success: true };
17
- }
18
- else {
19
- // TODO(katerina): Remove Nx17
20
- // print warnings
21
- (0, utils_1.runStorybookSetupCheck)(options);
22
- devkit_1.logger.error((0, utilities_1.pleaseUpgrade)());
23
- const frameworkPath = (0, utils_1.getStorybookFrameworkPath)(options.uiFramework);
24
- const { default: frameworkOptions } = await Promise.resolve(`${frameworkPath}`).then(s => require(s));
25
- const buildOptions = {
26
- ...options,
27
- ...frameworkOptions,
28
- frameworkPresets: [...(frameworkOptions.frameworkPresets || [])],
29
- };
30
- devkit_1.logger.info(`NX Storybook builder starting ...`);
31
- await runInstance(buildOptions, storybook7);
32
- devkit_1.logger.info(`NX Storybook builder finished ...`);
33
- devkit_1.logger.info(`NX Storybook files available in ${buildOptions.outputDir}`);
34
- return { success: true };
9
+ if (!storybook7) {
10
+ throw (0, utilities_1.pleaseUpgrade)();
35
11
  }
12
+ const buildOptions = options;
13
+ devkit_1.logger.info(`NX Storybook builder starting ...`);
14
+ await runInstance(buildOptions);
15
+ devkit_1.logger.info(`NX Storybook builder finished ...`);
16
+ devkit_1.logger.info(`NX Storybook files available in ${buildOptions.outputDir}`);
17
+ return { success: true };
36
18
  }
37
19
  exports.default = buildStorybookExecutor;
38
- function runInstance(options, storybook7) {
20
+ function runInstance(options) {
39
21
  const env = process.env.NODE_ENV ?? 'production';
40
22
  process.env.NODE_ENV = env;
41
- if (storybook7) {
42
- return build.build({
43
- ...options,
44
- mode: 'static',
45
- });
46
- }
47
- else {
48
- // TODO(katerina): Remove Nx17
49
- const nodeVersion = process.version.slice(1).split('.');
50
- if (+nodeVersion[0] === 18) {
51
- devkit_1.logger.warn(`
52
- If you are using the @storybook/builder-vite you may experience issues with Node 18.
53
- Please use Node 16 if you are using @storybook/builder-vite.
54
- `);
55
- }
56
- return build.buildStaticStandalone({
57
- ...options,
58
- ci: true,
59
- });
60
- }
23
+ return build.build({
24
+ ...options,
25
+ mode: 'static',
26
+ });
61
27
  }
@@ -69,19 +69,6 @@
69
69
  "type": "boolean",
70
70
  "description": "Starts Storybook in documentation mode. Learn more about it : https://storybook.js.org/docs/react/writing-docs/build-documentation#preview-storybooks-documentation."
71
71
  },
72
- "uiFramework": {
73
- "type": "string",
74
- "description": "Storybook framework npm package.",
75
- "enum": [
76
- "@storybook/react",
77
- "@storybook/html",
78
- "@storybook/web-components",
79
- "@storybook/vue",
80
- "@storybook/vue3",
81
- "@storybook/svelte"
82
- ],
83
- "x-deprecated": "Upgrade to Storybook 7."
84
- },
85
72
  "webpackStatsJson": {
86
73
  "type": ["boolean", "string"],
87
74
  "description": "Write Webpack Stats JSON to disk.",
@@ -1,7 +1,6 @@
1
1
  import { ExecutorContext } from '@nx/devkit';
2
2
  import { CLIOptions } from '@storybook/types';
3
- import { CommonNxStorybookConfig } from '../../utils/models';
4
- export default function storybookExecutor(options: CLIOptions & CommonNxStorybookConfig, context: ExecutorContext): AsyncGenerator<{
3
+ export default function storybookExecutor(options: CLIOptions, context: ExecutorContext): AsyncGenerator<{
5
4
  success: boolean;
6
5
  info?: {
7
6
  port: number;
@@ -1,57 +1,30 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const devkit_1 = require("@nx/devkit");
4
3
  const build = require("@storybook/core-server");
5
4
  const utilities_1 = require("../../utils/utilities");
6
- const utils_1 = require("../utils");
7
5
  async function* storybookExecutor(options, context) {
8
6
  const storybook7 = (0, utilities_1.storybookMajorVersion)() === 7;
9
- (0, utilities_1.storybookConfigExistsCheck)(options.configDir, context.projectName);
10
- if (storybook7) {
11
- const buildOptions = options;
12
- const result = await runInstance(buildOptions, storybook7);
13
- yield {
14
- success: true,
15
- info: {
16
- port: result?.['port'],
17
- baseUrl: `${options.https ? 'https' : 'http'}://${options.host ?? 'localhost'}:${result?.['port']}`,
18
- },
19
- };
20
- await new Promise(() => { });
21
- }
22
- else {
23
- // TODO(katerina): Remove Nx17
24
- // print warnings
25
- (0, utils_1.runStorybookSetupCheck)(options);
26
- devkit_1.logger.error((0, utilities_1.pleaseUpgrade)());
27
- let frameworkPath = (0, utils_1.getStorybookFrameworkPath)(options.uiFramework);
28
- const frameworkOptions = (await Promise.resolve(`${frameworkPath}`).then(s => require(s))).default;
29
- const buildOptions = {
30
- ...options,
31
- ...frameworkOptions,
32
- frameworkPresets: [...(frameworkOptions.frameworkPresets || [])],
33
- };
34
- await runInstance(buildOptions, storybook7);
35
- yield { success: true };
36
- await new Promise(() => { });
7
+ if (!storybook7) {
8
+ throw (0, utilities_1.pleaseUpgrade)();
37
9
  }
10
+ (0, utilities_1.storybookConfigExistsCheck)(options.configDir, context.projectName);
11
+ const buildOptions = options;
12
+ const result = await runInstance(buildOptions);
13
+ yield {
14
+ success: true,
15
+ info: {
16
+ port: result?.['port'],
17
+ baseUrl: `${options.https ? 'https' : 'http'}://${options.host ?? 'localhost'}:${result?.['port']}`,
18
+ },
19
+ };
20
+ await new Promise(() => { });
38
21
  }
39
22
  exports.default = storybookExecutor;
40
- function runInstance(options, storybook7) {
23
+ function runInstance(options) {
41
24
  const env = process.env.NODE_ENV ?? 'development';
42
25
  process.env.NODE_ENV = env;
43
- if (storybook7) {
44
- return build.build({
45
- ...options,
46
- mode: 'dev',
47
- });
48
- }
49
- else {
50
- // TODO(katerina): Remove Nx17
51
- return build['buildDev']({
52
- ...options,
53
- configType: env.toUpperCase(),
54
- mode: 'dev',
55
- });
56
- }
26
+ return build.build({
27
+ ...options,
28
+ mode: 'dev',
29
+ });
57
30
  }
@@ -61,7 +61,7 @@ async function configurationGenerator(tree, rawSchema) {
61
61
  if (schema.configureStaticServe) {
62
62
  (0, util_functions_1.addStaticTarget)(tree, schema);
63
63
  }
64
- // TODO(v18): remove Cypress
64
+ // TODO(katerina): Nx 18 -> remove Cypress
65
65
  if (schema.configureCypress) {
66
66
  const e2eProject = await (0, util_functions_1.getE2EProjectName)(tree, schema.name);
67
67
  if (!e2eProject) {
@@ -1,25 +1,24 @@
1
1
  import { Tree } from '@nx/devkit';
2
2
  import { StorybookConfigureSchema } from '../schema';
3
- import { UiFramework7 } from '../../../utils/models';
4
- export declare function addStorybookTask(tree: Tree, projectName: string, uiFramework: string, interactionTests: boolean): void;
3
+ import { UiFramework } from '../../../utils/models';
4
+ export declare function addStorybookTask(tree: Tree, projectName: string, uiFramework: UiFramework, interactionTests: boolean): void;
5
5
  export declare function addAngularStorybookTask(tree: Tree, projectName: string, interactionTests: boolean): void;
6
6
  export declare function addStaticTarget(tree: Tree, opts: StorybookConfigureSchema): void;
7
- export declare function createStorybookTsconfigFile(tree: Tree, projectRoot: string, uiFramework: UiFramework7, isRootProject: boolean, mainDir: 'components' | 'src'): void;
7
+ export declare function createStorybookTsconfigFile(tree: Tree, projectRoot: string, uiFramework: UiFramework, isRootProject: boolean, mainDir: 'components' | 'src'): void;
8
8
  export declare function editTsconfigBaseJson(tree: Tree): void;
9
9
  export declare function configureTsProjectConfig(tree: Tree, schema: StorybookConfigureSchema): void;
10
10
  export declare function configureTsSolutionConfig(tree: Tree, schema: StorybookConfigureSchema): void;
11
11
  /**
12
- * When adding storybook we need to inform TSLint or ESLint
12
+ * When adding storybook we need to inform ESLint
13
13
  * of the additional tsconfig.json file which will be the only tsconfig
14
14
  * which includes *.stories files.
15
15
  *
16
- * For TSLint this is done via the builder config, for ESLint this is
17
- * done within the eslint config file.
16
+ * This is done within the eslint config file.
18
17
  */
19
18
  export declare function updateLintConfig(tree: Tree, schema: StorybookConfigureSchema): void;
20
19
  export declare function normalizeSchema(schema: StorybookConfigureSchema): StorybookConfigureSchema;
21
20
  export declare function addStorybookToNamedInputs(tree: Tree): void;
22
- export declare function createProjectStorybookDir(tree: Tree, projectName: string, uiFramework: UiFramework7, js: boolean, tsConfiguration: boolean, root: string, projectType: string, projectIsRootProjectInStandaloneWorkspace: boolean, interactionTests: boolean, mainDir?: string, isNextJs?: boolean, usesSwc?: boolean, usesVite?: boolean, viteConfigFilePath?: string): void;
21
+ export declare function createProjectStorybookDir(tree: Tree, projectName: string, uiFramework: UiFramework, js: boolean, tsConfiguration: boolean, root: string, projectType: string, projectIsRootProjectInStandaloneWorkspace: boolean, interactionTests: boolean, mainDir?: string, isNextJs?: boolean, usesSwc?: boolean, usesVite?: boolean, viteConfigFilePath?: string): void;
23
22
  export declare function getTsConfigPath(tree: Tree, projectName: string, path?: string): string;
24
23
  export declare function addBuildStorybookToCacheableOperations(tree: Tree): void;
25
24
  export declare function projectIsRootProjectInStandaloneWorkspace(projectRoot: string): boolean;
@@ -250,23 +250,15 @@ function configureTsSolutionConfig(tree, schema) {
250
250
  }
251
251
  exports.configureTsSolutionConfig = configureTsSolutionConfig;
252
252
  /**
253
- * When adding storybook we need to inform TSLint or ESLint
253
+ * When adding storybook we need to inform ESLint
254
254
  * of the additional tsconfig.json file which will be the only tsconfig
255
255
  * which includes *.stories files.
256
256
  *
257
- * For TSLint this is done via the builder config, for ESLint this is
258
- * done within the eslint config file.
257
+ * This is done within the eslint config file.
259
258
  */
260
259
  function updateLintConfig(tree, schema) {
261
260
  const { name: projectName } = schema;
262
- const { targets, root } = (0, devkit_1.readProjectConfiguration)(tree, projectName);
263
- const tslintTargets = Object.values(targets ?? {}).filter((target) => target.executor === '@angular-devkit/build-angular:tslint');
264
- tslintTargets.forEach((target) => {
265
- target.options.tsConfig = (0, utilities_1.dedupe)([
266
- ...target.options.tsConfig,
267
- (0, devkit_1.joinPathFragments)(root, './.storybook/tsconfig.json'),
268
- ]);
269
- });
261
+ const { root } = (0, devkit_1.readProjectConfiguration)(tree, projectName);
270
262
  const eslintFile = (0, eslint_file_1.findEslintFile)(tree, root);
271
263
  if (!eslintFile) {
272
264
  return;
@@ -1,9 +1,9 @@
1
1
  import { Linter } from '@nx/linter';
2
- import { UiFramework7, UiFramework } from '../../utils/models';
2
+ import { UiFramework } from '../../utils/models';
3
3
 
4
4
  export interface StorybookConfigureSchema {
5
5
  name: string;
6
- uiFramework?: UiFramework7;
6
+ uiFramework?: UiFramework;
7
7
  linter?: Linter;
8
8
  js?: boolean;
9
9
  interactionTests?: boolean;
@@ -87,20 +87,13 @@ function checkDependenciesInstalled(host, schema) {
87
87
  }
88
88
  function addCacheableOperation(tree) {
89
89
  const nxJson = (0, devkit_1.readNxJson)(tree);
90
- if (!nxJson.tasksRunnerOptions ||
91
- !nxJson.tasksRunnerOptions.default ||
92
- (nxJson.tasksRunnerOptions.default.runner !==
93
- '@nx/workspace/tasks-runners/default' &&
94
- nxJson.tasksRunnerOptions.default.runner !== 'nx/tasks-runners/default')) {
95
- return;
96
- }
97
- nxJson.tasksRunnerOptions.default.options =
98
- nxJson.tasksRunnerOptions.default.options || {};
99
- nxJson.tasksRunnerOptions.default.options.cacheableOperations =
100
- nxJson.tasksRunnerOptions.default.options.cacheableOperations || [];
101
- if (!nxJson.tasksRunnerOptions.default.options.cacheableOperations?.includes('build-storybook')) {
90
+ const cacheableOperations = nxJson.tasksRunnerOptions?.default?.options?.cacheableOperations;
91
+ if (cacheableOperations && cacheableOperations.includes('build-storybook')) {
102
92
  nxJson.tasksRunnerOptions.default.options.cacheableOperations.push('build-storybook');
103
93
  }
94
+ nxJson.targetDefaults ??= {};
95
+ nxJson.targetDefaults['build-storybook'] ??= {};
96
+ nxJson.targetDefaults['build-storybook'].cache = true;
104
97
  (0, devkit_1.updateNxJson)(tree, nxJson);
105
98
  }
106
99
  function moveToDevDependencies(tree) {
@@ -1,6 +1,6 @@
1
- import { UiFramework7 } from '../../utils/models';
1
+ import { UiFramework } from '../../utils/models';
2
2
 
3
3
  export interface Schema {
4
- uiFramework: UiFramework7;
4
+ uiFramework: UiFramework;
5
5
  js?: boolean;
6
6
  }
@@ -1,5 +1,3 @@
1
- import { UiFramework, UiFramework7 } from '../../utils/models';
2
-
3
1
  export interface Schema {
4
2
  autoAcceptAllPrompts?: boolean;
5
3
  onlyShowListOfCommands?: boolean;
@@ -1,4 +1 @@
1
- export interface CommonNxStorybookConfig {
2
- uiFramework?: '@storybook/angular' | '@storybook/react' | '@storybook/html' | '@storybook/web-components' | '@storybook/vue' | '@storybook/vue3' | '@storybook/svelte';
3
- }
4
- export type UiFramework7 = '@storybook/angular' | '@storybook/html-webpack5' | '@storybook/nextjs' | '@storybook/preact-webpack5' | '@storybook/react-webpack5' | '@storybook/react-vite' | '@storybook/server-webpack5' | '@storybook/svelte-webpack5' | '@storybook/svelte-vite' | '@storybook/sveltekit' | '@storybook/vue-webpack5' | '@storybook/vue-vite' | '@storybook/vue3-webpack5' | '@storybook/vue3-vite' | '@storybook/web-components-webpack5' | '@storybook/web-components-vite' | '@storybook/react-native';
1
+ export type UiFramework = '@storybook/angular' | '@storybook/html-webpack5' | '@storybook/nextjs' | '@storybook/preact-webpack5' | '@storybook/react-webpack5' | '@storybook/react-vite' | '@storybook/server-webpack5' | '@storybook/svelte-webpack5' | '@storybook/svelte-vite' | '@storybook/sveltekit' | '@storybook/vue-webpack5' | '@storybook/vue-vite' | '@storybook/vue3-webpack5' | '@storybook/vue3-vite' | '@storybook/web-components-webpack5' | '@storybook/web-components-vite' | '@storybook/react-native';
@@ -212,10 +212,11 @@ function getTsSourceFile(host, path) {
212
212
  exports.getTsSourceFile = getTsSourceFile;
213
213
  function pleaseUpgrade() {
214
214
  return `
215
- Storybook 6 is no longer maintained. Please upgrade to Storybook 7.
215
+ Storybook 6 is no longer maintained, and not supported in Nx.
216
+ Please upgrade to Storybook 7.
216
217
 
217
218
  Here is a guide on how to upgrade:
218
- https://nx.dev/packages/storybook/generators/migrate-7
219
+ https://nx.dev/nx-api/storybook/generators/migrate-7
219
220
  `;
220
221
  }
221
222
  exports.pleaseUpgrade = pleaseUpgrade;
@@ -1,6 +0,0 @@
1
- import ts = require('typescript');
2
- import { CommonNxStorybookConfig } from '../utils/models';
3
- import { CLIOptions } from '@storybook/types';
4
- export declare function getStorybookFrameworkPath(uiFramework: any): any;
5
- export declare function runStorybookSetupCheck(options: CLIOptions & CommonNxStorybookConfig): void;
6
- export declare function builderIsWebpackButNotWebpack5(storybookConfig: ts.SourceFile): boolean;