@nx/next 0.0.0-pr-29047-57d3073 → 0.0.0-pr-28808-eac89e6
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 +7 -7
- package/src/generators/application/application.js +10 -2
- package/src/generators/application/files/common/tsconfig.json__tmpl__ +11 -5
- package/src/generators/application/lib/add-e2e.js +45 -14
- package/src/generators/application/lib/add-linting.js +2 -0
- package/src/generators/application/lib/add-project.js +27 -3
- package/src/generators/application/lib/create-application-files.js +3 -2
- package/src/generators/application/schema.d.ts +3 -0
- package/src/generators/application/schema.json +7 -3
- package/src/generators/custom-server/custom-server.d.ts +1 -1
- package/src/generators/custom-server/custom-server.js +17 -10
- package/src/generators/custom-server/files/tsconfig.server.json__tmpl__ +3 -2
- package/src/generators/init/init.js +0 -2
- package/src/generators/library/library.js +8 -2
- package/src/generators/library/schema.json +7 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/next",
|
|
3
|
-
"version": "0.0.0-pr-
|
|
3
|
+
"version": "0.0.0-pr-28808-eac89e6",
|
|
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": {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"next": ">=14.0.0"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@nx/devkit": "0.0.0-pr-
|
|
38
|
+
"@nx/devkit": "0.0.0-pr-28808-eac89e6",
|
|
39
39
|
"@babel/plugin-proposal-decorators": "^7.22.7",
|
|
40
40
|
"@svgr/webpack": "^8.0.1",
|
|
41
41
|
"copy-webpack-plugin": "^10.2.4",
|
|
@@ -44,11 +44,11 @@
|
|
|
44
44
|
"semver": "^7.5.3",
|
|
45
45
|
"tslib": "^2.3.0",
|
|
46
46
|
"webpack-merge": "^5.8.0",
|
|
47
|
-
"@nx/js": "0.0.0-pr-
|
|
48
|
-
"@nx/eslint": "0.0.0-pr-
|
|
49
|
-
"@nx/react": "0.0.0-pr-
|
|
50
|
-
"@nx/web": "0.0.0-pr-
|
|
51
|
-
"@nx/webpack": "0.0.0-pr-
|
|
47
|
+
"@nx/js": "0.0.0-pr-28808-eac89e6",
|
|
48
|
+
"@nx/eslint": "0.0.0-pr-28808-eac89e6",
|
|
49
|
+
"@nx/react": "0.0.0-pr-28808-eac89e6",
|
|
50
|
+
"@nx/web": "0.0.0-pr-28808-eac89e6",
|
|
51
|
+
"@nx/webpack": "0.0.0-pr-28808-eac89e6",
|
|
52
52
|
"@phenomnomnominal/tsquery": "~5.0.1"
|
|
53
53
|
},
|
|
54
54
|
"publishConfig": {
|
|
@@ -4,7 +4,6 @@ exports.applicationGenerator = applicationGenerator;
|
|
|
4
4
|
exports.applicationGeneratorInternal = applicationGeneratorInternal;
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const js_1 = require("@nx/js");
|
|
7
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
8
7
|
const react_1 = require("@nx/react");
|
|
9
8
|
const versions_1 = require("@nx/react/src/utils/versions");
|
|
10
9
|
const normalize_options_1 = require("./lib/normalize-options");
|
|
@@ -22,6 +21,7 @@ const update_cypress_tsconfig_1 = require("./lib/update-cypress-tsconfig");
|
|
|
22
21
|
const show_possible_warnings_1 = require("./lib/show-possible-warnings");
|
|
23
22
|
const versions_2 = require("../../utils/versions");
|
|
24
23
|
const log_show_project_command_1 = require("@nx/devkit/src/utils/log-show-project-command");
|
|
24
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
25
25
|
async function applicationGenerator(host, schema) {
|
|
26
26
|
return await applicationGeneratorInternal(host, {
|
|
27
27
|
addPlugin: false,
|
|
@@ -29,7 +29,6 @@ async function applicationGenerator(host, schema) {
|
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
async function applicationGeneratorInternal(host, schema) {
|
|
32
|
-
(0, ts_solution_setup_1.assertNotUsingTsSolutionSetup)(host, 'next', 'application');
|
|
33
32
|
const tasks = [];
|
|
34
33
|
const options = await (0, normalize_options_1.normalizeOptions)(host, schema);
|
|
35
34
|
(0, show_possible_warnings_1.showPossibleWarnings)(host, options);
|
|
@@ -37,6 +36,8 @@ async function applicationGeneratorInternal(host, schema) {
|
|
|
37
36
|
js: options.js,
|
|
38
37
|
skipPackageJson: options.skipPackageJson,
|
|
39
38
|
skipFormat: true,
|
|
39
|
+
addTsPlugin: schema.useTsSolution,
|
|
40
|
+
formatter: schema.formatter,
|
|
40
41
|
});
|
|
41
42
|
tasks.push(jsInitTask);
|
|
42
43
|
const nextTask = await (0, init_1.nextInitGenerator)(host, {
|
|
@@ -82,6 +83,13 @@ async function applicationGeneratorInternal(host, schema) {
|
|
|
82
83
|
}
|
|
83
84
|
tasks.push((0, devkit_1.addDependenciesToPackageJson)(host, { tslib: versions_2.tsLibVersion }, devDependencies));
|
|
84
85
|
}
|
|
86
|
+
(0, ts_solution_setup_1.updateTsconfigFiles)(host, options.appProjectRoot, 'tsconfig.json', {
|
|
87
|
+
jsx: 'preserve',
|
|
88
|
+
module: 'esnext',
|
|
89
|
+
moduleResolution: 'bundler',
|
|
90
|
+
}, options.linter === 'eslint'
|
|
91
|
+
? ['.next', 'eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs']
|
|
92
|
+
: ['.next'], options.src ? 'src' : '.');
|
|
85
93
|
if (!options.skipFormat) {
|
|
86
94
|
await (0, devkit_1.formatFiles)(host);
|
|
87
95
|
}
|
|
@@ -3,16 +3,22 @@
|
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"jsx": "preserve",
|
|
5
5
|
<% if (style === '@emotion/styled') { %>"jsxImportSource": "@emotion/react",<% } %>
|
|
6
|
-
"allowJs": true,
|
|
7
|
-
"esModuleInterop": true,
|
|
8
|
-
"allowSyntheticDefaultImports": true,
|
|
9
6
|
"strict": true,
|
|
10
|
-
"forceConsistentCasingInFileNames": true,
|
|
11
7
|
"noEmit": true,
|
|
8
|
+
"esModuleInterop": true,
|
|
9
|
+
"module": "esnext",
|
|
10
|
+
"moduleResolution": "bundler",
|
|
12
11
|
"resolveJsonModule": true,
|
|
13
12
|
"isolatedModules": true,
|
|
13
|
+
"lib": ["dom", "dom.iterable", "esnext"],
|
|
14
|
+
"allowJs": true,
|
|
15
|
+
"allowSyntheticDefaultImports": true,
|
|
16
|
+
"forceConsistentCasingInFileNames": true,
|
|
14
17
|
"incremental": true,
|
|
15
|
-
"plugins": [{ "name": "next" }]
|
|
18
|
+
"plugins": [{ "name": "next" }]<% if (isUsingTsSolutionSetup) { %>,
|
|
19
|
+
"paths": {
|
|
20
|
+
"@/*": [<% if (src) { %>"./src/*"<% } else { %>"./*"<% } %>]
|
|
21
|
+
}<% } %>
|
|
16
22
|
},
|
|
17
23
|
"include": [
|
|
18
24
|
"<%= rootPath %>**/*.ts",
|
|
@@ -8,6 +8,7 @@ const web_1 = require("@nx/web");
|
|
|
8
8
|
const find_plugin_for_config_file_1 = require("@nx/devkit/src/utils/find-plugin-for-config-file");
|
|
9
9
|
const target_defaults_utils_1 = require("@nx/devkit/src/generators/target-defaults-utils");
|
|
10
10
|
const e2e_web_server_info_utils_1 = require("@nx/devkit/src/generators/e2e-web-server-info-utils");
|
|
11
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
11
12
|
async function addE2e(host, options) {
|
|
12
13
|
const nxJson = (0, devkit_1.readNxJson)(host);
|
|
13
14
|
const hasPlugin = nxJson.plugins?.some((p) => typeof p === 'string'
|
|
@@ -24,13 +25,28 @@ async function addE2e(host, options) {
|
|
|
24
25
|
spa: true,
|
|
25
26
|
});
|
|
26
27
|
}
|
|
27
|
-
(0,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
if ((0, ts_solution_setup_1.isUsingTsSolutionSetup)(host)) {
|
|
29
|
+
(0, devkit_1.writeJson)(host, (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'package.json'), {
|
|
30
|
+
name: options.e2eProjectName,
|
|
31
|
+
version: '0.0.1',
|
|
32
|
+
private: true,
|
|
33
|
+
nx: {
|
|
34
|
+
projectType: 'application',
|
|
35
|
+
sourceRoot: (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'src'),
|
|
36
|
+
implicitDependencies: [options.projectName],
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
(0, devkit_1.addProjectConfiguration)(host, options.e2eProjectName, {
|
|
42
|
+
root: options.e2eProjectRoot,
|
|
43
|
+
projectType: 'application',
|
|
44
|
+
sourceRoot: (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'src'),
|
|
45
|
+
targets: {},
|
|
46
|
+
tags: [],
|
|
47
|
+
implicitDependencies: [options.projectName],
|
|
48
|
+
});
|
|
49
|
+
}
|
|
34
50
|
const e2eTask = await configurationGenerator(host, {
|
|
35
51
|
...options,
|
|
36
52
|
linter: eslint_1.Linter.EsLint,
|
|
@@ -65,13 +81,28 @@ async function addE2e(host, options) {
|
|
|
65
81
|
}
|
|
66
82
|
else if (options.e2eTestRunner === 'playwright') {
|
|
67
83
|
const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/playwright', versions_1.nxVersion);
|
|
68
|
-
(0,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
84
|
+
if ((0, ts_solution_setup_1.isUsingTsSolutionSetup)(host)) {
|
|
85
|
+
(0, devkit_1.writeJson)(host, (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'package.json'), {
|
|
86
|
+
name: options.e2eProjectName,
|
|
87
|
+
version: '0.0.1',
|
|
88
|
+
private: true,
|
|
89
|
+
nx: {
|
|
90
|
+
projectType: 'application',
|
|
91
|
+
sourceRoot: (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'src'),
|
|
92
|
+
implicitDependencies: [options.projectName],
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
(0, devkit_1.addProjectConfiguration)(host, options.e2eProjectName, {
|
|
98
|
+
root: options.e2eProjectRoot,
|
|
99
|
+
projectType: 'application',
|
|
100
|
+
sourceRoot: (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'src'),
|
|
101
|
+
targets: {},
|
|
102
|
+
tags: [],
|
|
103
|
+
implicitDependencies: [options.projectName],
|
|
104
|
+
});
|
|
105
|
+
}
|
|
75
106
|
const e2eTask = await configurationGenerator(host, {
|
|
76
107
|
rootProject: options.rootProject,
|
|
77
108
|
project: options.e2eProjectName,
|
|
@@ -8,6 +8,8 @@ const eslint_file_1 = require("@nx/eslint/src/generators/utils/eslint-file");
|
|
|
8
8
|
const versions_1 = require("../../../utils/versions");
|
|
9
9
|
const flat_config_1 = require("@nx/eslint/src/utils/flat-config");
|
|
10
10
|
async function addLinting(host, options) {
|
|
11
|
+
if (options.linter !== 'eslint')
|
|
12
|
+
return () => { };
|
|
11
13
|
const tasks = [];
|
|
12
14
|
tasks.push(await (0, eslint_1.lintProjectGenerator)(host, {
|
|
13
15
|
linter: options.linter,
|
|
@@ -3,6 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.addProject = addProject;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const target_defaults_utils_1 = require("@nx/devkit/src/generators/target-defaults-utils");
|
|
6
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
7
|
+
const get_import_path_1 = require("@nx/js/src/utils/get-import-path");
|
|
8
|
+
const versions_1 = require("../../../utils/versions");
|
|
9
|
+
const react_1 = require("@nx/react");
|
|
6
10
|
function addProject(host, options) {
|
|
7
11
|
const targets = {};
|
|
8
12
|
// Check if plugin exists in nx.json and if it doesn't then we can continue
|
|
@@ -53,7 +57,27 @@ function addProject(host, options) {
|
|
|
53
57
|
targets,
|
|
54
58
|
tags: options.parsedTags,
|
|
55
59
|
};
|
|
56
|
-
(0,
|
|
57
|
-
|
|
58
|
-
|
|
60
|
+
if ((0, ts_solution_setup_1.isUsingTsSolutionSetup)(host)) {
|
|
61
|
+
(0, devkit_1.writeJson)(host, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'package.json'), {
|
|
62
|
+
name: (0, get_import_path_1.getImportPath)(host, options.name),
|
|
63
|
+
version: '0.0.1',
|
|
64
|
+
private: true,
|
|
65
|
+
dependencies: {
|
|
66
|
+
next: versions_1.nextVersion,
|
|
67
|
+
react: react_1.reactVersion,
|
|
68
|
+
'react-dom': react_1.reactDomVersion,
|
|
69
|
+
},
|
|
70
|
+
nx: {
|
|
71
|
+
name: options.name,
|
|
72
|
+
projectType: 'application',
|
|
73
|
+
sourceRoot: options.appProjectRoot,
|
|
74
|
+
tags: options.parsedTags?.length ? options.parsedTags : undefined,
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
(0, devkit_1.addProjectConfiguration)(host, options.projectName, {
|
|
80
|
+
...project,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
59
83
|
}
|
|
@@ -5,12 +5,12 @@ const path_1 = require("path");
|
|
|
5
5
|
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
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
8
9
|
function createApplicationFiles(host, options) {
|
|
9
10
|
const offsetFromRoot = (0, devkit_1.offsetFromRoot)(options.appProjectRoot);
|
|
10
11
|
const layoutTypeSrcPath = (0, devkit_1.joinPathFragments)(offsetFromRoot, options.appProjectRoot, '.next/types/**/*.ts');
|
|
11
12
|
const layoutTypeDistPath = (0, devkit_1.joinPathFragments)(offsetFromRoot, options.outputPath, '.next/types/**/*.ts');
|
|
12
|
-
|
|
13
|
-
const rootPath = options.rootProject
|
|
13
|
+
const rootPath = options.rootProject || (0, ts_solution_setup_1.isUsingTsSolutionSetup)(host)
|
|
14
14
|
? options.src
|
|
15
15
|
? 'src/'
|
|
16
16
|
: options.appDir
|
|
@@ -32,6 +32,7 @@ function createApplicationFiles(host, options) {
|
|
|
32
32
|
styleContent: (0, create_application_files_helpers_1.createStyleRules)(),
|
|
33
33
|
pageStyleContent: `.page {}`,
|
|
34
34
|
stylesExt: options.style === 'less' ? options.style : 'css',
|
|
35
|
+
isUsingTsSolutionSetup: (0, ts_solution_setup_1.isUsingTsSolutionSetup)(host),
|
|
35
36
|
};
|
|
36
37
|
const generatedAppFilePath = options.src
|
|
37
38
|
? (0, path_1.join)(options.appProjectRoot, 'src')
|
|
@@ -69,8 +69,10 @@
|
|
|
69
69
|
"linter": {
|
|
70
70
|
"description": "The tool to use for running lint checks.",
|
|
71
71
|
"type": "string",
|
|
72
|
-
"enum": ["eslint"],
|
|
73
|
-
"default": "eslint"
|
|
72
|
+
"enum": ["eslint", "none"],
|
|
73
|
+
"default": "eslint",
|
|
74
|
+
"x-prompt": "Which linter would you like to use?",
|
|
75
|
+
"x-priority": "important"
|
|
74
76
|
},
|
|
75
77
|
"skipFormat": {
|
|
76
78
|
"description": "Skip formatting files.",
|
|
@@ -82,7 +84,9 @@
|
|
|
82
84
|
"type": "string",
|
|
83
85
|
"enum": ["jest", "none"],
|
|
84
86
|
"description": "Test runner to use for unit tests.",
|
|
85
|
-
"default": "jest"
|
|
87
|
+
"default": "jest",
|
|
88
|
+
"x-prompt": "What unit test runner should be used?",
|
|
89
|
+
"x-priority": "important"
|
|
86
90
|
},
|
|
87
91
|
"e2eTestRunner": {
|
|
88
92
|
"type": "string",
|
|
@@ -2,18 +2,20 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.customServerGenerator = customServerGenerator;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const devkit_2 = require("@nx/devkit");
|
|
5
6
|
const path_1 = require("path");
|
|
6
7
|
const add_swc_to_custom_server_1 = require("../../utils/add-swc-to-custom-server");
|
|
8
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
7
9
|
async function customServerGenerator(host, options) {
|
|
8
|
-
const project = (0,
|
|
9
|
-
const nxJson = (0,
|
|
10
|
+
const project = (0, devkit_2.readProjectConfiguration)(host, options.project);
|
|
11
|
+
const nxJson = (0, devkit_2.readNxJson)(host);
|
|
10
12
|
const hasPlugin = nxJson.plugins?.some((p) => typeof p === 'string'
|
|
11
13
|
? p === '@nx/next/plugin'
|
|
12
14
|
: p.plugin === '@nx/next/plugin');
|
|
13
15
|
if (project.targets?.build?.executor !== '@nx/next:build' &&
|
|
14
16
|
project.targets?.build?.executor !== '@nrwl/next:build' &&
|
|
15
17
|
!hasPlugin) {
|
|
16
|
-
|
|
18
|
+
devkit_2.logger.error(`Project ${options.project} is not a Next.js project. Did you generate it with "nx g @nx/next:app"?`);
|
|
17
19
|
return;
|
|
18
20
|
}
|
|
19
21
|
// In Nx 18 next artifacts are inside the project root .next/ & dist/ (for custom server)
|
|
@@ -26,23 +28,28 @@ async function customServerGenerator(host, options) {
|
|
|
26
28
|
!project.targets?.build?.configurations?.development ||
|
|
27
29
|
!project.targets?.build?.configurations?.production) &&
|
|
28
30
|
!hasPlugin) {
|
|
29
|
-
|
|
31
|
+
devkit_2.logger.error(`Project ${options.project} has invalid config. Did you generate it with "nx g @nx/next:app"?`);
|
|
30
32
|
return;
|
|
31
33
|
}
|
|
32
34
|
if (project.targets?.['build-custom-server'] ||
|
|
33
35
|
project.targets?.['serve-custom-server']) {
|
|
34
|
-
|
|
36
|
+
devkit_2.logger.warn(`Project ${options.project} has custom server targets already: build-custom-server, serve-custom-server. Remove these targets from project and try again.`);
|
|
35
37
|
return;
|
|
36
38
|
}
|
|
37
39
|
// In Nx 18 next artifacts are inside the project root .next/ & dist/ (for custom server)
|
|
38
40
|
// So we need ensure the mapping is correct from dist to the project root
|
|
39
|
-
const projectPathFromDist = `../../${(0,
|
|
40
|
-
|
|
41
|
+
const projectPathFromDist = `../../${(0, devkit_2.offsetFromRoot)(project.root)}${project.root}`;
|
|
42
|
+
const offset = (0, devkit_2.offsetFromRoot)(project.root);
|
|
43
|
+
const isTsSolution = (0, ts_solution_setup_1.isUsingTsSolutionSetup)(host);
|
|
44
|
+
(0, devkit_2.generateFiles)(host, (0, path_1.join)(__dirname, 'files'), project.root, {
|
|
41
45
|
...options,
|
|
42
46
|
hasPlugin,
|
|
43
47
|
projectPathFromDist,
|
|
44
|
-
offsetFromRoot:
|
|
48
|
+
offsetFromRoot: offset,
|
|
45
49
|
projectRoot: project.root,
|
|
50
|
+
baseTsConfigPath: isTsSolution
|
|
51
|
+
? (0, devkit_1.joinPathFragments)(offset, 'tsconfig.base.json')
|
|
52
|
+
: './tsconfig.json',
|
|
46
53
|
tmpl: '',
|
|
47
54
|
});
|
|
48
55
|
if (!hasPlugin) {
|
|
@@ -86,8 +93,8 @@ async function customServerGenerator(host, options) {
|
|
|
86
93
|
},
|
|
87
94
|
},
|
|
88
95
|
};
|
|
89
|
-
(0,
|
|
90
|
-
(0,
|
|
96
|
+
(0, devkit_2.updateProjectConfiguration)(host, options.project, project);
|
|
97
|
+
(0, devkit_2.updateJson)(host, 'nx.json', (json) => {
|
|
91
98
|
if (!json.tasksRunnerOptions?.default?.options?.cacheableOperations?.includes('build-custom-server') &&
|
|
92
99
|
json.tasksRunnerOptions?.default?.options?.cacheableOperations) {
|
|
93
100
|
json.tasksRunnerOptions.default.options.cacheableOperations.push('build-custom-server');
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
|
-
"extends": "
|
|
2
|
+
"extends": "<%= baseTsConfigPath %>",
|
|
3
3
|
"compilerOptions": {
|
|
4
|
-
"module": "
|
|
4
|
+
"module": "nodenext",
|
|
5
|
+
"moduleResolution": "nodenext",
|
|
5
6
|
"noEmit": false,
|
|
6
7
|
"incremental": true,
|
|
7
8
|
<% if(hasPlugin && compiler === 'tsc') { %>
|
|
@@ -4,7 +4,6 @@ exports.nextInitGenerator = nextInitGenerator;
|
|
|
4
4
|
exports.nextInitGeneratorInternal = nextInitGeneratorInternal;
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const add_plugin_1 = require("@nx/devkit/src/utils/add-plugin");
|
|
7
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
8
7
|
const versions_1 = require("@nx/react/src/utils/versions");
|
|
9
8
|
const add_gitignore_entry_1 = require("../../utils/add-gitignore-entry");
|
|
10
9
|
const versions_2 = require("../../utils/versions");
|
|
@@ -24,7 +23,6 @@ function nextInitGenerator(tree, schema) {
|
|
|
24
23
|
return nextInitGeneratorInternal(tree, { addPlugin: false, ...schema });
|
|
25
24
|
}
|
|
26
25
|
async function nextInitGeneratorInternal(host, schema) {
|
|
27
|
-
(0, ts_solution_setup_1.assertNotUsingTsSolutionSetup)(host, 'next', 'init');
|
|
28
26
|
const nxJson = (0, devkit_1.readNxJson)(host);
|
|
29
27
|
const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
30
28
|
nxJson.useInferencePlugins !== false;
|
|
@@ -5,11 +5,11 @@ exports.libraryGeneratorInternal = libraryGeneratorInternal;
|
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const library_1 = require("@nx/react/src/generators/library/library");
|
|
7
7
|
const js_1 = require("@nx/js");
|
|
8
|
-
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
9
8
|
const versions_1 = require("@nx/react/src/utils/versions");
|
|
10
9
|
const init_1 = require("../init/init");
|
|
11
10
|
const normalize_options_1 = require("./lib/normalize-options");
|
|
12
11
|
const versions_2 = require("../../utils/versions");
|
|
12
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
13
13
|
async function libraryGenerator(host, rawOptions) {
|
|
14
14
|
return await libraryGeneratorInternal(host, {
|
|
15
15
|
addPlugin: false,
|
|
@@ -17,7 +17,6 @@ async function libraryGenerator(host, rawOptions) {
|
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
async function libraryGeneratorInternal(host, rawOptions) {
|
|
20
|
-
(0, ts_solution_setup_1.assertNotUsingTsSolutionSetup)(host, 'next', 'library');
|
|
21
20
|
const options = await (0, normalize_options_1.normalizeOptions)(host, rawOptions);
|
|
22
21
|
const tasks = [];
|
|
23
22
|
const jsInitTask = await (0, js_1.initGenerator)(host, {
|
|
@@ -84,6 +83,13 @@ async function libraryGeneratorInternal(host, rawOptions) {
|
|
|
84
83
|
];
|
|
85
84
|
return json;
|
|
86
85
|
});
|
|
86
|
+
(0, ts_solution_setup_1.updateTsconfigFiles)(host, options.projectRoot, 'tsconfig.lib.json', {
|
|
87
|
+
jsx: 'react-jsx',
|
|
88
|
+
module: 'esnext',
|
|
89
|
+
moduleResolution: 'bundler',
|
|
90
|
+
}, options.linter === 'eslint'
|
|
91
|
+
? ['eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs']
|
|
92
|
+
: undefined);
|
|
87
93
|
if (!options.skipFormat) {
|
|
88
94
|
await (0, devkit_1.formatFiles)(host);
|
|
89
95
|
}
|
|
@@ -65,14 +65,18 @@
|
|
|
65
65
|
"linter": {
|
|
66
66
|
"description": "The tool to use for running lint checks.",
|
|
67
67
|
"type": "string",
|
|
68
|
-
"enum": ["eslint"],
|
|
69
|
-
"default": "eslint"
|
|
68
|
+
"enum": ["eslint", "none"],
|
|
69
|
+
"default": "eslint",
|
|
70
|
+
"x-prompt": "Which linter would you like to use?",
|
|
71
|
+
"x-priority": "important"
|
|
70
72
|
},
|
|
71
73
|
"unitTestRunner": {
|
|
72
74
|
"type": "string",
|
|
73
75
|
"enum": ["vitest", "jest", "none"],
|
|
74
76
|
"description": "Test runner to use for unit tests.",
|
|
75
|
-
"default": "vitest"
|
|
77
|
+
"default": "vitest",
|
|
78
|
+
"x-prompt": "What unit test runner should be used?",
|
|
79
|
+
"x-priority": "important"
|
|
76
80
|
},
|
|
77
81
|
"tags": {
|
|
78
82
|
"type": "string",
|