@nx/nuxt 22.2.0-beta.0 → 22.2.0-beta.1
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 +34 -2
- package/package.json +11 -10
- package/src/generators/application/application.d.ts.map +1 -1
- package/src/generators/application/application.js +13 -5
- package/src/generators/application/files/app-dir/__dot__npmrc +2 -0
- package/src/generators/application/files/app-dir/app/app.vue__tmpl__ +48 -0
- package/src/generators/application/files/app-dir/app/assets/css/styles.__style__ +41 -0
- package/src/generators/application/files/app-dir/app/pages/about.vue__tmpl__ +16 -0
- package/src/generators/application/files/app-dir/app/pages/index.vue__tmpl__ +3 -0
- package/src/generators/application/files/app-dir/nuxt.config.ts__tmpl__ +29 -0
- package/src/generators/application/files/app-dir/public/__dot__gitkeep +0 -0
- package/src/generators/application/files/app-dir/public/favicon.ico__tmpl__ +0 -0
- package/src/generators/application/files/app-dir/server/api/greet.ts__tmpl__ +10 -0
- package/src/generators/application/files/app-dir/server/tsconfig.json__tmpl__ +3 -0
- package/src/generators/application/files/nx-welcome-app-dir/claimed/app/components/NxWelcome.vue__tmpl__ +791 -0
- package/src/generators/application/files/nx-welcome-app-dir/not-configured/app/components/NxWelcome.vue__tmpl__ +795 -0
- package/src/generators/application/files/nx-welcome-app-dir/unclaimed/app/components/NxWelcome.vue__tmpl__ +792 -0
- package/src/generators/application/lib/ensure-dependencies.d.ts +1 -1
- package/src/generators/application/lib/ensure-dependencies.d.ts.map +1 -1
- package/src/generators/application/lib/ensure-dependencies.js +8 -6
- package/src/generators/application/lib/normalize-options.d.ts.map +1 -1
- package/src/generators/application/lib/normalize-options.js +8 -0
- package/src/generators/application/schema.d.ts +3 -0
- package/src/generators/application/schema.json +5 -0
- package/src/generators/init/init.js +1 -1
- package/src/generators/init/lib/utils.d.ts +1 -1
- package/src/generators/init/lib/utils.d.ts.map +1 -1
- package/src/generators/init/lib/utils.js +4 -2
- package/src/generators/storybook-configuration/configuration.d.ts.map +1 -1
- package/src/generators/storybook-configuration/configuration.js +12 -2
- package/src/migrations/update-22-2-0/create-ai-instructions-for-nuxt-4.d.ts +3 -0
- package/src/migrations/update-22-2-0/create-ai-instructions-for-nuxt-4.d.ts.map +1 -0
- package/src/migrations/update-22-2-0/create-ai-instructions-for-nuxt-4.js +16 -0
- package/src/migrations/update-22-2-0/files/ai-instructions-for-nuxt-4.md +531 -0
- package/src/utils/add-linting.d.ts.map +1 -1
- package/src/utils/add-linting.js +82 -21
- package/src/utils/create-ts-config.d.ts +1 -0
- package/src/utils/create-ts-config.d.ts.map +1 -1
- package/src/utils/create-ts-config.js +27 -2
- package/src/utils/version-utils.d.ts +15 -0
- package/src/utils/version-utils.d.ts.map +1 -0
- package/src/utils/version-utils.js +85 -0
- package/src/utils/versions.d.ts +11 -3
- package/src/utils/versions.d.ts.map +1 -1
- package/src/utils/versions.js +15 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type Tree } from '@nx/devkit';
|
|
2
2
|
import type { NormalizedSchema } from '../schema';
|
|
3
|
-
export declare function ensureDependencies(host: Tree, options: NormalizedSchema): import("@nx/devkit").GeneratorCallback
|
|
3
|
+
export declare function ensureDependencies(host: Tree, options: NormalizedSchema): Promise<import("@nx/devkit").GeneratorCallback>;
|
|
4
4
|
//# sourceMappingURL=ensure-dependencies.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ensure-dependencies.d.ts","sourceRoot":"","sources":["../../../../../../../packages/nuxt/src/generators/application/lib/ensure-dependencies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"ensure-dependencies.d.ts","sourceRoot":"","sources":["../../../../../../../packages/nuxt/src/generators/application/lib/ensure-dependencies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAUrE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAElD,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,gBAAgB,mDAuB1B"}
|
|
@@ -4,14 +4,16 @@ exports.ensureDependencies = ensureDependencies;
|
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const vue_1 = require("@nx/vue");
|
|
6
6
|
const versions_1 = require("../../../utils/versions");
|
|
7
|
-
|
|
7
|
+
const version_utils_1 = require("../../../utils/version-utils");
|
|
8
|
+
async function ensureDependencies(host, options) {
|
|
9
|
+
const nuxtVersions = await (0, version_utils_1.getNuxtDependenciesVersionsToInstall)(host);
|
|
8
10
|
const devDependencies = {
|
|
9
11
|
'@nx/vite': versions_1.nxVersion, // needed for the nxViteTsPaths plugin and @nx/vite/plugin
|
|
10
|
-
'@nuxt/devtools':
|
|
11
|
-
'@nuxt/kit':
|
|
12
|
-
'@nuxt/ui-templates':
|
|
13
|
-
nuxt:
|
|
14
|
-
h3:
|
|
12
|
+
'@nuxt/devtools': nuxtVersions.nuxtDevtools,
|
|
13
|
+
'@nuxt/kit': nuxtVersions.nuxtKit,
|
|
14
|
+
'@nuxt/ui-templates': nuxtVersions.nuxtUiTemplates,
|
|
15
|
+
nuxt: nuxtVersions.nuxt,
|
|
16
|
+
h3: nuxtVersions.h3,
|
|
15
17
|
vue: vue_1.vueVersion,
|
|
16
18
|
'vue-router': vue_1.vueRouterVersion,
|
|
17
19
|
'vue-tsc': vue_1.vueTscVersion,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-options.d.ts","sourceRoot":"","sources":["../../../../../../../packages/nuxt/src/generators/application/lib/normalize-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,IAAI,EAAE,MAAM,YAAY,CAAC;AAKzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"normalize-options.d.ts","sourceRoot":"","sources":["../../../../../../../packages/nuxt/src/generators/application/lib/normalize-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,IAAI,EAAE,MAAM,YAAY,CAAC;AAKzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAIrD,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,gBAAgB,CAAC,CAqD3B"}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.normalizeOptions = normalizeOptions;
|
|
4
4
|
const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
|
|
5
5
|
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
6
|
+
const version_utils_1 = require("../../../utils/version-utils");
|
|
6
7
|
async function normalizeOptions(host, options) {
|
|
7
8
|
await (0, project_name_and_root_utils_1.ensureRootProjectName)(options, 'application');
|
|
8
9
|
const { projectName, names: projectNames, projectRoot: appProjectRoot, importPath, } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
|
|
@@ -19,6 +20,11 @@ async function normalizeOptions(host, options) {
|
|
|
19
20
|
const parsedTags = options.tags
|
|
20
21
|
? options.tags.split(',').map((s) => s.trim())
|
|
21
22
|
: [];
|
|
23
|
+
// Detect workspace Nuxt version
|
|
24
|
+
const nuxtVersions = await (0, version_utils_1.getNuxtDependenciesVersionsToInstall)(host);
|
|
25
|
+
const nuxtMajorVersion = nuxtVersions.nuxt.startsWith('^4') ? 4 : 3;
|
|
26
|
+
// Set useAppDir default based on version (v4 defaults to true, v3 defaults to false)
|
|
27
|
+
const useAppDir = options.useAppDir ?? nuxtMajorVersion >= 4;
|
|
22
28
|
const normalized = {
|
|
23
29
|
...options,
|
|
24
30
|
name: projectNames.projectFileName,
|
|
@@ -31,6 +37,8 @@ async function normalizeOptions(host, options) {
|
|
|
31
37
|
style: options.style ?? 'none',
|
|
32
38
|
isUsingTsSolutionConfig,
|
|
33
39
|
useProjectJson: options.useProjectJson ?? !isUsingTsSolutionConfig,
|
|
40
|
+
useAppDir,
|
|
41
|
+
nuxtMajorVersion,
|
|
34
42
|
};
|
|
35
43
|
normalized.unitTestRunner ??= 'vitest';
|
|
36
44
|
normalized.e2eTestRunner = normalized.e2eTestRunner ?? 'playwright';
|
|
@@ -17,6 +17,7 @@ export interface Schema {
|
|
|
17
17
|
nxCloudToken?: string;
|
|
18
18
|
useTsSolution?: boolean;
|
|
19
19
|
useProjectJson?: boolean;
|
|
20
|
+
useAppDir?: boolean;
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
export interface NormalizedSchema extends Omit<Schema, 'useTsSolution'> {
|
|
@@ -27,4 +28,6 @@ export interface NormalizedSchema extends Omit<Schema, 'useTsSolution'> {
|
|
|
27
28
|
e2eProjectRoot: string;
|
|
28
29
|
parsedTags: string[];
|
|
29
30
|
isUsingTsSolutionConfig: boolean;
|
|
31
|
+
useAppDir: boolean;
|
|
32
|
+
nuxtMajorVersion: 3 | 4;
|
|
30
33
|
}
|
|
@@ -110,6 +110,11 @@
|
|
|
110
110
|
"useProjectJson": {
|
|
111
111
|
"type": "boolean",
|
|
112
112
|
"description": "Use a `project.json` configuration file instead of inlining the Nx configuration in the `package.json` file."
|
|
113
|
+
},
|
|
114
|
+
"useAppDir": {
|
|
115
|
+
"type": "boolean",
|
|
116
|
+
"description": "Use Nuxt 4 app/ directory structure instead of src/ directory. Defaults to true for Nuxt v4, false for Nuxt v3.",
|
|
117
|
+
"x-priority": "important"
|
|
113
118
|
}
|
|
114
119
|
},
|
|
115
120
|
"required": ["directory"],
|
|
@@ -14,7 +14,7 @@ async function nuxtInitGenerator(host, schema) {
|
|
|
14
14
|
}, schema.updatePackageScripts);
|
|
15
15
|
let installTask = () => { };
|
|
16
16
|
if (!schema.skipPackageJson) {
|
|
17
|
-
installTask = (0, utils_1.updateDependencies)(host, schema);
|
|
17
|
+
installTask = await (0, utils_1.updateDependencies)(host, schema);
|
|
18
18
|
}
|
|
19
19
|
return installTask;
|
|
20
20
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Tree } from '@nx/devkit';
|
|
2
2
|
import { InitSchema } from '../schema';
|
|
3
|
-
export declare function updateDependencies(host: Tree, schema: InitSchema): import("@nx/devkit").GeneratorCallback
|
|
3
|
+
export declare function updateDependencies(host: Tree, schema: InitSchema): Promise<import("@nx/devkit").GeneratorCallback>;
|
|
4
4
|
export declare function addVitestTargetDefaults(tree: Tree): void;
|
|
5
5
|
export declare function addPlugin(tree: Tree): void;
|
|
6
6
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../../packages/nuxt/src/generators/init/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,IAAI,EAEL,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../../packages/nuxt/src/generators/init/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,IAAI,EAEL,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,mDActE;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,IAAI,QAcjD;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,QAiDnC"}
|
|
@@ -5,10 +5,12 @@ exports.addVitestTargetDefaults = addVitestTargetDefaults;
|
|
|
5
5
|
exports.addPlugin = addPlugin;
|
|
6
6
|
const devkit_1 = require("@nx/devkit");
|
|
7
7
|
const versions_1 = require("../../../utils/versions");
|
|
8
|
-
|
|
8
|
+
const version_utils_1 = require("../../../utils/version-utils");
|
|
9
|
+
async function updateDependencies(host, schema) {
|
|
10
|
+
const nuxtVersions = await (0, version_utils_1.getNuxtDependenciesVersionsToInstall)(host);
|
|
9
11
|
return (0, devkit_1.addDependenciesToPackageJson)(host, {}, {
|
|
10
12
|
'@nx/nuxt': versions_1.nxVersion,
|
|
11
|
-
nuxt:
|
|
13
|
+
nuxt: nuxtVersions.nuxt,
|
|
12
14
|
'@nx/vite': versions_1.nxVersion,
|
|
13
15
|
}, undefined, schema.keepExistingVersions);
|
|
14
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../../../../../packages/nuxt/src/generators/storybook-configuration/configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,IAAI,EAEL,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAMlC,wBAAsB,+BAA+B,CACnD,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../../../../../packages/nuxt/src/generators/storybook-configuration/configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,IAAI,EAEL,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAMlC,wBAAsB,+BAA+B,CACnD,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,MAAM,mDAyChB;AAED,eAAe,+BAA+B,CAAC"}
|
|
@@ -8,12 +8,22 @@ const vue_1 = require("@nx/vue");
|
|
|
8
8
|
* are just adding the styles in `.storybook/preview.ts`
|
|
9
9
|
*/
|
|
10
10
|
async function storybookConfigurationGenerator(tree, options) {
|
|
11
|
+
const { root, sourceRoot } = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
12
|
+
// Determine the source directory (app/ for Nuxt v4, src/ for Nuxt v3)
|
|
13
|
+
const sourceDir = sourceRoot?.endsWith('/app')
|
|
14
|
+
? 'app'
|
|
15
|
+
: sourceRoot?.endsWith('/src')
|
|
16
|
+
? 'src'
|
|
17
|
+
: 'src'; // default to src for backward compatibility
|
|
11
18
|
const storybookConfigurationGenerator = await (0, vue_1.storybookConfigurationGenerator)(tree, {
|
|
12
19
|
...options,
|
|
13
20
|
addPlugin: true,
|
|
14
21
|
});
|
|
15
|
-
|
|
16
|
-
|
|
22
|
+
// Default tsConfiguration to true to match schema default
|
|
23
|
+
const tsConfiguration = options.tsConfiguration ?? true;
|
|
24
|
+
// Write the preview file after the base storybook configuration is set up
|
|
25
|
+
// This ensures we overwrite any default content with our Nuxt-specific import
|
|
26
|
+
tree.write((0, devkit_1.joinPathFragments)(root, '.storybook', 'preview.' + (tsConfiguration ? 'ts' : 'js')), `import '../${sourceDir}/assets/css/styles.css';`);
|
|
17
27
|
(0, devkit_1.updateJson)(tree, `${root}/tsconfig.storybook.json`, (json) => {
|
|
18
28
|
json.compilerOptions = {
|
|
19
29
|
...json.compilerOptions,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-ai-instructions-for-nuxt-4.d.ts","sourceRoot":"","sources":["../../../../../../packages/nuxt/src/migrations/update-22-2-0/create-ai-instructions-for-nuxt-4.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAElC,wBAA8B,2BAA2B,CAAC,IAAI,EAAE,IAAI,qBAenE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = createAiInstructionsForNuxt;
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
const fs_1 = require("fs");
|
|
6
|
+
async function createAiInstructionsForNuxt(tree) {
|
|
7
|
+
const pathToAiInstructions = (0, path_1.join)(__dirname, 'files', 'ai-instructions-for-nuxt-4.md');
|
|
8
|
+
if (!(0, fs_1.existsSync)(pathToAiInstructions)) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
const contents = (0, fs_1.readFileSync)(pathToAiInstructions);
|
|
12
|
+
tree.write('ai-migrations/MIGRATE_NUXT_4.md', contents);
|
|
13
|
+
return [
|
|
14
|
+
`We created 'ai-migrations/MIGRATE_NUXT_4.md' with instructions for an AI Agent to help migrate your Nuxt projects to Nuxt 4.`,
|
|
15
|
+
];
|
|
16
|
+
}
|