@nx/next 20.5.0-rc.3 → 20.5.0
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 +7 -7
- package/src/generators/application/lib/add-e2e.js +0 -4
- package/src/generators/application/lib/add-project.js +11 -10
- package/src/generators/application/lib/create-application-files.js +1 -1
- package/src/generators/application/lib/normalize-options.d.ts +4 -1
- package/src/generators/application/lib/normalize-options.js +9 -5
- package/src/generators/library/lib/normalize-options.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/next",
|
|
3
|
-
"version": "20.5.0
|
|
3
|
+
"version": "20.5.0",
|
|
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": "20.5.0
|
|
38
|
+
"@nx/devkit": "20.5.0",
|
|
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,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": "20.5.0
|
|
48
|
-
"@nx/eslint": "20.5.0
|
|
49
|
-
"@nx/react": "20.5.0
|
|
50
|
-
"@nx/web": "20.5.0
|
|
51
|
-
"@nx/webpack": "20.5.0
|
|
47
|
+
"@nx/js": "20.5.0",
|
|
48
|
+
"@nx/eslint": "20.5.0",
|
|
49
|
+
"@nx/react": "20.5.0",
|
|
50
|
+
"@nx/web": "20.5.0",
|
|
51
|
+
"@nx/webpack": "20.5.0",
|
|
52
52
|
"@phenomnomnominal/tsquery": "~5.0.1"
|
|
53
53
|
},
|
|
54
54
|
"publishConfig": {
|
|
@@ -39,8 +39,8 @@ async function applicationGeneratorInternal(host, schema) {
|
|
|
39
39
|
js: options.js,
|
|
40
40
|
skipPackageJson: options.skipPackageJson,
|
|
41
41
|
skipFormat: true,
|
|
42
|
-
addTsPlugin:
|
|
43
|
-
formatter:
|
|
42
|
+
addTsPlugin: options.isTsSolutionSetup,
|
|
43
|
+
formatter: options.formatter,
|
|
44
44
|
platform: 'web',
|
|
45
45
|
});
|
|
46
46
|
tasks.push(jsInitTask);
|
|
@@ -51,6 +51,11 @@ async function applicationGeneratorInternal(host, schema) {
|
|
|
51
51
|
tasks.push(nextTask);
|
|
52
52
|
(0, create_application_files_1.createApplicationFiles)(host, options);
|
|
53
53
|
(0, add_project_1.addProject)(host, options);
|
|
54
|
+
// If we are using the new TS solution
|
|
55
|
+
// We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
|
|
56
|
+
if (options.isTsSolutionSetup) {
|
|
57
|
+
(0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(host, options.appProjectRoot);
|
|
58
|
+
}
|
|
54
59
|
const e2eTask = await (0, add_e2e_1.addE2e)(host, options);
|
|
55
60
|
tasks.push(e2eTask);
|
|
56
61
|
const jestTask = await (0, add_jest_1.addJest)(host, options);
|
|
@@ -100,11 +105,6 @@ async function applicationGeneratorInternal(host, schema) {
|
|
|
100
105
|
}, options.linter === 'eslint'
|
|
101
106
|
? ['.next', 'eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs']
|
|
102
107
|
: ['.next'], options.src ? 'src' : '.');
|
|
103
|
-
// If we are using the new TS solution
|
|
104
|
-
// We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
|
|
105
|
-
if (options.useTsSolution) {
|
|
106
|
-
(0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(host, options.appProjectRoot);
|
|
107
|
-
}
|
|
108
108
|
(0, sort_fields_1.sortPackageJsonFields)(host, options.appProjectRoot);
|
|
109
109
|
if (!options.skipFormat) {
|
|
110
110
|
await (0, devkit_1.formatFiles)(host);
|
|
@@ -31,8 +31,6 @@ async function addE2e(host, options) {
|
|
|
31
31
|
version: '0.0.1',
|
|
32
32
|
private: true,
|
|
33
33
|
nx: {
|
|
34
|
-
projectType: 'application',
|
|
35
|
-
sourceRoot: (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'src'),
|
|
36
34
|
implicitDependencies: [options.projectName],
|
|
37
35
|
},
|
|
38
36
|
});
|
|
@@ -87,8 +85,6 @@ async function addE2e(host, options) {
|
|
|
87
85
|
version: '0.0.1',
|
|
88
86
|
private: true,
|
|
89
87
|
nx: {
|
|
90
|
-
projectType: 'application',
|
|
91
|
-
sourceRoot: (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'src'),
|
|
92
88
|
implicitDependencies: [options.projectName],
|
|
93
89
|
},
|
|
94
90
|
});
|
|
@@ -4,7 +4,6 @@ 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
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
7
|
const versions_1 = require("../../../utils/versions");
|
|
9
8
|
const react_1 = require("@nx/react");
|
|
10
9
|
function addProject(host, options) {
|
|
@@ -58,8 +57,8 @@ function addProject(host, options) {
|
|
|
58
57
|
tags: options.parsedTags,
|
|
59
58
|
};
|
|
60
59
|
if ((0, ts_solution_setup_1.isUsingTsSolutionSetup)(host)) {
|
|
61
|
-
|
|
62
|
-
name:
|
|
60
|
+
const packageJson = {
|
|
61
|
+
name: options.importPath,
|
|
63
62
|
version: '0.0.1',
|
|
64
63
|
private: true,
|
|
65
64
|
dependencies: {
|
|
@@ -67,13 +66,15 @@ function addProject(host, options) {
|
|
|
67
66
|
react: react_1.reactVersion,
|
|
68
67
|
'react-dom': react_1.reactDomVersion,
|
|
69
68
|
},
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
|
|
69
|
+
};
|
|
70
|
+
if (options.projectName !== options.importPath) {
|
|
71
|
+
packageJson.nx = { name: options.projectName };
|
|
72
|
+
}
|
|
73
|
+
if (options.parsedTags?.length) {
|
|
74
|
+
packageJson.nx ??= {};
|
|
75
|
+
packageJson.nx.tags = options.parsedTags;
|
|
76
|
+
}
|
|
77
|
+
(0, devkit_1.writeJson)(host, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'package.json'), packageJson);
|
|
77
78
|
}
|
|
78
79
|
else {
|
|
79
80
|
(0, devkit_1.addProjectConfiguration)(host, options.projectName, {
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { Tree } from '@nx/devkit';
|
|
2
2
|
import { Schema } from '../schema';
|
|
3
|
-
export interface NormalizedSchema extends Schema {
|
|
3
|
+
export interface NormalizedSchema extends Omit<Schema, 'name' | 'useTsSolution'> {
|
|
4
4
|
projectName: string;
|
|
5
|
+
projectSimpleName: string;
|
|
5
6
|
appProjectRoot: string;
|
|
7
|
+
importPath: string;
|
|
6
8
|
outputPath: string;
|
|
7
9
|
e2eProjectName: string;
|
|
8
10
|
e2eProjectRoot: string;
|
|
9
11
|
parsedTags: string[];
|
|
10
12
|
fileName: string;
|
|
11
13
|
styledModule: null | string;
|
|
14
|
+
isTsSolutionSetup: boolean;
|
|
12
15
|
js?: boolean;
|
|
13
16
|
}
|
|
14
17
|
export declare function normalizeOptions(host: Tree, options: Schema): Promise<NormalizedSchema>;
|
|
@@ -5,9 +5,10 @@ const devkit_1 = require("@nx/devkit");
|
|
|
5
5
|
const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
|
|
6
6
|
const eslint_1 = require("@nx/eslint");
|
|
7
7
|
const assertion_1 = require("@nx/react/src/utils/assertion");
|
|
8
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
8
9
|
async function normalizeOptions(host, options) {
|
|
9
|
-
await (0, project_name_and_root_utils_1.
|
|
10
|
-
const { projectName:
|
|
10
|
+
await (0, project_name_and_root_utils_1.ensureRootProjectName)(options, 'application');
|
|
11
|
+
const { projectName, names: projectNames, projectRoot: appProjectRoot, importPath, } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
|
|
11
12
|
name: options.name,
|
|
12
13
|
projectType: 'application',
|
|
13
14
|
directory: options.directory,
|
|
@@ -18,10 +19,11 @@ async function normalizeOptions(host, options) {
|
|
|
18
19
|
const addPlugin = process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
19
20
|
nxJson.useInferencePlugins !== false;
|
|
20
21
|
options.addPlugin ??= addPlugin;
|
|
22
|
+
const isTsSolutionSetup = options.useTsSolution || (0, ts_solution_setup_1.isUsingTsSolutionSetup)(host);
|
|
23
|
+
const appProjectName = !isTsSolutionSetup || options.name ? projectName : importPath;
|
|
21
24
|
const e2eProjectName = options.rootProject ? 'e2e' : `${appProjectName}-e2e`;
|
|
22
25
|
const e2eProjectRoot = options.rootProject ? 'e2e' : `${appProjectRoot}-e2e`;
|
|
23
|
-
const
|
|
24
|
-
const outputPath = (0, devkit_1.joinPathFragments)('dist', appProjectRoot, ...(options.rootProject ? [name] : []));
|
|
26
|
+
const outputPath = (0, devkit_1.joinPathFragments)('dist', appProjectRoot, ...(options.rootProject ? [projectNames.projectFileName] : []));
|
|
25
27
|
const parsedTags = options.tags
|
|
26
28
|
? options.tags.split(',').map((s) => s.trim())
|
|
27
29
|
: [];
|
|
@@ -42,12 +44,14 @@ async function normalizeOptions(host, options) {
|
|
|
42
44
|
e2eTestRunner: options.e2eTestRunner || 'playwright',
|
|
43
45
|
fileName,
|
|
44
46
|
linter: options.linter || eslint_1.Linter.EsLint,
|
|
45
|
-
name,
|
|
46
47
|
outputPath,
|
|
47
48
|
parsedTags,
|
|
48
49
|
projectName: appProjectName,
|
|
50
|
+
projectSimpleName: projectNames.projectSimpleName,
|
|
49
51
|
style: options.style || 'css',
|
|
50
52
|
styledModule,
|
|
51
53
|
unitTestRunner: options.unitTestRunner || 'jest',
|
|
54
|
+
importPath,
|
|
55
|
+
isTsSolutionSetup,
|
|
52
56
|
};
|
|
53
57
|
}
|
|
@@ -5,7 +5,7 @@ const devkit_1 = require("@nx/devkit");
|
|
|
5
5
|
const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
|
|
6
6
|
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
7
7
|
async function normalizeOptions(host, options) {
|
|
8
|
-
await (0, project_name_and_root_utils_1.
|
|
8
|
+
await (0, project_name_and_root_utils_1.ensureRootProjectName)(options, 'library');
|
|
9
9
|
const { projectRoot, importPath } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
|
|
10
10
|
name: options.name,
|
|
11
11
|
projectType: 'library',
|