@nx/next 22.1.0-canary.20251029-4a07faf → 22.1.0-canary.20251106-e9146c7
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 +11 -11
- package/plugins/with-nx.d.ts.map +1 -1
- package/plugins/with-nx.js +11 -4
- package/src/executors/build/build.impl.d.ts.map +1 -1
- package/src/executors/build/build.impl.js +31 -3
- package/src/executors/build/schema.json +8 -0
- package/src/executors/server/schema.json +5 -1
- package/src/executors/server/server.impl.d.ts.map +1 -1
- package/src/executors/server/server.impl.js +36 -2
- package/src/generators/application/application.d.ts.map +1 -1
- package/src/generators/application/application.js +9 -3
- package/src/generators/application/files/common/next-env.d.ts__tmpl__ +2 -1
- package/src/generators/application/files/common/tsconfig.json__tmpl__ +1 -1
- package/src/generators/application/lib/add-e2e.d.ts.map +1 -1
- package/src/generators/application/lib/add-e2e.js +4 -2
- package/src/generators/application/lib/add-jest.d.ts.map +1 -1
- package/src/generators/application/lib/add-jest.js +2 -2
- package/src/generators/application/lib/add-linting.d.ts.map +1 -1
- package/src/generators/application/lib/add-linting.js +18 -9
- package/src/generators/application/lib/create-application-files.d.ts +1 -1
- package/src/generators/application/lib/create-application-files.d.ts.map +1 -1
- package/src/generators/application/lib/create-application-files.js +3 -1
- package/src/utils/jest-config-util.d.ts.map +1 -1
- package/src/utils/jest-config-util.js +14 -3
- package/src/utils/runtime-version-utils.d.ts +8 -0
- package/src/utils/runtime-version-utils.d.ts.map +1 -0
- package/src/utils/runtime-version-utils.js +28 -0
- package/src/utils/types.d.ts +3 -0
- package/src/utils/types.d.ts.map +1 -1
- package/src/utils/version-utils.d.ts +4 -0
- package/src/utils/version-utils.d.ts.map +1 -1
- package/src/utils/version-utils.js +33 -0
- package/src/utils/versions.d.ts +7 -2
- package/src/utils/versions.d.ts.map +1 -1
- package/src/utils/versions.js +8 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/next",
|
|
3
|
-
"version": "22.1.0-canary.
|
|
3
|
+
"version": "22.1.0-canary.20251106-e9146c7",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Next.js plugin for Nx contains executors and generators for managing Next.js applications and libraries within an Nx workspace. It provides:\n\n\n- Scaffolding for creating, building, serving, linting, and testing Next.js applications.\n\n- Integration with building, serving, and exporting a Next.js application.\n\n- Integration with React libraries within the workspace. \n\nWhen using Next.js in Nx, you get the out-of-the-box support for TypeScript, Playwright, Cypress, and Jest. No need to configure anything: watch mode, source maps, and typings just work.",
|
|
6
6
|
"repository": {
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
"migrations": "./migrations.json"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"next": ">=14.0.0"
|
|
35
|
+
"next": ">=14.0.0 <17.0.0"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@nx/devkit": "22.1.0-canary.
|
|
38
|
+
"@nx/devkit": "22.1.0-canary.20251106-e9146c7",
|
|
39
39
|
"@babel/plugin-proposal-decorators": "^7.22.7",
|
|
40
40
|
"@svgr/webpack": "^8.1.0",
|
|
41
41
|
"copy-webpack-plugin": "^10.2.4",
|
|
@@ -44,17 +44,17 @@
|
|
|
44
44
|
"semver": "^7.6.3",
|
|
45
45
|
"tslib": "^2.3.0",
|
|
46
46
|
"webpack-merge": "^5.8.0",
|
|
47
|
-
"@nx/js": "22.1.0-canary.
|
|
48
|
-
"@nx/eslint": "22.1.0-canary.
|
|
49
|
-
"@nx/react": "22.1.0-canary.
|
|
50
|
-
"@nx/web": "22.1.0-canary.
|
|
51
|
-
"@nx/webpack": "22.1.0-canary.
|
|
47
|
+
"@nx/js": "22.1.0-canary.20251106-e9146c7",
|
|
48
|
+
"@nx/eslint": "22.1.0-canary.20251106-e9146c7",
|
|
49
|
+
"@nx/react": "22.1.0-canary.20251106-e9146c7",
|
|
50
|
+
"@nx/web": "22.1.0-canary.20251106-e9146c7",
|
|
51
|
+
"@nx/webpack": "22.1.0-canary.20251106-e9146c7",
|
|
52
52
|
"@phenomnomnominal/tsquery": "~5.0.1"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@nx/cypress": "22.1.0-canary.
|
|
56
|
-
"@nx/playwright": "22.1.0-canary.
|
|
57
|
-
"nx": "22.1.0-canary.
|
|
55
|
+
"@nx/cypress": "22.1.0-canary.20251106-e9146c7",
|
|
56
|
+
"@nx/playwright": "22.1.0-canary.20251106-e9146c7",
|
|
57
|
+
"nx": "22.1.0-canary.20251106-e9146c7"
|
|
58
58
|
},
|
|
59
59
|
"publishConfig": {
|
|
60
60
|
"access": "public"
|
package/plugins/with-nx.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"with-nx.d.ts","sourceRoot":"","sources":["../../../../packages/next/plugins/with-nx.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAGL,KAAK,uBAAuB,EAE7B,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"with-nx.d.ts","sourceRoot":"","sources":["../../../../packages/next/plugins/with-nx.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAGL,KAAK,uBAAuB,EAE7B,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAGpD,MAAM,WAAW,aAAc,SAAQ,UAAU;IAC/C,EAAE,CAAC,EAAE;QACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;QAC9B,gBAAgB,CAAC,EAAE;YAAE,OAAO,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;QACvD,MAAM,CAAC,EAAE,gBAAgB,EAAE,CAAC;KAC7B,CAAC;CACH;AAED,MAAM,WAAW,aAAa;IAC5B,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;CACjB;AA+ED;;GAEG;AACH,iBAAS,MAAM,CACb,WAAW,GAAS,aAAa,EACjC,OAAO,GAAE,aAAkC,GAC1C,YAAY,CA0Hd;AAED,wBAAgB,aAAa,CAC3B,UAAU,GAAS,aAAa,EAChC,OAAO,GAAE,aAAkC,GAC1C,UAAU,CAiIZ;AAED,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,uBAAuB,EAC7B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GAC9B,IAAI,GAAG,MAAM,CAcf;AAGD,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,IAAI,QAM3D;AASD,OAAO,EAAE,MAAM,EAAE,CAAC"}
|
package/plugins/with-nx.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.getNextConfig = getNextConfig;
|
|
|
4
4
|
exports.getAliasForProject = getAliasForProject;
|
|
5
5
|
exports.forNextVersion = forNextVersion;
|
|
6
6
|
exports.withNx = withNx;
|
|
7
|
+
const semver_1 = require("semver");
|
|
7
8
|
function regexEqual(x, y) {
|
|
8
9
|
return (x instanceof RegExp &&
|
|
9
10
|
y instanceof RegExp &&
|
|
@@ -150,12 +151,18 @@ function getNextConfig(nextConfig = {}, context = getWithNxContext()) {
|
|
|
150
151
|
}
|
|
151
152
|
const userWebpack = nextConfig.webpack || ((x) => x);
|
|
152
153
|
const { nx, ...validNextConfig } = nextConfig;
|
|
153
|
-
|
|
154
|
-
|
|
154
|
+
const baseConfig = {
|
|
155
|
+
...validNextConfig,
|
|
156
|
+
};
|
|
157
|
+
const nextJsVersion = require('next/package.json')?.version ?? '16.0.1';
|
|
158
|
+
if ((0, semver_1.satisfies)(nextJsVersion, '<16.0.0', { includePrerelease: true })) {
|
|
159
|
+
baseConfig.eslint = {
|
|
155
160
|
ignoreDuringBuilds: true,
|
|
156
161
|
...(validNextConfig.eslint ?? {}),
|
|
157
|
-
}
|
|
158
|
-
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
return {
|
|
165
|
+
...baseConfig,
|
|
159
166
|
webpack: (config, options) => {
|
|
160
167
|
/**
|
|
161
168
|
* To support ESM library export, we need to ensure the extensionAlias contains both `.js` and `.ts` extensions.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/next/src/executors/build/build.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EAKhB,MAAM,YAAY,CAAC;AAWpB,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"build.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/next/src/executors/build/build.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EAKhB,MAAM,YAAY,CAAC;AAWpB,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAQ5D,wBAA8B,aAAa,CACzC,OAAO,EAAE,uBAAuB,EAChC,OAAO,EAAE,eAAe;;GAoGzB"}
|
|
@@ -14,6 +14,7 @@ const check_project_1 = require("./lib/check-project");
|
|
|
14
14
|
const child_process_1 = require("child_process");
|
|
15
15
|
const create_cli_options_1 = require("../../utils/create-cli-options");
|
|
16
16
|
const internal_1 = require("@nx/devkit/internal");
|
|
17
|
+
const runtime_version_utils_1 = require("../../utils/runtime-version-utils");
|
|
17
18
|
let childProcess;
|
|
18
19
|
async function buildExecutor(options, context) {
|
|
19
20
|
// Cast to any to overwrite NODE_ENV
|
|
@@ -89,16 +90,43 @@ async function buildExecutor(options, context) {
|
|
|
89
90
|
return { success: true };
|
|
90
91
|
}
|
|
91
92
|
function runCliBuild(workspaceRoot, projectRoot, options) {
|
|
92
|
-
const { experimentalAppOnly, experimentalBuildMode, profile, debug, outputPath, } = options;
|
|
93
|
+
const { experimentalAppOnly, experimentalBuildMode, profile, debug, outputPath, turbo, webpack, } = options;
|
|
93
94
|
// Set output path here since it can also be set via CLI
|
|
94
95
|
// We can retrieve it inside plugins/with-nx
|
|
95
96
|
process.env.NX_NEXT_OUTPUT_PATH ??= outputPath;
|
|
96
|
-
|
|
97
|
+
// Check for conflicting flags
|
|
98
|
+
if (turbo && webpack) {
|
|
99
|
+
throw new Error('Cannot specify both --turbo and --webpack flags. Please use only one bundler option.');
|
|
100
|
+
}
|
|
101
|
+
// Determine bundler flag based on Next.js version and options
|
|
102
|
+
const cliOptions = {
|
|
97
103
|
experimentalAppOnly,
|
|
98
104
|
experimentalBuildMode,
|
|
99
105
|
profile,
|
|
100
106
|
debug,
|
|
101
|
-
}
|
|
107
|
+
};
|
|
108
|
+
const nextJsVersion = (0, runtime_version_utils_1.getInstalledNextVersionRuntime)();
|
|
109
|
+
const isNext16Plus = nextJsVersion !== null && nextJsVersion >= 16;
|
|
110
|
+
if (isNext16Plus) {
|
|
111
|
+
// Next.js 16+: Turbopack is default, use --webpack to opt-in to webpack
|
|
112
|
+
if (webpack) {
|
|
113
|
+
cliOptions.webpack = true;
|
|
114
|
+
devkit_1.logger.info('Using webpack bundler for build (Next.js 16+ detected)');
|
|
115
|
+
}
|
|
116
|
+
else if (turbo) {
|
|
117
|
+
devkit_1.logger.warn('The --turbo flag is redundant in Next.js 16+ as Turbopack is now the default bundler. You can remove this flag.');
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
// Next.js 15 and below: webpack is default, use --turbo to opt-in to turbopack
|
|
122
|
+
if (turbo) {
|
|
123
|
+
cliOptions.turbo = true;
|
|
124
|
+
}
|
|
125
|
+
else if (webpack) {
|
|
126
|
+
devkit_1.logger.warn('The --webpack flag is only applicable in Next.js 16 and above. It will be ignored.');
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
const args = (0, create_cli_options_1.createCliOptions)(cliOptions);
|
|
102
130
|
return new Promise((resolve, reject) => {
|
|
103
131
|
childProcess = (0, child_process_1.fork)(require.resolve('next/dist/bin/next'), ['build', ...args], {
|
|
104
132
|
cwd: (0, path_1.resolve)(workspaceRoot, projectRoot),
|
|
@@ -82,6 +82,14 @@
|
|
|
82
82
|
"type": "string",
|
|
83
83
|
"description": "Change the build mode.",
|
|
84
84
|
"enum": ["compile", "generate"]
|
|
85
|
+
},
|
|
86
|
+
"turbo": {
|
|
87
|
+
"type": "boolean",
|
|
88
|
+
"description": "Use Turbopack for building (Next.js 15 and below). In Next.js 16+, Turbopack is enabled by default."
|
|
89
|
+
},
|
|
90
|
+
"webpack": {
|
|
91
|
+
"type": "boolean",
|
|
92
|
+
"description": "Use webpack bundler instead of Turbopack (Next.js 16+ only). This flag is only applicable in Next.js 16 and above where Turbopack is the default."
|
|
85
93
|
}
|
|
86
94
|
},
|
|
87
95
|
"required": ["outputPath"],
|
|
@@ -52,7 +52,11 @@
|
|
|
52
52
|
},
|
|
53
53
|
"turbo": {
|
|
54
54
|
"type": "boolean",
|
|
55
|
-
"description": "Activate
|
|
55
|
+
"description": "Activate Turbopack for Next.js (Next.js 15 and below). In Next.js 16+, Turbopack is enabled by default for development mode."
|
|
56
|
+
},
|
|
57
|
+
"webpack": {
|
|
58
|
+
"type": "boolean",
|
|
59
|
+
"description": "Use webpack bundler instead of Turbopack (Next.js 16+ only). This flag is only applicable in Next.js 16 and above where Turbopack is the default for development mode."
|
|
56
60
|
},
|
|
57
61
|
"experimentalHttps": {
|
|
58
62
|
"type": "boolean",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/next/src/executors/server/server.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,
|
|
1
|
+
{"version":3,"file":"server.impl.d.ts","sourceRoot":"","sources":["../../../../../../packages/next/src/executors/server/server.impl.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAIhB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAEL,uBAAuB,EACxB,MAAM,mBAAmB,CAAC;AAQ3B,wBAA+B,aAAa,CAC1C,OAAO,EAAE,uBAAuB,EAChC,OAAO,EAAE,eAAe;;;cAqHzB"}
|
|
@@ -8,6 +8,7 @@ const custom_server_impl_1 = require("./custom-server.impl");
|
|
|
8
8
|
const create_cli_options_1 = require("../../utils/create-cli-options");
|
|
9
9
|
const async_iterable_1 = require("@nx/devkit/src/utils/async-iterable");
|
|
10
10
|
const wait_for_port_open_1 = require("@nx/web/src/utils/wait-for-port-open");
|
|
11
|
+
const runtime_version_utils_1 = require("../../utils/runtime-version-utils");
|
|
11
12
|
async function* serveExecutor(options, context) {
|
|
12
13
|
const buildOptions = (0, devkit_1.readTargetOptions)((0, devkit_1.parseTargetString)(options.buildTarget, context), context);
|
|
13
14
|
const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
|
|
@@ -32,10 +33,43 @@ async function* serveExecutor(options, context) {
|
|
|
32
33
|
args.push(`--keepAliveTimeout=${keepAliveTimeout}`);
|
|
33
34
|
}
|
|
34
35
|
const mode = options.dev ? 'dev' : 'start';
|
|
35
|
-
|
|
36
|
+
// Determine bundler flag based on Next.js version and options
|
|
37
|
+
let bundlerFlag = '';
|
|
38
|
+
if (options.dev) {
|
|
39
|
+
// Check for conflicting flags
|
|
40
|
+
if (options.turbo && options.webpack) {
|
|
41
|
+
throw new Error('Cannot specify both --turbo and --webpack flags. Please use only one bundler option.');
|
|
42
|
+
}
|
|
43
|
+
const nextJsVersion = (0, runtime_version_utils_1.getInstalledNextVersionRuntime)();
|
|
44
|
+
const isNext16Plus = nextJsVersion !== null && nextJsVersion >= 16;
|
|
45
|
+
if (isNext16Plus) {
|
|
46
|
+
// Next.js 16+: Turbopack is default, use --webpack to opt-in to webpack
|
|
47
|
+
if (options.webpack) {
|
|
48
|
+
bundlerFlag = '--webpack';
|
|
49
|
+
devkit_1.logger.info('Using webpack bundler (Next.js 16+ detected)');
|
|
50
|
+
}
|
|
51
|
+
else if (options.turbo) {
|
|
52
|
+
devkit_1.logger.warn('The --turbo flag is redundant in Next.js 16+ as Turbopack is now the default bundler. You can remove this flag.');
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
// Next.js 15 and below: webpack is default, use --turbo to opt-in to turbopack
|
|
57
|
+
if (options.turbo) {
|
|
58
|
+
bundlerFlag = '--turbo';
|
|
59
|
+
}
|
|
60
|
+
else if (options.webpack) {
|
|
61
|
+
devkit_1.logger.warn('The --webpack flag is only applicable in Next.js 16 and above. It will be ignored.');
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
36
65
|
const nextBin = require.resolve('next/dist/bin/next');
|
|
37
66
|
yield* (0, async_iterable_1.createAsyncIterable)(async ({ done, next, error }) => {
|
|
38
|
-
const server = (0, child_process_1.fork)(nextBin, [
|
|
67
|
+
const server = (0, child_process_1.fork)(nextBin, [
|
|
68
|
+
mode,
|
|
69
|
+
...args,
|
|
70
|
+
bundlerFlag,
|
|
71
|
+
...getExperimentalHttpsFlags(options),
|
|
72
|
+
].filter((arg) => arg !== ''), {
|
|
39
73
|
cwd: options.dev ? projectRoot : nextDir,
|
|
40
74
|
stdio: 'inherit',
|
|
41
75
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../../../../../packages/next/src/generators/application/application.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,
|
|
1
|
+
{"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../../../../../packages/next/src/generators/application/application.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,iBAAiB,EAIjB,IAAI,EACL,MAAM,YAAY,CAAC;AAUpB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAwBlC,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAMpE;AAED,wBAAsB,4BAA4B,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAmI5E"}
|
|
@@ -25,6 +25,7 @@ const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-set
|
|
|
25
25
|
const sort_fields_1 = require("@nx/js/src/utils/package-json/sort-fields");
|
|
26
26
|
const add_swc_to_custom_server_1 = require("../../utils/add-swc-to-custom-server");
|
|
27
27
|
const jest_config_util_1 = require("../../utils/jest-config-util");
|
|
28
|
+
const version_utils_2 = require("../../utils/version-utils");
|
|
28
29
|
async function applicationGenerator(host, schema) {
|
|
29
30
|
return await applicationGeneratorInternal(host, {
|
|
30
31
|
addPlugin: false,
|
|
@@ -51,25 +52,30 @@ async function applicationGeneratorInternal(host, schema) {
|
|
|
51
52
|
skipFormat: true,
|
|
52
53
|
});
|
|
53
54
|
tasks.push(nextTask);
|
|
54
|
-
(0, create_application_files_1.createApplicationFiles)(host, options);
|
|
55
|
+
await (0, create_application_files_1.createApplicationFiles)(host, options);
|
|
55
56
|
(0, add_project_1.addProject)(host, options);
|
|
56
57
|
// If we are using the new TS solution
|
|
57
58
|
// We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
|
|
58
59
|
if (options.isTsSolutionSetup) {
|
|
59
60
|
await (0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(host, options.appProjectRoot);
|
|
60
61
|
}
|
|
62
|
+
const lintTask = await (0, add_linting_1.addLinting)(host, options);
|
|
63
|
+
tasks.push(lintTask);
|
|
61
64
|
const e2eTask = await (0, add_e2e_1.addE2e)(host, options);
|
|
62
65
|
tasks.push(e2eTask);
|
|
63
66
|
const jestTask = await (0, add_jest_1.addJest)(host, options);
|
|
64
67
|
tasks.push(jestTask);
|
|
65
|
-
const lintTask = await (0, add_linting_1.addLinting)(host, options);
|
|
66
|
-
tasks.push(lintTask);
|
|
67
68
|
if (options.style === 'tailwind') {
|
|
68
69
|
const tailwindTask = await (0, setup_tailwind_1.setupTailwindGenerator)(host, {
|
|
69
70
|
project: options.projectName,
|
|
70
71
|
});
|
|
71
72
|
tasks.push(tailwindTask);
|
|
72
73
|
}
|
|
74
|
+
// LESS is not currrently supported with Turbopack
|
|
75
|
+
// Turbopack is default in Next 16, set to webpack
|
|
76
|
+
if (options.style === 'less' && (await (0, version_utils_2.isNext16)(host))) {
|
|
77
|
+
devkit_1.logger.warn("NX LESS is only supported with Webpack bundler. Please ensure you run your application with '--webpack'.");
|
|
78
|
+
}
|
|
73
79
|
const styledTask = (0, styles_1.addStyleDependencies)(host, {
|
|
74
80
|
style: options.style,
|
|
75
81
|
swc: !host.exists((0, devkit_1.joinPathFragments)(options.appProjectRoot, '.babelrc')),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="next" />
|
|
2
|
-
/// <reference types="next/image-types/global"
|
|
2
|
+
/// <reference types="next/image-types/global" /><% if(isNext16) { %>
|
|
3
|
+
import './.next/types/routes.d.ts';<% } %>
|
|
3
4
|
|
|
4
5
|
// NOTE: This file should not be edited
|
|
5
6
|
// see https://nextjs.org/docs/<%- appDirType %>/api-reference/config/typescript for more information.
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
<% } %>
|
|
33
33
|
"next-env.d.ts"
|
|
34
34
|
],
|
|
35
|
-
"exclude": ["node_modules", "jest.config.ts", "<%= rootPath %>**/*.spec.ts", "<%= rootPath %>**/*.test.ts"]
|
|
35
|
+
"exclude": ["node_modules", "jest.config.ts", "jest.config.cts", "<%= rootPath %>**/*.spec.ts", "<%= rootPath %>**/*.test.ts"]
|
|
36
36
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-e2e.d.ts","sourceRoot":"","sources":["../../../../../../../packages/next/src/generators/application/lib/add-e2e.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,IAAI,EACJ,iBAAiB,EAElB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"add-e2e.d.ts","sourceRoot":"","sources":["../../../../../../../packages/next/src/generators/application/lib/add-e2e.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,IAAI,EACJ,iBAAiB,EAElB,MAAM,YAAY,CAAC;AAMpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,wBAAsB,MAAM,CAC1B,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,iBAAiB,CAAC,CAmI5B"}
|
|
@@ -5,12 +5,14 @@ const devkit_1 = require("@nx/devkit");
|
|
|
5
5
|
const e2e_web_server_info_utils_1 = require("@nx/devkit/src/generators/e2e-web-server-info-utils");
|
|
6
6
|
const web_1 = require("@nx/web");
|
|
7
7
|
const versions_1 = require("../../../utils/versions");
|
|
8
|
+
const version_utils_1 = require("../../../utils/version-utils");
|
|
8
9
|
async function addE2e(host, options) {
|
|
9
10
|
const nxJson = (0, devkit_1.readNxJson)(host);
|
|
10
11
|
const hasPlugin = nxJson.plugins?.some((p) => typeof p === 'string'
|
|
11
12
|
? p === '@nx/next/plugin'
|
|
12
13
|
: p.plugin === '@nx/next/plugin');
|
|
13
14
|
const e2eWebServerInfo = await getNextE2EWebServerInfo(host, options.projectName, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'next.config.js'), options.addPlugin);
|
|
15
|
+
const forceWebpack = options.style === 'less' && (await (0, version_utils_1.isNext16)(host));
|
|
14
16
|
if (options.e2eTestRunner === 'cypress') {
|
|
15
17
|
const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/cypress', versions_1.nxVersion);
|
|
16
18
|
if (!hasPlugin) {
|
|
@@ -54,7 +56,7 @@ async function addE2e(host, options) {
|
|
|
54
56
|
baseUrl: e2eWebServerInfo.e2eWebServerAddress,
|
|
55
57
|
jsx: true,
|
|
56
58
|
webServerCommands: {
|
|
57
|
-
default: e2eWebServerInfo.e2eWebServerCommand
|
|
59
|
+
default: `${e2eWebServerInfo.e2eWebServerCommand}${forceWebpack ? ' --webpack' : ''}`,
|
|
58
60
|
},
|
|
59
61
|
ciWebServerCommand: e2eWebServerInfo.e2eCiWebServerCommand,
|
|
60
62
|
ciBaseUrl: e2eWebServerInfo.e2eCiBaseUrl,
|
|
@@ -96,7 +98,7 @@ async function addE2e(host, options) {
|
|
|
96
98
|
linter: options.linter,
|
|
97
99
|
setParserOptionsProject: options.setParserOptionsProject,
|
|
98
100
|
webServerAddress: e2eWebServerInfo.e2eCiBaseUrl,
|
|
99
|
-
webServerCommand: e2eWebServerInfo.
|
|
101
|
+
webServerCommand: `${e2eWebServerInfo.e2eWebServerCommand}${forceWebpack ? ' --webpack' : ''}`,
|
|
100
102
|
addPlugin: options.addPlugin,
|
|
101
103
|
});
|
|
102
104
|
return e2eTask;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-jest.d.ts","sourceRoot":"","sources":["../../../../../../../packages/next/src/generators/application/lib/add-jest.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,IAAI,EAEJ,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,wBAAsB,OAAO,CAC3B,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,iBAAiB,CAAC,
|
|
1
|
+
{"version":3,"file":"add-jest.d.ts","sourceRoot":"","sources":["../../../../../../../packages/next/src/generators/application/lib/add-jest.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,IAAI,EAEJ,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,wBAAsB,OAAO,CAC3B,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,iBAAiB,CAAC,CA2D5B"}
|
|
@@ -27,10 +27,10 @@ async function addJest(host, options) {
|
|
|
27
27
|
});
|
|
28
28
|
(0, devkit_1.updateJson)(host, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.spec.json'), (json) => {
|
|
29
29
|
json.compilerOptions.jsx = 'react';
|
|
30
|
-
// have to override exclude otherwise lint will fail with setParserOptionsProject and jest.config.ts
|
|
30
|
+
// have to override exclude otherwise lint will fail with setParserOptionsProject and jest.config.ts/jest.config.cts
|
|
31
31
|
if (options.setParserOptionsProject) {
|
|
32
32
|
const tsConfig = (0, devkit_1.readJson)(host, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.json'));
|
|
33
|
-
json.exclude = tsConfig.exclude.filter((e) => e !== 'jest.config.ts');
|
|
33
|
+
json.exclude = tsConfig.exclude.filter((e) => e !== 'jest.config.ts' && e !== 'jest.config.cts');
|
|
34
34
|
}
|
|
35
35
|
return json;
|
|
36
36
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-linting.d.ts","sourceRoot":"","sources":["../../../../../../../packages/next/src/generators/application/lib/add-linting.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,iBAAiB,EAGjB,IAAI,EACL,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"add-linting.d.ts","sourceRoot":"","sources":["../../../../../../../packages/next/src/generators/application/lib/add-linting.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,iBAAiB,EAGjB,IAAI,EACL,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAgBvD,wBAAsB,UAAU,CAC9B,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,iBAAiB,CAAC,CAiG5B"}
|
|
@@ -5,7 +5,7 @@ const eslint_1 = require("@nx/eslint");
|
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const lint_1 = require("@nx/react/src/utils/lint");
|
|
7
7
|
const eslint_file_1 = require("@nx/eslint/src/generators/utils/eslint-file");
|
|
8
|
-
const
|
|
8
|
+
const version_utils_1 = require("../../../utils/version-utils");
|
|
9
9
|
const flat_config_1 = require("@nx/eslint/src/utils/flat-config");
|
|
10
10
|
async function addLinting(host, options) {
|
|
11
11
|
if (options.linter !== 'eslint')
|
|
@@ -26,12 +26,20 @@ async function addLinting(host, options) {
|
|
|
26
26
|
if (options.linter === 'eslint' && (0, eslint_file_1.isEslintConfigSupported)(host)) {
|
|
27
27
|
if ((0, flat_config_1.useFlatConfig)(host)) {
|
|
28
28
|
(0, eslint_file_1.addPredefinedConfigToFlatLintConfig)(host, options.appProjectRoot, 'flat/react-typescript');
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
if (await (0, version_utils_1.isNext16)(host)) {
|
|
30
|
+
(0, eslint_file_1.addPluginsToLintConfig)(host, options.appProjectRoot, ['@next/next']);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
// Since Next.js < 16 does not support flat configs yet, we need to use compat fixup.
|
|
34
|
+
const addExtendsTask = (0, eslint_file_1.addExtendsToLintConfig)(host, options.appProjectRoot, [
|
|
35
|
+
{ name: 'next', needCompatFixup: true },
|
|
36
|
+
{
|
|
37
|
+
name: 'next/core-web-vitals',
|
|
38
|
+
needCompatFixup: true,
|
|
39
|
+
},
|
|
40
|
+
]);
|
|
41
|
+
tasks.push(addExtendsTask);
|
|
42
|
+
}
|
|
35
43
|
}
|
|
36
44
|
else {
|
|
37
45
|
const addExtendsTask = (0, eslint_file_1.addExtendsToLintConfig)(host, options.appProjectRoot, [
|
|
@@ -61,10 +69,11 @@ async function addLinting(host, options) {
|
|
|
61
69
|
]);
|
|
62
70
|
}
|
|
63
71
|
if (!options.skipPackageJson) {
|
|
72
|
+
const eslintConfigNextVersion = await (0, version_utils_1.getEslintConfigNextDependenciesVersionsToInstall)(host);
|
|
64
73
|
tasks.push((0, devkit_1.addDependenciesToPackageJson)(host, lint_1.extraEslintDependencies.dependencies, {
|
|
65
74
|
...lint_1.extraEslintDependencies.devDependencies,
|
|
66
|
-
'eslint-config-next':
|
|
67
|
-
'@next/eslint-plugin-next':
|
|
75
|
+
'eslint-config-next': eslintConfigNextVersion,
|
|
76
|
+
'@next/eslint-plugin-next': eslintConfigNextVersion,
|
|
68
77
|
}));
|
|
69
78
|
}
|
|
70
79
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Tree } from '@nx/devkit';
|
|
2
2
|
import { NormalizedSchema } from './normalize-options';
|
|
3
|
-
export declare function createApplicationFiles(host: Tree, options: NormalizedSchema): void
|
|
3
|
+
export declare function createApplicationFiles(host: Tree, options: NormalizedSchema): Promise<void>;
|
|
4
4
|
//# sourceMappingURL=create-application-files.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-application-files.d.ts","sourceRoot":"","sources":["../../../../../../../packages/next/src/generators/application/lib/create-application-files.ts"],"names":[],"mappings":"AACA,OAAO,EAOL,IAAI,EAEL,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"create-application-files.d.ts","sourceRoot":"","sources":["../../../../../../../packages/next/src/generators/application/lib/create-application-files.ts"],"names":[],"mappings":"AACA,OAAO,EAOL,IAAI,EAEL,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAQvD,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,gBAAgB,iBA0K1B"}
|
|
@@ -6,7 +6,8 @@ const devkit_1 = require("@nx/devkit");
|
|
|
6
6
|
const js_1 = require("@nx/js");
|
|
7
7
|
const create_application_files_helpers_1 = require("./create-application-files.helpers");
|
|
8
8
|
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
9
|
-
|
|
9
|
+
const version_utils_1 = require("../../../utils/version-utils");
|
|
10
|
+
async function createApplicationFiles(host, options) {
|
|
10
11
|
const offsetFromRoot = (0, devkit_1.offsetFromRoot)(options.appProjectRoot);
|
|
11
12
|
const layoutTypeSrcPath = (0, devkit_1.joinPathFragments)(offsetFromRoot, options.appProjectRoot, '.next/types/**/*.ts');
|
|
12
13
|
const layoutTypeDistPath = (0, devkit_1.joinPathFragments)(offsetFromRoot, options.outputPath, '.next/types/**/*.ts');
|
|
@@ -33,6 +34,7 @@ function createApplicationFiles(host, options) {
|
|
|
33
34
|
pageStyleContent: `.page {}`,
|
|
34
35
|
stylesExt: options.style === 'less' ? options.style : 'css',
|
|
35
36
|
isUsingTsSolutionSetup: (0, ts_solution_setup_1.isUsingTsSolutionSetup)(host),
|
|
37
|
+
isNext16: await (0, version_utils_1.isNext16)(host),
|
|
36
38
|
};
|
|
37
39
|
const generatedAppFilePath = options.src
|
|
38
40
|
? (0, path_1.join)(options.appProjectRoot, 'src')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jest-config-util.d.ts","sourceRoot":"","sources":["../../../../../packages/next/src/utils/jest-config-util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAkB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"jest-config-util.d.ts","sourceRoot":"","sources":["../../../../../packages/next/src/utils/jest-config-util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAkB,MAAM,YAAY,CAAC;AAelD,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,IAAI,EACV,OAAO,EAAE;IACP,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,QAwDF"}
|
|
@@ -2,16 +2,27 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.updateJestConfig = updateJestConfig;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
function findProjectJestConfig(host, projectRoot) {
|
|
6
|
+
const extensions = ['js', 'ts', 'cts'];
|
|
7
|
+
for (const ext of extensions) {
|
|
8
|
+
const configPath = `${projectRoot}/jest.config.${ext}`;
|
|
9
|
+
if (host.exists(configPath)) {
|
|
10
|
+
return configPath;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
5
15
|
function updateJestConfig(host, options) {
|
|
6
16
|
if (options.unitTestRunner !== 'jest') {
|
|
7
17
|
return;
|
|
8
18
|
}
|
|
9
|
-
const configPath =
|
|
10
|
-
if (!
|
|
19
|
+
const configPath = findProjectJestConfig(host, options.projectRoot);
|
|
20
|
+
if (!configPath)
|
|
11
21
|
return;
|
|
12
22
|
const offset = (0, devkit_1.offsetFromRoot)(options.projectRoot);
|
|
23
|
+
const isCommonJS = configPath.endsWith('.js') || configPath.endsWith('.cts');
|
|
13
24
|
// Easier to override the whole file rather than replace content since the structure has changed with `next/jest.js` being used.
|
|
14
|
-
const newContent =
|
|
25
|
+
const newContent = isCommonJS
|
|
15
26
|
? `const nextJest = require('next/jest.js');
|
|
16
27
|
|
|
17
28
|
const createJestConfig = nextJest({
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get the installed Next.js major version at runtime without requiring a Tree object.
|
|
3
|
+
* This is useful for executors that need to detect the Next.js version during execution.
|
|
4
|
+
*
|
|
5
|
+
* @returns The major version number of the installed Next.js package, or null if not found
|
|
6
|
+
*/
|
|
7
|
+
export declare function getInstalledNextVersionRuntime(): number | null;
|
|
8
|
+
//# sourceMappingURL=runtime-version-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-version-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/next/src/utils/runtime-version-utils.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,wBAAgB,8BAA8B,IAAI,MAAM,GAAG,IAAI,CAgB9D"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getInstalledNextVersionRuntime = getInstalledNextVersionRuntime;
|
|
4
|
+
const semver_1 = require("semver");
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
/**
|
|
7
|
+
* Get the installed Next.js major version at runtime without requiring a Tree object.
|
|
8
|
+
* This is useful for executors that need to detect the Next.js version during execution.
|
|
9
|
+
*
|
|
10
|
+
* @returns The major version number of the installed Next.js package, or null if not found
|
|
11
|
+
*/
|
|
12
|
+
function getInstalledNextVersionRuntime() {
|
|
13
|
+
try {
|
|
14
|
+
const nextPackageJsonPath = require.resolve('next/package.json', {
|
|
15
|
+
paths: [process.cwd()],
|
|
16
|
+
});
|
|
17
|
+
const nextPackageJson = (0, devkit_1.readJsonFile)(nextPackageJsonPath);
|
|
18
|
+
const cleanedVersion = (0, semver_1.clean)(nextPackageJson.version) ??
|
|
19
|
+
(0, semver_1.coerce)(nextPackageJson.version)?.version;
|
|
20
|
+
if (!cleanedVersion) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
return (0, semver_1.major)(cleanedVersion);
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
}
|
package/src/utils/types.d.ts
CHANGED
|
@@ -34,7 +34,9 @@ export interface NextBuildBuilderOptions {
|
|
|
34
34
|
profile?: boolean;
|
|
35
35
|
skipOverrides?: boolean;
|
|
36
36
|
skipPackageManager?: boolean;
|
|
37
|
+
turbo?: boolean;
|
|
37
38
|
watch?: boolean;
|
|
39
|
+
webpack?: boolean;
|
|
38
40
|
}
|
|
39
41
|
export interface NextServeBuilderOptions {
|
|
40
42
|
dev: boolean;
|
|
@@ -47,6 +49,7 @@ export interface NextServeBuilderOptions {
|
|
|
47
49
|
buildLibsFromSource?: boolean;
|
|
48
50
|
keepAliveTimeout?: number;
|
|
49
51
|
turbo?: boolean;
|
|
52
|
+
webpack?: boolean;
|
|
50
53
|
experimentalHttps?: boolean;
|
|
51
54
|
experimentalHttpsKey?: string;
|
|
52
55
|
experimentalHttpsCert?: string;
|
package/src/utils/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../packages/next/src/utils/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,CACvB,OAAO,EAAE,iBAAiB,EAC1B,WAAW,CAAC,EAAE,WAAW,KACtB,OAAO,CAAC,IAAI,CAAC,CAAC;AAEnB,MAAM,WAAW,WAAW;IAC1B,CAAC,IAAI,EAAE,MAAM,GAAG;QACd,MAAM,EAAE,MAAM,CAAC;QACf,WAAW,CAAC,EAAE,GAAG,CAAC;QAClB,YAAY,CAAC,EAAE,OAAO,CAAC;QACvB,MAAM,CAAC,EAAE,OAAO,CAAC;KAClB,CAAC;CACH;AAED,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,OAAO,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,OAAO,CAAC;IACtB,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,uBAAuB;IACtC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,qBAAqB,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;IAC/C,gBAAgB,EAAE,eAAe,EAAE,CAAC;IACpC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,mCAAmC,CAAC,EAAE,OAAO,CAAC;IAC9C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,KAAK,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../packages/next/src/utils/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,CACvB,OAAO,EAAE,iBAAiB,EAC1B,WAAW,CAAC,EAAE,WAAW,KACtB,OAAO,CAAC,IAAI,CAAC,CAAC;AAEnB,MAAM,WAAW,WAAW;IAC1B,CAAC,IAAI,EAAE,MAAM,GAAG;QACd,MAAM,EAAE,MAAM,CAAC;QACf,WAAW,CAAC,EAAE,GAAG,CAAC;QAClB,YAAY,CAAC,EAAE,OAAO,CAAC;QACvB,MAAM,CAAC,EAAE,OAAO,CAAC;KAClB,CAAC;CACH;AAED,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,OAAO,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,OAAO,CAAC;IACtB,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,uBAAuB;IACtC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,qBAAqB,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;IAC/C,gBAAgB,EAAE,eAAe,EAAE,CAAC;IACpC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,mCAAmC,CAAC,EAAE,OAAO,CAAC;IAC9C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,uBAAuB;IACtC,GAAG,EAAE,OAAO,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,OAAO,CAAC;IACtB,KAAK,EAAE,OAAO,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,WAAW,wBAAwB;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB"}
|
|
@@ -2,7 +2,11 @@ import { type Tree } from '@nx/devkit';
|
|
|
2
2
|
type NextDependenciesVersions = {
|
|
3
3
|
next: string;
|
|
4
4
|
};
|
|
5
|
+
type EslintConfigNextVersion = string;
|
|
5
6
|
export declare function getNextDependenciesVersionsToInstall(tree: Tree, isReact18?: boolean): Promise<NextDependenciesVersions>;
|
|
7
|
+
export declare function getEslintConfigNextDependenciesVersionsToInstall(tree: Tree): Promise<EslintConfigNextVersion>;
|
|
8
|
+
export declare function isNext16(tree: Tree): Promise<boolean>;
|
|
9
|
+
export declare function isNext15(tree: Tree): Promise<boolean>;
|
|
6
10
|
export declare function isNext14(tree: Tree): Promise<boolean>;
|
|
7
11
|
export declare function getInstalledNextVersion(tree: Tree): string;
|
|
8
12
|
export declare function getInstalledNextVersionFromGraph(): Promise<string>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/next/src/utils/version-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,IAAI,EAGV,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"version-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/next/src/utils/version-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,IAAI,EAGV,MAAM,YAAY,CAAC;AAWpB,KAAK,wBAAwB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,KAAK,uBAAuB,GAAG,MAAM,CAAC;AAEtC,wBAAsB,oCAAoC,CACxD,IAAI,EAAE,IAAI,EACV,SAAS,UAAQ,GAChB,OAAO,CAAC,wBAAwB,CAAC,CAcnC;AAED,wBAAsB,gDAAgD,CACpE,IAAI,EAAE,IAAI,GACT,OAAO,CAAC,uBAAuB,CAAC,CAQlC;AAED,wBAAsB,QAAQ,CAAC,IAAI,EAAE,IAAI,oBAMxC;AAED,wBAAsB,QAAQ,CAAC,IAAI,EAAE,IAAI,oBAMxC;AAED,wBAAsB,QAAQ,CAAC,IAAI,EAAE,IAAI,oBAMxC;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAe1D;AAED,wBAAsB,gCAAgC,oBAOrD"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getNextDependenciesVersionsToInstall = getNextDependenciesVersionsToInstall;
|
|
4
|
+
exports.getEslintConfigNextDependenciesVersionsToInstall = getEslintConfigNextDependenciesVersionsToInstall;
|
|
5
|
+
exports.isNext16 = isNext16;
|
|
6
|
+
exports.isNext15 = isNext15;
|
|
4
7
|
exports.isNext14 = isNext14;
|
|
5
8
|
exports.getInstalledNextVersion = getInstalledNextVersion;
|
|
6
9
|
exports.getInstalledNextVersionFromGraph = getInstalledNextVersionFromGraph;
|
|
@@ -13,12 +16,42 @@ async function getNextDependenciesVersionsToInstall(tree, isReact18 = false) {
|
|
|
13
16
|
next: versions_1.next14Version,
|
|
14
17
|
};
|
|
15
18
|
}
|
|
19
|
+
else if (await isNext15(tree)) {
|
|
20
|
+
return {
|
|
21
|
+
next: versions_1.next15Version,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
16
24
|
else {
|
|
17
25
|
return {
|
|
18
26
|
next: versions_1.nextVersion,
|
|
19
27
|
};
|
|
20
28
|
}
|
|
21
29
|
}
|
|
30
|
+
async function getEslintConfigNextDependenciesVersionsToInstall(tree) {
|
|
31
|
+
if (await isNext15(tree)) {
|
|
32
|
+
return versions_1.eslintConfigNext15Version;
|
|
33
|
+
}
|
|
34
|
+
else if (await isNext14(tree)) {
|
|
35
|
+
return versions_1.eslintConfigNext14Version;
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
return versions_1.eslintConfigNextVersion;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
async function isNext16(tree) {
|
|
42
|
+
let installedNextVersion = await getInstalledNextVersionFromGraph();
|
|
43
|
+
if (!installedNextVersion) {
|
|
44
|
+
installedNextVersion = getInstalledNextVersion(tree);
|
|
45
|
+
}
|
|
46
|
+
return (0, semver_1.major)(installedNextVersion) === 16;
|
|
47
|
+
}
|
|
48
|
+
async function isNext15(tree) {
|
|
49
|
+
let installedNextVersion = await getInstalledNextVersionFromGraph();
|
|
50
|
+
if (!installedNextVersion) {
|
|
51
|
+
installedNextVersion = getInstalledNextVersion(tree);
|
|
52
|
+
}
|
|
53
|
+
return (0, semver_1.major)(installedNextVersion) === 15;
|
|
54
|
+
}
|
|
22
55
|
async function isNext14(tree) {
|
|
23
56
|
let installedNextVersion = await getInstalledNextVersionFromGraph();
|
|
24
57
|
if (!installedNextVersion) {
|
package/src/utils/versions.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
export declare const nxVersion: any;
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const next16Version = "~16.0.1";
|
|
3
|
+
export declare const next15Version = "~15.2.4";
|
|
3
4
|
export declare const next14Version = "~14.2.26";
|
|
4
|
-
export declare const
|
|
5
|
+
export declare const nextVersion = "~16.0.1";
|
|
6
|
+
export declare const eslintConfigNext16Version = "^16.0.1";
|
|
7
|
+
export declare const eslintConfigNext15Version = "^15.2.4";
|
|
8
|
+
export declare const eslintConfigNext14Version = "~14.2.26";
|
|
9
|
+
export declare const eslintConfigNextVersion = "^16.0.1";
|
|
5
10
|
export declare const sassVersion = "1.62.1";
|
|
6
11
|
export declare const lessLoader = "11.1.0";
|
|
7
12
|
export declare const emotionServerVersion = "11.11.0";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../../../../../packages/next/src/utils/versions.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,KAAwC,CAAC;AAE/D,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../../../../../packages/next/src/utils/versions.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,KAAwC,CAAC;AAE/D,eAAO,MAAM,aAAa,YAAY,CAAC;AACvC,eAAO,MAAM,aAAa,YAAY,CAAC;AACvC,eAAO,MAAM,aAAa,aAAa,CAAC;AACxC,eAAO,MAAM,WAAW,YAAgB,CAAC;AACzC,eAAO,MAAM,yBAAyB,YAAY,CAAC;AACnD,eAAO,MAAM,yBAAyB,YAAY,CAAC;AACnD,eAAO,MAAM,yBAAyB,aAAa,CAAC;AACpD,eAAO,MAAM,uBAAuB,YAA4B,CAAC;AACjE,eAAO,MAAM,WAAW,WAAW,CAAC;AACpC,eAAO,MAAM,UAAU,WAAW,CAAC;AACnC,eAAO,MAAM,oBAAoB,YAAY,CAAC;AAC9C,eAAO,MAAM,kCAAkC,WAAW,CAAC;AAC3D,eAAO,MAAM,YAAY,WAAW,CAAC"}
|
package/src/utils/versions.js
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.tsLibVersion = exports.babelPluginStyledComponentsVersion = exports.emotionServerVersion = exports.lessLoader = exports.sassVersion = exports.eslintConfigNextVersion = exports.
|
|
3
|
+
exports.tsLibVersion = exports.babelPluginStyledComponentsVersion = exports.emotionServerVersion = exports.lessLoader = exports.sassVersion = exports.eslintConfigNextVersion = exports.eslintConfigNext14Version = exports.eslintConfigNext15Version = exports.eslintConfigNext16Version = exports.nextVersion = exports.next14Version = exports.next15Version = exports.next16Version = exports.nxVersion = void 0;
|
|
4
4
|
exports.nxVersion = require('../../package.json').version;
|
|
5
|
-
exports.
|
|
5
|
+
exports.next16Version = '~16.0.1';
|
|
6
|
+
exports.next15Version = '~15.2.4';
|
|
6
7
|
exports.next14Version = '~14.2.26';
|
|
7
|
-
exports.
|
|
8
|
+
exports.nextVersion = exports.next16Version;
|
|
9
|
+
exports.eslintConfigNext16Version = '^16.0.1';
|
|
10
|
+
exports.eslintConfigNext15Version = '^15.2.4';
|
|
11
|
+
exports.eslintConfigNext14Version = '~14.2.26';
|
|
12
|
+
exports.eslintConfigNextVersion = exports.eslintConfigNext16Version;
|
|
8
13
|
exports.sassVersion = '1.62.1';
|
|
9
14
|
exports.lessLoader = '11.1.0';
|
|
10
15
|
exports.emotionServerVersion = '11.11.0';
|