@nx/nuxt 22.1.2 → 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
|
@@ -34,13 +34,38 @@ function createTsConfig(host, options, relativePathToRootTsConfig) {
|
|
|
34
34
|
(0, devkit_1.writeJson)(host, `${options.projectRoot}/tsconfig.json`, json);
|
|
35
35
|
}
|
|
36
36
|
function createAppTsConfig(host, options) {
|
|
37
|
+
const sourceDir = options.useAppDir ? 'app' : 'src';
|
|
38
|
+
// Build include array
|
|
39
|
+
const include = ['.nuxt/nuxt.d.ts', `${sourceDir}/**/*`];
|
|
40
|
+
if (options.useAppDir) {
|
|
41
|
+
include.push('server/**/*');
|
|
42
|
+
}
|
|
43
|
+
// Build exclude array with test patterns
|
|
44
|
+
// Order: extension-grouped (ts, tsx, js, jsx) with test/spec interleaved
|
|
45
|
+
const testExcludes = ['ts', 'tsx', 'js', 'jsx'].flatMap((ext) => ['test', 'spec'].map((type) => `${sourceDir}/**/*.${type}.${ext}`));
|
|
46
|
+
if (options.useAppDir) {
|
|
47
|
+
testExcludes.push(...['ts', 'tsx', 'js', 'jsx'].flatMap((ext) => ['test', 'spec'].map((type) => `server/**/*.${type}.${ext}`)));
|
|
48
|
+
}
|
|
49
|
+
const exclude = [
|
|
50
|
+
'out-tsc',
|
|
51
|
+
'dist',
|
|
52
|
+
'vite.config.ts',
|
|
53
|
+
'vite.config.mts',
|
|
54
|
+
'vitest.config.ts',
|
|
55
|
+
'vitest.config.mts',
|
|
56
|
+
...testExcludes,
|
|
57
|
+
'eslint.config.js',
|
|
58
|
+
'eslint.config.cjs',
|
|
59
|
+
'eslint.config.mjs',
|
|
60
|
+
];
|
|
37
61
|
const json = {
|
|
38
62
|
extends: './tsconfig.json',
|
|
39
63
|
compilerOptions: {
|
|
40
64
|
composite: true,
|
|
65
|
+
rootDir: sourceDir,
|
|
41
66
|
},
|
|
42
|
-
include
|
|
43
|
-
exclude
|
|
67
|
+
include,
|
|
68
|
+
exclude,
|
|
44
69
|
};
|
|
45
70
|
(0, devkit_1.writeJson)(host, `${options.projectRoot}/tsconfig.app.json`, json);
|
|
46
71
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Tree } from 'nx/src/generators/tree';
|
|
2
|
+
export type NuxtDependenciesVersions = {
|
|
3
|
+
nuxt: string;
|
|
4
|
+
nuxtKit: string;
|
|
5
|
+
h3: string;
|
|
6
|
+
nuxtDevtools: string;
|
|
7
|
+
nuxtUiTemplates: string;
|
|
8
|
+
};
|
|
9
|
+
export declare function getNuxtDependenciesVersionsToInstall(tree: Tree): Promise<NuxtDependenciesVersions>;
|
|
10
|
+
export declare function isNuxtV3(tree: Tree): Promise<boolean>;
|
|
11
|
+
export declare function isNuxtV4(tree: Tree): Promise<boolean>;
|
|
12
|
+
export declare function getInstalledNuxtVersion(tree: Tree): string | undefined;
|
|
13
|
+
export declare function getInstalledNuxtMajorVersion(tree: Tree): 3 | 4 | undefined;
|
|
14
|
+
export declare function getInstalledNuxtVersionFromGraph(): Promise<string | undefined>;
|
|
15
|
+
//# sourceMappingURL=version-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/nuxt/src/utils/version-utils.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAanD,MAAM,MAAM,wBAAwB,GAAG;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,wBAAsB,oCAAoC,CACxD,IAAI,EAAE,IAAI,GACT,OAAO,CAAC,wBAAwB,CAAC,CAmBnC;AAED,wBAAsB,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,CAS3D;AAED,wBAAsB,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,CAS3D;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,SAAS,CAetE;AAED,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,SAAS,CAW1E;AAED,wBAAsB,gCAAgC,IAAI,OAAO,CAC/D,MAAM,GAAG,SAAS,CACnB,CAWA"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getNuxtDependenciesVersionsToInstall = getNuxtDependenciesVersionsToInstall;
|
|
4
|
+
exports.isNuxtV3 = isNuxtV3;
|
|
5
|
+
exports.isNuxtV4 = isNuxtV4;
|
|
6
|
+
exports.getInstalledNuxtVersion = getInstalledNuxtVersion;
|
|
7
|
+
exports.getInstalledNuxtMajorVersion = getInstalledNuxtMajorVersion;
|
|
8
|
+
exports.getInstalledNuxtVersionFromGraph = getInstalledNuxtVersionFromGraph;
|
|
9
|
+
const devkit_1 = require("@nx/devkit");
|
|
10
|
+
const semver_1 = require("semver");
|
|
11
|
+
const versions_1 = require("./versions");
|
|
12
|
+
async function getNuxtDependenciesVersionsToInstall(tree) {
|
|
13
|
+
if (await isNuxtV3(tree)) {
|
|
14
|
+
return {
|
|
15
|
+
nuxt: versions_1.nuxtV3Version,
|
|
16
|
+
nuxtKit: versions_1.nuxtKitV3Version,
|
|
17
|
+
h3: versions_1.h3Version,
|
|
18
|
+
nuxtDevtools: versions_1.nuxtDevtoolsV3Version,
|
|
19
|
+
nuxtUiTemplates: versions_1.nuxtUiTemplatesVersion,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
// Default to latest (v4)
|
|
24
|
+
return {
|
|
25
|
+
nuxt: versions_1.nuxtVersion,
|
|
26
|
+
nuxtKit: versions_1.nuxtKitVersion,
|
|
27
|
+
h3: versions_1.h3Version,
|
|
28
|
+
nuxtDevtools: versions_1.nuxtDevtoolsVersion,
|
|
29
|
+
nuxtUiTemplates: versions_1.nuxtUiTemplatesVersion,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
async function isNuxtV3(tree) {
|
|
34
|
+
let installedNuxtVersion = await getInstalledNuxtVersionFromGraph();
|
|
35
|
+
if (!installedNuxtVersion) {
|
|
36
|
+
installedNuxtVersion = getInstalledNuxtVersion(tree);
|
|
37
|
+
}
|
|
38
|
+
if (!installedNuxtVersion) {
|
|
39
|
+
return false; // No Nuxt installed, default to v4
|
|
40
|
+
}
|
|
41
|
+
return (0, semver_1.major)(installedNuxtVersion) === 3;
|
|
42
|
+
}
|
|
43
|
+
async function isNuxtV4(tree) {
|
|
44
|
+
let installedNuxtVersion = await getInstalledNuxtVersionFromGraph();
|
|
45
|
+
if (!installedNuxtVersion) {
|
|
46
|
+
installedNuxtVersion = getInstalledNuxtVersion(tree);
|
|
47
|
+
}
|
|
48
|
+
if (!installedNuxtVersion) {
|
|
49
|
+
return true; // No Nuxt installed, default to v4
|
|
50
|
+
}
|
|
51
|
+
return (0, semver_1.major)(installedNuxtVersion) >= 4;
|
|
52
|
+
}
|
|
53
|
+
function getInstalledNuxtVersion(tree) {
|
|
54
|
+
const installedNuxtVersion = (0, devkit_1.getDependencyVersionFromPackageJson)(tree, 'nuxt');
|
|
55
|
+
if (!installedNuxtVersion ||
|
|
56
|
+
installedNuxtVersion === 'latest' ||
|
|
57
|
+
installedNuxtVersion === 'beta') {
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|
|
60
|
+
return (0, semver_1.clean)(installedNuxtVersion) ?? (0, semver_1.coerce)(installedNuxtVersion)?.version;
|
|
61
|
+
}
|
|
62
|
+
function getInstalledNuxtMajorVersion(tree) {
|
|
63
|
+
const installedNuxtVersion = getInstalledNuxtVersion(tree);
|
|
64
|
+
if (!installedNuxtVersion) {
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
const installedMajor = (0, semver_1.major)(installedNuxtVersion);
|
|
68
|
+
if (installedMajor < 3 || installedMajor > 4) {
|
|
69
|
+
return undefined;
|
|
70
|
+
}
|
|
71
|
+
return installedMajor;
|
|
72
|
+
}
|
|
73
|
+
async function getInstalledNuxtVersionFromGraph() {
|
|
74
|
+
try {
|
|
75
|
+
const graph = await (0, devkit_1.createProjectGraphAsync)();
|
|
76
|
+
const nuxtDep = graph.externalNodes?.['npm:nuxt'];
|
|
77
|
+
if (!nuxtDep) {
|
|
78
|
+
return undefined;
|
|
79
|
+
}
|
|
80
|
+
return (0, semver_1.clean)(nuxtDep.data.version) ?? (0, semver_1.coerce)(nuxtDep.data.version)?.version;
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
return undefined;
|
|
84
|
+
}
|
|
85
|
+
}
|
package/src/utils/versions.d.ts
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
export declare const nxVersion: any;
|
|
2
|
+
export declare const nuxtV4Version = "^4.0.0";
|
|
3
|
+
export declare const nuxtV3Version = "^3.10.0";
|
|
4
|
+
export declare const nuxtVersion = "^4.0.0";
|
|
5
|
+
export declare const nuxtKitV4Version = "^4.0.0";
|
|
6
|
+
export declare const nuxtKitV3Version = "^3.10.0";
|
|
7
|
+
export declare const nuxtKitVersion = "^4.0.0";
|
|
2
8
|
export declare const h3Version = "^1.8.2";
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
9
|
+
export declare const nuxtDevtoolsV4Version = "^3.0.0";
|
|
10
|
+
export declare const nuxtDevtoolsV3Version = "^1.0.0";
|
|
11
|
+
export declare const nuxtDevtoolsVersion = "^3.0.0";
|
|
5
12
|
export declare const nuxtUiTemplatesVersion = "^1.3.1";
|
|
6
|
-
export declare const nuxtEslintConfigVersion = "
|
|
13
|
+
export declare const nuxtEslintConfigVersion = "^1.10.0";
|
|
14
|
+
export declare const nuxtEslintConfigLegacyVersion = "~0.5.6";
|
|
7
15
|
//# sourceMappingURL=versions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../../../../../packages/nuxt/src/utils/versions.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,KAAwC,CAAC;AAG/D,eAAO,MAAM,SAAS,WAAW,CAAC;AAClC,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../../../../../packages/nuxt/src/utils/versions.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,KAAwC,CAAC;AAG/D,eAAO,MAAM,aAAa,WAAW,CAAC;AACtC,eAAO,MAAM,aAAa,YAAY,CAAC;AACvC,eAAO,MAAM,WAAW,WAAgB,CAAC;AAGzC,eAAO,MAAM,gBAAgB,WAAW,CAAC;AACzC,eAAO,MAAM,gBAAgB,YAAY,CAAC;AAC1C,eAAO,MAAM,cAAc,WAAmB,CAAC;AAG/C,eAAO,MAAM,SAAS,WAAW,CAAC;AAClC,eAAO,MAAM,qBAAqB,WAAW,CAAC;AAC9C,eAAO,MAAM,qBAAqB,WAAW,CAAC;AAC9C,eAAO,MAAM,mBAAmB,WAAwB,CAAC;AACzD,eAAO,MAAM,sBAAsB,WAAW,CAAC;AAG/C,eAAO,MAAM,uBAAuB,YAAY,CAAC;AACjD,eAAO,MAAM,6BAA6B,WAAW,CAAC"}
|
package/src/utils/versions.js
CHANGED
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.nuxtEslintConfigVersion = exports.nuxtUiTemplatesVersion = exports.nuxtDevtoolsVersion = exports.
|
|
3
|
+
exports.nuxtEslintConfigLegacyVersion = exports.nuxtEslintConfigVersion = exports.nuxtUiTemplatesVersion = exports.nuxtDevtoolsVersion = exports.nuxtDevtoolsV3Version = exports.nuxtDevtoolsV4Version = exports.h3Version = exports.nuxtKitVersion = exports.nuxtKitV3Version = exports.nuxtKitV4Version = exports.nuxtVersion = exports.nuxtV3Version = exports.nuxtV4Version = exports.nxVersion = void 0;
|
|
4
4
|
exports.nxVersion = require('../../package.json').version;
|
|
5
|
+
// Nuxt versions
|
|
6
|
+
exports.nuxtV4Version = '^4.0.0';
|
|
7
|
+
exports.nuxtV3Version = '^3.10.0';
|
|
8
|
+
exports.nuxtVersion = exports.nuxtV4Version; // Default to v4
|
|
9
|
+
// @nuxt/kit versions (aligned with Nuxt)
|
|
10
|
+
exports.nuxtKitV4Version = '^4.0.0';
|
|
11
|
+
exports.nuxtKitV3Version = '^3.10.0';
|
|
12
|
+
exports.nuxtKitVersion = exports.nuxtKitV4Version;
|
|
5
13
|
// nuxt deps
|
|
6
14
|
exports.h3Version = '^1.8.2';
|
|
7
|
-
exports.
|
|
8
|
-
exports.
|
|
15
|
+
exports.nuxtDevtoolsV4Version = '^3.0.0';
|
|
16
|
+
exports.nuxtDevtoolsV3Version = '^1.0.0';
|
|
17
|
+
exports.nuxtDevtoolsVersion = exports.nuxtDevtoolsV4Version;
|
|
9
18
|
exports.nuxtUiTemplatesVersion = '^1.3.1';
|
|
10
|
-
// linting deps
|
|
11
|
-
exports.nuxtEslintConfigVersion = '
|
|
19
|
+
// linting deps - version-aware for flat config vs legacy
|
|
20
|
+
exports.nuxtEslintConfigVersion = '^1.10.0'; // For flat config (Nuxt v4+) - uses createConfigForNuxt
|
|
21
|
+
exports.nuxtEslintConfigLegacyVersion = '~0.5.6'; // For legacy .eslintrc.json (Nuxt v3)
|