@nx/react 0.0.0-pr-28808-0f14212 → 0.0.0-pr-28808-ca32248
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 +5 -5
- package/src/generators/application/application.js +2 -3
- package/src/generators/application/schema.d.ts +2 -0
- package/src/generators/application/schema.json +11 -8
- package/src/generators/library/lib/create-files.d.ts +1 -1
- package/src/generators/library/lib/create-files.js +19 -7
- package/src/generators/library/library.js +13 -11
- package/src/generators/library/schema.json +6 -3
- package/src/utils/versions.d.ts +0 -1
- package/src/utils/versions.js +1 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/react",
|
|
3
|
-
"version": "0.0.0-pr-28808-
|
|
3
|
+
"version": "0.0.0-pr-28808-ca32248",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The React plugin for Nx contains executors and generators for managing React applications and libraries within an Nx workspace. It provides:\n\n\n- Integration with libraries such as Jest, Vitest, Playwright, Cypress, and Storybook.\n\n- Generators for applications, libraries, components, hooks, and more.\n\n- Library build support for publishing packages to npm or other registries.\n\n- Utilities for automatic workspace refactoring.",
|
|
6
6
|
"repository": {
|
|
@@ -39,10 +39,10 @@
|
|
|
39
39
|
"picocolors": "^1.1.0",
|
|
40
40
|
"tslib": "^2.3.0",
|
|
41
41
|
"@module-federation/enhanced": "0.6.9",
|
|
42
|
-
"@nx/devkit": "0.0.0-pr-28808-
|
|
43
|
-
"@nx/js": "0.0.0-pr-28808-
|
|
44
|
-
"@nx/eslint": "0.0.0-pr-28808-
|
|
45
|
-
"@nx/web": "0.0.0-pr-28808-
|
|
42
|
+
"@nx/devkit": "0.0.0-pr-28808-ca32248",
|
|
43
|
+
"@nx/js": "0.0.0-pr-28808-ca32248",
|
|
44
|
+
"@nx/eslint": "0.0.0-pr-28808-ca32248",
|
|
45
|
+
"@nx/web": "0.0.0-pr-28808-ca32248",
|
|
46
46
|
"express": "^4.19.2",
|
|
47
47
|
"http-proxy-middleware": "^3.0.3"
|
|
48
48
|
},
|
|
@@ -79,8 +79,7 @@ async function applicationGeneratorInternal(host, schema) {
|
|
|
79
79
|
...schema,
|
|
80
80
|
tsConfigName: schema.rootProject ? 'tsconfig.json' : 'tsconfig.base.json',
|
|
81
81
|
skipFormat: true,
|
|
82
|
-
addTsPlugin:
|
|
83
|
-
process.env.NX_ADD_TS_PLUGIN !== 'false',
|
|
82
|
+
addTsPlugin: schema.useTsSolution,
|
|
84
83
|
});
|
|
85
84
|
tasks.push(jsInitTask);
|
|
86
85
|
const options = await (0, normalize_options_1.normalizeOptions)(host, schema);
|
|
@@ -166,7 +165,7 @@ async function applicationGeneratorInternal(host, schema) {
|
|
|
166
165
|
}, false);
|
|
167
166
|
}
|
|
168
167
|
else if (options.bundler === 'rspack') {
|
|
169
|
-
const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/rspack', versions_1.
|
|
168
|
+
const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/rspack', versions_1.nxVersion);
|
|
170
169
|
const rspackTask = await configurationGenerator(host, {
|
|
171
170
|
project: options.projectName,
|
|
172
171
|
main: (0, devkit_1.joinPathFragments)(options.appProjectRoot, (0, maybe_js_1.maybeJs)({
|
|
@@ -25,8 +25,10 @@ export interface Schema {
|
|
|
25
25
|
rootProject?: boolean;
|
|
26
26
|
bundler?: 'webpack' | 'vite' | 'rspack';
|
|
27
27
|
minimal?: boolean;
|
|
28
|
+
// Internal options
|
|
28
29
|
addPlugin?: boolean;
|
|
29
30
|
nxCloudToken?: string;
|
|
31
|
+
useTsSolution?: boolean;
|
|
30
32
|
}
|
|
31
33
|
|
|
32
34
|
export interface NormalizedSchema<T extends Schema = Schema> extends T {
|
|
@@ -80,12 +80,6 @@
|
|
|
80
80
|
]
|
|
81
81
|
}
|
|
82
82
|
},
|
|
83
|
-
"linter": {
|
|
84
|
-
"description": "The tool to use for running lint checks.",
|
|
85
|
-
"type": "string",
|
|
86
|
-
"enum": ["eslint", "none"],
|
|
87
|
-
"default": "eslint"
|
|
88
|
-
},
|
|
89
83
|
"routing": {
|
|
90
84
|
"type": "boolean",
|
|
91
85
|
"description": "Generate application with routes.",
|
|
@@ -104,11 +98,20 @@
|
|
|
104
98
|
"default": false,
|
|
105
99
|
"x-priority": "internal"
|
|
106
100
|
},
|
|
101
|
+
"linter": {
|
|
102
|
+
"description": "The tool to use for running lint checks.",
|
|
103
|
+
"type": "string",
|
|
104
|
+
"enum": ["eslint", "none"],
|
|
105
|
+
"default": "none",
|
|
106
|
+
"x-prompt": "Which linter would you like to use?",
|
|
107
|
+
"x-priority": "important"
|
|
108
|
+
},
|
|
107
109
|
"unitTestRunner": {
|
|
108
110
|
"type": "string",
|
|
109
111
|
"enum": ["vitest", "jest", "none"],
|
|
110
112
|
"description": "Test runner to use for unit tests.",
|
|
111
|
-
"default": "
|
|
113
|
+
"default": "none",
|
|
114
|
+
"x-priority": "important"
|
|
112
115
|
},
|
|
113
116
|
"inSourceTests": {
|
|
114
117
|
"type": "boolean",
|
|
@@ -120,7 +123,7 @@
|
|
|
120
123
|
"enum": ["playwright", "cypress", "none"],
|
|
121
124
|
"description": "Test runner to use for end to end (E2E) tests.",
|
|
122
125
|
"x-prompt": "Which E2E test runner would you like to use?",
|
|
123
|
-
"default": "
|
|
126
|
+
"default": "none"
|
|
124
127
|
},
|
|
125
128
|
"tags": {
|
|
126
129
|
"type": "string",
|
|
@@ -2,23 +2,24 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createFiles = createFiles;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const devkit_2 = require("@nx/devkit");
|
|
5
6
|
const js_1 = require("@nx/js");
|
|
6
7
|
const create_ts_config_1 = require("../../../utils/create-ts-config");
|
|
7
8
|
function createFiles(host, options) {
|
|
8
9
|
const relativePathToRootTsConfig = (0, js_1.getRelativePathToRootTsConfig)(host, options.projectRoot);
|
|
9
10
|
const substitutions = {
|
|
10
11
|
...options,
|
|
11
|
-
...(0,
|
|
12
|
+
...(0, devkit_2.names)(options.name),
|
|
12
13
|
tmpl: '',
|
|
13
|
-
offsetFromRoot: (0,
|
|
14
|
+
offsetFromRoot: (0, devkit_2.offsetFromRoot)(options.projectRoot),
|
|
14
15
|
fileName: options.fileName,
|
|
15
16
|
};
|
|
16
|
-
(0,
|
|
17
|
+
(0, devkit_2.generateFiles)(host, (0, devkit_2.joinPathFragments)(__dirname, '../files/common'), options.projectRoot, substitutions);
|
|
17
18
|
if (options.bundler === 'vite' || options.unitTestRunner === 'vitest') {
|
|
18
|
-
(0,
|
|
19
|
+
(0, devkit_2.generateFiles)(host, (0, devkit_2.joinPathFragments)(__dirname, '../files/vite'), options.projectRoot, substitutions);
|
|
19
20
|
}
|
|
20
21
|
if (options.compiler === 'babel') {
|
|
21
|
-
(0,
|
|
22
|
+
(0, devkit_2.writeJson)(host, (0, devkit_2.joinPathFragments)(options.projectRoot, '.babelrc'), {
|
|
22
23
|
presets: [
|
|
23
24
|
[
|
|
24
25
|
'@nx/react/babel',
|
|
@@ -42,11 +43,22 @@ function createFiles(host, options) {
|
|
|
42
43
|
].filter(Boolean),
|
|
43
44
|
});
|
|
44
45
|
}
|
|
45
|
-
if (!options.publishable &&
|
|
46
|
+
if (!options.publishable &&
|
|
47
|
+
!options.buildable &&
|
|
48
|
+
!options.isUsingTsSolutionConfig) {
|
|
46
49
|
host.delete(`${options.projectRoot}/package.json`);
|
|
47
50
|
}
|
|
51
|
+
if (options.isUsingTsSolutionConfig) {
|
|
52
|
+
(0, devkit_1.updateJson)(host, `${options.projectRoot}/package.json`, (json) => {
|
|
53
|
+
json.name = options.importPath;
|
|
54
|
+
json.nx = {
|
|
55
|
+
name: options.name,
|
|
56
|
+
};
|
|
57
|
+
return json;
|
|
58
|
+
});
|
|
59
|
+
}
|
|
48
60
|
if (options.js) {
|
|
49
|
-
(0,
|
|
61
|
+
(0, devkit_2.toJS)(host);
|
|
50
62
|
}
|
|
51
63
|
(0, create_ts_config_1.createTsConfig)(host, options.projectRoot, 'lib', options, relativePathToRootTsConfig);
|
|
52
64
|
}
|
|
@@ -32,8 +32,6 @@ async function libraryGeneratorInternal(host, schema) {
|
|
|
32
32
|
const jsInitTask = await (0, js_1.initGenerator)(host, {
|
|
33
33
|
...schema,
|
|
34
34
|
skipFormat: true,
|
|
35
|
-
addTsPlugin: process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
36
|
-
process.env.NX_ADD_TS_PLUGIN !== 'false',
|
|
37
35
|
});
|
|
38
36
|
tasks.push(jsInitTask);
|
|
39
37
|
const options = await (0, normalize_options_1.normalizeOptions)(host, schema);
|
|
@@ -48,16 +46,18 @@ async function libraryGeneratorInternal(host, schema) {
|
|
|
48
46
|
skipFormat: true,
|
|
49
47
|
});
|
|
50
48
|
tasks.push(initTask);
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
49
|
+
if (!options.isUsingTsSolutionConfig) {
|
|
50
|
+
(0, devkit_1.addProjectConfiguration)(host, options.name, {
|
|
51
|
+
root: options.projectRoot,
|
|
52
|
+
sourceRoot: (0, devkit_1.joinPathFragments)(options.projectRoot, 'src'),
|
|
53
|
+
projectType: 'library',
|
|
54
|
+
tags: options.parsedTags,
|
|
55
|
+
targets: {},
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
(0, create_files_1.createFiles)(host, options);
|
|
58
59
|
const lintTask = await (0, add_linting_1.addLinting)(host, options);
|
|
59
60
|
tasks.push(lintTask);
|
|
60
|
-
(0, create_files_1.createFiles)(host, options);
|
|
61
61
|
// Set up build target
|
|
62
62
|
if (options.buildable && options.bundler === 'vite') {
|
|
63
63
|
const { viteConfigurationGenerator, createOrEditViteConfig } = (0, devkit_1.ensurePackage)('@nx/vite', versions_1.nxVersion);
|
|
@@ -188,7 +188,9 @@ async function libraryGeneratorInternal(host, schema) {
|
|
|
188
188
|
jsx: 'react-jsx',
|
|
189
189
|
module: 'esnext',
|
|
190
190
|
moduleResolution: 'bundler',
|
|
191
|
-
}
|
|
191
|
+
}, options.linter === 'eslint'
|
|
192
|
+
? ['eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs']
|
|
193
|
+
: undefined);
|
|
192
194
|
if (!options.skipFormat) {
|
|
193
195
|
await (0, devkit_1.formatFiles)(host);
|
|
194
196
|
}
|
|
@@ -75,14 +75,17 @@
|
|
|
75
75
|
"description": "The tool to use for running lint checks.",
|
|
76
76
|
"type": "string",
|
|
77
77
|
"enum": ["eslint", "none"],
|
|
78
|
-
"default": "
|
|
78
|
+
"default": "none",
|
|
79
|
+
"x-prompt": "Which linter would you like to use?",
|
|
80
|
+
"x-priority": "important"
|
|
79
81
|
},
|
|
80
82
|
"unitTestRunner": {
|
|
81
83
|
"type": "string",
|
|
82
84
|
"enum": ["vitest", "jest", "none"],
|
|
83
|
-
"default": "
|
|
85
|
+
"default": "none",
|
|
84
86
|
"description": "Test runner to use for unit tests.",
|
|
85
|
-
"x-prompt": "What unit test runner should be used?"
|
|
87
|
+
"x-prompt": "What unit test runner should be used?",
|
|
88
|
+
"x-priority": "important"
|
|
86
89
|
},
|
|
87
90
|
"inSourceTests": {
|
|
88
91
|
"type": "boolean",
|
package/src/utils/versions.d.ts
CHANGED
package/src/utils/versions.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.swcPluginStyledComponentsVersion = exports.swcPluginEmotionVersion = exports.swcPluginStyledJsxVersion = exports.svgrRollupVersion = exports.rollupPluginUrlVersion = exports.sassVersion = exports.lessVersion = exports.moduleFederationEnhancedVersion = exports.moduleFederationNodeVersion = exports.typesCorsVersion = exports.corsVersion = exports.isbotVersion = exports.typesExpressVersion = exports.expressVersion = exports.autoprefixerVersion = exports.tailwindcssVersion = exports.postcssVersion = exports.tsLibVersion = exports.babelPluginStyledComponentsVersion = exports.eslintPluginReactHooksVersion = exports.eslintPluginReactVersion = exports.eslintPluginJsxA11yVersion = exports.eslintPluginImportVersion = exports.reactReduxVersion = exports.reduxjsToolkitVersion = exports.testingLibraryReactVersion = exports.reactRouterDomVersion = exports.styledJsxVersion = exports.emotionBabelPlugin = exports.emotionReactVersion = exports.emotionStyledVersion = exports.typesStyledComponentsVersion = exports.styledComponentsVersion = exports.babelCoreVersion = exports.babelPresetReactVersion = exports.typesNodeVersion = exports.reactViteVersion = exports.typesReactIsVersion = exports.typesReactDomVersion = exports.typesReactVersion = exports.babelLoaderVersion = exports.swcLoaderVersion = exports.reactIsVersion = exports.reactDomVersion = exports.reactVersion = exports.
|
|
3
|
+
exports.swcPluginStyledComponentsVersion = exports.swcPluginEmotionVersion = exports.swcPluginStyledJsxVersion = exports.svgrRollupVersion = exports.rollupPluginUrlVersion = exports.sassVersion = exports.lessVersion = exports.moduleFederationEnhancedVersion = exports.moduleFederationNodeVersion = exports.typesCorsVersion = exports.corsVersion = exports.isbotVersion = exports.typesExpressVersion = exports.expressVersion = exports.autoprefixerVersion = exports.tailwindcssVersion = exports.postcssVersion = exports.tsLibVersion = exports.babelPluginStyledComponentsVersion = exports.eslintPluginReactHooksVersion = exports.eslintPluginReactVersion = exports.eslintPluginJsxA11yVersion = exports.eslintPluginImportVersion = exports.reactReduxVersion = exports.reduxjsToolkitVersion = exports.testingLibraryReactVersion = exports.reactRouterDomVersion = exports.styledJsxVersion = exports.emotionBabelPlugin = exports.emotionReactVersion = exports.emotionStyledVersion = exports.typesStyledComponentsVersion = exports.styledComponentsVersion = exports.babelCoreVersion = exports.babelPresetReactVersion = exports.typesNodeVersion = exports.reactViteVersion = exports.typesReactIsVersion = exports.typesReactDomVersion = exports.typesReactVersion = exports.babelLoaderVersion = exports.swcLoaderVersion = exports.reactIsVersion = exports.reactDomVersion = exports.reactVersion = exports.nxVersion = void 0;
|
|
4
4
|
exports.nxVersion = require('../../package.json').version;
|
|
5
|
-
// Always pull the latest version until we merge rspack plugin into the repo.
|
|
6
|
-
exports.nxRspackVersion = '*';
|
|
7
5
|
exports.reactVersion = '18.3.1';
|
|
8
6
|
exports.reactDomVersion = '18.3.1';
|
|
9
7
|
exports.reactIsVersion = '18.3.1';
|