@nx/nuxt 22.0.0-beta.0 → 22.0.0-canary.20251001-e28a97a
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 +1 -8
- package/package.json +7 -8
- package/src/migrations/update-19-6-0/add-vue-plugin-to-storybook-config.d.ts +0 -3
- package/src/migrations/update-19-6-0/add-vue-plugin-to-storybook-config.d.ts.map +0 -1
- package/src/migrations/update-19-6-0/add-vue-plugin-to-storybook-config.js +0 -51
package/migrations.json
CHANGED
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
{
|
|
2
|
-
"generators": {
|
|
3
|
-
"add-vue-to-storybook-config": {
|
|
4
|
-
"cli": "nx",
|
|
5
|
-
"version": "19.6.0-beta.0",
|
|
6
|
-
"description": "Add vue() plugin to viteFinal in Storybook config files when it is missing.",
|
|
7
|
-
"implementation": "./src/migrations/update-19-6-0/add-vue-plugin-to-storybook-config"
|
|
8
|
-
}
|
|
9
|
-
},
|
|
2
|
+
"generators": {},
|
|
10
3
|
"packageJsonUpdates": {}
|
|
11
4
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/nuxt",
|
|
3
|
-
"version": "22.0.0-
|
|
3
|
+
"version": "22.0.0-canary.20251001-e28a97a",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Nuxt plugin for Nx contains executors and generators for managing Nuxt applications and libraries within an Nx workspace. It provides:\n\n\n- Integration with libraries such as Vitest, Playwright, Cypress, and Storybook.\n\n- Generators for applications, libraries, and more.\n\n- Library build support for publishing packages to npm or other registries.\n\n- Utilities for automatic workspace refactoring.",
|
|
6
6
|
"repository": {
|
|
@@ -42,15 +42,14 @@
|
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"tslib": "^2.3.0",
|
|
44
44
|
"@nuxt/kit": "^3.10.0",
|
|
45
|
-
"@nx/devkit": "22.0.0-
|
|
46
|
-
"@nx/js": "22.0.0-
|
|
47
|
-
"@nx/eslint": "22.0.0-
|
|
48
|
-
"@nx/vue": "22.0.0-
|
|
49
|
-
"@nx/vite": "22.0.0-
|
|
50
|
-
"@phenomnomnominal/tsquery": "~5.0.1"
|
|
45
|
+
"@nx/devkit": "22.0.0-canary.20251001-e28a97a",
|
|
46
|
+
"@nx/js": "22.0.0-canary.20251001-e28a97a",
|
|
47
|
+
"@nx/eslint": "22.0.0-canary.20251001-e28a97a",
|
|
48
|
+
"@nx/vue": "22.0.0-canary.20251001-e28a97a",
|
|
49
|
+
"@nx/vite": "22.0.0-canary.20251001-e28a97a"
|
|
51
50
|
},
|
|
52
51
|
"devDependencies": {
|
|
53
|
-
"nx": "22.0.0-
|
|
52
|
+
"nx": "22.0.0-canary.20251001-e28a97a"
|
|
54
53
|
},
|
|
55
54
|
"peerDependencies": {
|
|
56
55
|
"@nuxt/schema": "^3.10.0"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"add-vue-plugin-to-storybook-config.d.ts","sourceRoot":"","sources":["../../../../../../packages/nuxt/src/migrations/update-19-6-0/add-vue-plugin-to-storybook-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,IAAI,EAEV,MAAM,YAAY,CAAC;AAIpB,yBAA+B,IAAI,EAAE,IAAI,iBA6DxC"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = default_1;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const path_1 = require("path");
|
|
6
|
-
const tsquery_1 = require("@phenomnomnominal/tsquery");
|
|
7
|
-
async function default_1(tree) {
|
|
8
|
-
(0, devkit_1.visitNotIgnoredFiles)(tree, '', (path) => {
|
|
9
|
-
if (!path.endsWith('.storybook/main.ts') &&
|
|
10
|
-
!path.endsWith('.storybook/main.js')) {
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
const projectRoot = (0, path_1.dirname)((0, path_1.dirname)(path));
|
|
14
|
-
const possibleNuxtConfigPaths = [
|
|
15
|
-
(0, devkit_1.joinPathFragments)(projectRoot, 'nuxt.config.ts'),
|
|
16
|
-
(0, devkit_1.joinPathFragments)(projectRoot, 'nuxt.config.js'),
|
|
17
|
-
];
|
|
18
|
-
if (!possibleNuxtConfigPaths.some((p) => tree.exists(p))) {
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
const pathToStorybookConfig = path;
|
|
22
|
-
const storybookConfigContents = tree.read(pathToStorybookConfig, 'utf-8');
|
|
23
|
-
if (!storybookConfigContents.includes('viteFinal') &&
|
|
24
|
-
!storybookConfigContents.includes('@vitejs/plugin-vue')) {
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
const VITE_FINAL_PLUGINS_SELECTOR = 'PropertyAssignment:has(Identifier[name=viteFinal]) PropertyAssignment:has(Identifier[name=plugins]) > ArrayLiteralExpression';
|
|
28
|
-
const ast = tsquery_1.tsquery.ast(storybookConfigContents);
|
|
29
|
-
const nodes = (0, tsquery_1.tsquery)(ast, VITE_FINAL_PLUGINS_SELECTOR, {
|
|
30
|
-
visitAllChildren: true,
|
|
31
|
-
});
|
|
32
|
-
if (!nodes.length) {
|
|
33
|
-
// This would be an invalid config modified by the user already if it does work
|
|
34
|
-
// Therefore, do not touch their config file
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
const pluginsValueNode = nodes[0];
|
|
38
|
-
if (pluginsValueNode.getText().includes('vue()')) {
|
|
39
|
-
// The plugin has already been registered, do nothing
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
const updatedPluginsValue = `[vue(), ${pluginsValueNode
|
|
43
|
-
.getText()
|
|
44
|
-
.slice(1)}`;
|
|
45
|
-
let newStorybookConfigContents = `${storybookConfigContents.slice(0, pluginsValueNode.getStart())}${updatedPluginsValue}${storybookConfigContents.slice(pluginsValueNode.getEnd())}`;
|
|
46
|
-
newStorybookConfigContents = `import vue from '@vitejs/plugin-vue';
|
|
47
|
-
${newStorybookConfigContents}`;
|
|
48
|
-
tree.write(pathToStorybookConfig, newStorybookConfigContents);
|
|
49
|
-
});
|
|
50
|
-
await (0, devkit_1.formatFiles)(tree);
|
|
51
|
-
}
|