@nx/storybook 16.7.2 → 16.7.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/storybook",
3
- "version": "16.7.2",
3
+ "version": "16.7.4",
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": {
@@ -30,12 +30,12 @@
30
30
  "migrations": "./migrations.json"
31
31
  },
32
32
  "dependencies": {
33
- "@nrwl/storybook": "16.7.2",
34
- "@nx/cypress": "16.7.2",
35
- "@nx/devkit": "16.7.2",
36
- "@nx/js": "16.7.2",
37
- "@nx/linter": "16.7.2",
38
- "@nx/workspace": "16.7.2",
33
+ "@nrwl/storybook": "16.7.4",
34
+ "@nx/cypress": "16.7.4",
35
+ "@nx/devkit": "16.7.4",
36
+ "@nx/js": "16.7.4",
37
+ "@nx/linter": "16.7.4",
38
+ "@nx/workspace": "16.7.4",
39
39
  "@phenomnomnominal/tsquery": "~5.0.1",
40
40
  "dotenv": "~16.3.1",
41
41
  "semver": "7.5.3",
@@ -45,5 +45,5 @@
45
45
  "access": "public"
46
46
  },
47
47
  "type": "commonjs",
48
- "gitHead": "b024f44a1ad4e1773e80f6dc72f9d22766b950f9"
48
+ "gitHead": "5d73f6e0f2c6d4dfb2e9d45519d591c338bb5c37"
49
49
  }
@@ -99,6 +99,14 @@ function configurationGenerator(tree, rawSchema) {
99
99
  schema.uiFramework === '@storybook/react-webpack5') {
100
100
  devDeps['core-js'] = versions_1.coreJsVersion;
101
101
  }
102
+ if (schema.uiFramework.endsWith('-vite') &&
103
+ (!viteBuildTarget || !viteConfigFilePath)) {
104
+ // This means that the user has selected a Vite framework
105
+ // but the project does not have Vite configuration.
106
+ // We need to install the @nx/vite plugin in order to be able to use
107
+ // the nxViteTsPaths plugin to register the tsconfig paths in Vite.
108
+ devDeps['@nx/vite'] = versions_1.nxVersion;
109
+ }
102
110
  tasks.push((0, devkit_1.addDependenciesToPackageJson)(tree, {}, devDeps));
103
111
  if (!schema.skipFormat) {
104
112
  yield (0, devkit_1.formatFiles)(tree);
@@ -257,7 +257,7 @@ exports.configureTsSolutionConfig = configureTsSolutionConfig;
257
257
  function updateLintConfig(tree, schema) {
258
258
  const { name: projectName } = schema;
259
259
  const { targets, root } = (0, devkit_1.readProjectConfiguration)(tree, projectName);
260
- const tslintTargets = Object.values(targets).filter((target) => target.executor === '@angular-devkit/build-angular:tslint');
260
+ const tslintTargets = Object.values(targets !== null && targets !== void 0 ? targets : {}).filter((target) => target.executor === '@angular-devkit/build-angular:tslint');
261
261
  tslintTargets.forEach((target) => {
262
262
  target.options.tsConfig = (0, utilities_1.dedupe)([
263
263
  ...target.options.tsConfig,
@@ -1,3 +1,8 @@
1
+ <% if (usesVite && !viteConfigFilePath) { %>
2
+ import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
3
+ import { mergeConfig } from 'vite';
4
+ <% } %>
5
+
1
6
  const config = {
2
7
  stories: [
3
8
  <% if(uiFramework === '@storybook/angular' && projectType === 'library') { %>
@@ -8,13 +13,19 @@ const config = {
8
13
  framework: {
9
14
  name: '<%= uiFramework %>',
10
15
  options: {
11
- <% if (usesVite) { %>
16
+ <% if (usesVite && viteConfigFilePath) { %>
12
17
  builder: {
13
18
  viteConfigPath: '<%= viteConfigFilePath %>',
14
19
  },
15
20
  <% } %>
16
21
  },
17
22
  },
23
+ <% if (usesVite && !viteConfigFilePath) { %>
24
+ viteFinal: async (config) =>
25
+ mergeConfig(config, {
26
+ plugins: [nxViteTsPaths()],
27
+ }),
28
+ <% } %>
18
29
  };
19
30
 
20
31
  export default config;
@@ -1,4 +1,8 @@
1
1
  import type { StorybookConfig } from '<%= uiFramework %>';
2
+ <% if (usesVite && !viteConfigFilePath) { %>
3
+ import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin';
4
+ import { mergeConfig } from 'vite';
5
+ <% } %>
2
6
 
3
7
  const config: StorybookConfig = {
4
8
  stories: [
@@ -10,13 +14,19 @@ const config: StorybookConfig = {
10
14
  framework: {
11
15
  name: '<%= uiFramework %>',
12
16
  options: {
13
- <% if (usesVite) { %>
17
+ <% if (usesVite && viteConfigFilePath) { %>
14
18
  builder: {
15
19
  viteConfigPath: '<%= viteConfigFilePath %>',
16
20
  },
17
21
  <% } %>
18
22
  },
19
23
  },
24
+ <% if (usesVite && !viteConfigFilePath) { %>
25
+ viteFinal: async (config) =>
26
+ mergeConfig(config, {
27
+ plugins: [nxViteTsPaths()],
28
+ }),
29
+ <% } %>
20
30
  };
21
31
 
22
32
  export default config;