@nx/react 16.7.0-beta.1 → 16.7.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/migrations.json +12 -0
- package/package.json +7 -7
- package/plugins/component-testing/index.js +1 -1
- package/src/generators/application/application.js +4 -4
- package/src/generators/application/files/base-rspack/tsconfig.app.json__tmpl__ +6 -6
- package/src/generators/application/files/base-vite/tsconfig.app.json__tmpl__ +6 -6
- package/src/generators/application/files/base-webpack/tsconfig.app.json__tmpl__ +6 -6
- package/src/generators/application/lib/add-e2e.d.ts +3 -0
- package/src/generators/application/lib/add-e2e.js +42 -0
- package/src/generators/application/lib/install-common-dependencies.js +1 -0
- package/src/generators/application/lib/normalize-options.js +4 -0
- package/src/generators/application/lib/update-jest-config.js +7 -6
- package/src/generators/application/schema.d.ts +2 -1
- package/src/generators/application/schema.json +2 -1
- package/src/generators/init/schema.d.ts +1 -1
- package/src/generators/init/schema.json +1 -1
- package/src/generators/library/lib/install-common-dependencies.js +4 -1
- package/src/migrations/update-16-7-0/add-babel-core.d.ts +2 -0
- package/src/migrations/update-16-7-0/add-babel-core.js +17 -0
- package/src/migrations/update-16-7-0-add-typings/update-16-7-0-add-typings.d.ts +2 -0
- package/src/migrations/update-16-7-0-add-typings/update-16-7-0-add-typings.js +47 -0
- package/src/utils/versions.d.ts +1 -0
- package/src/utils/versions.js +2 -1
- package/src/generators/application/lib/add-cypress.d.ts +0 -3
- package/src/generators/application/lib/add-cypress.js +0 -21
package/migrations.json
CHANGED
|
@@ -101,6 +101,18 @@
|
|
|
101
101
|
"version": "16.3.0-beta.2",
|
|
102
102
|
"description": "Remove @types/react-router-dom from package.json",
|
|
103
103
|
"implementation": "./src/migrations/update-16-3-0/remove-types-react-router-dom-package"
|
|
104
|
+
},
|
|
105
|
+
"add-babel-core": {
|
|
106
|
+
"cli": "nx",
|
|
107
|
+
"version": "16.7.0-beta.2",
|
|
108
|
+
"description": "Add @babel/core to package.json if @babel/preset-react is present",
|
|
109
|
+
"implementation": "./src/migrations/update-16-7-0/add-babel-core"
|
|
110
|
+
},
|
|
111
|
+
"update-16-7-0-add-typings": {
|
|
112
|
+
"cli": "nx",
|
|
113
|
+
"version": "16.7.0-beta.2",
|
|
114
|
+
"description": "Add @nx/react types to tsconfig types array",
|
|
115
|
+
"implementation": "./src/migrations/update-16-7-0-add-typings/update-16-7-0-add-typings"
|
|
104
116
|
}
|
|
105
117
|
},
|
|
106
118
|
"packageJsonUpdates": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/react",
|
|
3
|
-
"version": "16.7.0-beta.
|
|
3
|
+
"version": "16.7.0-beta.3",
|
|
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, 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": {
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
"migrations": "./migrations.json"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@nrwl/react": "16.7.0-beta.
|
|
35
|
-
"@nx/devkit": "16.7.0-beta.
|
|
36
|
-
"@nx/js": "16.7.0-beta.
|
|
37
|
-
"@nx/linter": "16.7.0-beta.
|
|
38
|
-
"@nx/web": "16.7.0-beta.
|
|
34
|
+
"@nrwl/react": "16.7.0-beta.3",
|
|
35
|
+
"@nx/devkit": "16.7.0-beta.3",
|
|
36
|
+
"@nx/js": "16.7.0-beta.3",
|
|
37
|
+
"@nx/linter": "16.7.0-beta.3",
|
|
38
|
+
"@nx/web": "16.7.0-beta.3",
|
|
39
39
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
40
40
|
"@svgr/webpack": "^8.0.1",
|
|
41
41
|
"chalk": "^4.1.0",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"access": "public"
|
|
48
48
|
},
|
|
49
49
|
"types": "./index.d.ts",
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "118faf4e432667fd041954d96aa6c9c99fea5ebd"
|
|
51
51
|
}
|
|
@@ -35,7 +35,7 @@ function nxComponentTestingPreset(pathToConfig, options) {
|
|
|
35
35
|
if ((options === null || options === void 0 ? void 0 : options.bundler) === 'vite') {
|
|
36
36
|
return Object.assign(Object.assign({}, basePresetSettings), { specPattern: 'src/**/*.cy.{js,jsx,ts,tsx}', devServer: Object.assign(Object.assign({}, { framework: 'react', bundler: 'vite' }), { viteConfig: () => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
37
37
|
const viteConfigPath = findViteConfig(normalizedProjectRootPath);
|
|
38
|
-
const { mergeConfig, loadConfigFromFile, searchForWorkspaceRoot } = yield
|
|
38
|
+
const { mergeConfig, loadConfigFromFile, searchForWorkspaceRoot } = yield Function('return import("vite")')();
|
|
39
39
|
const resolved = yield loadConfigFromFile({
|
|
40
40
|
mode: 'watch',
|
|
41
41
|
command: 'serve',
|
|
@@ -7,7 +7,6 @@ const create_application_files_1 = require("./lib/create-application-files");
|
|
|
7
7
|
const update_jest_config_1 = require("./lib/update-jest-config");
|
|
8
8
|
const normalize_options_1 = require("./lib/normalize-options");
|
|
9
9
|
const add_project_1 = require("./lib/add-project");
|
|
10
|
-
const add_cypress_1 = require("./lib/add-cypress");
|
|
11
10
|
const add_jest_1 = require("./lib/add-jest");
|
|
12
11
|
const add_routing_1 = require("./lib/add-routing");
|
|
13
12
|
const set_defaults_1 = require("./lib/set-defaults");
|
|
@@ -22,6 +21,7 @@ const create_ts_config_1 = require("../../utils/create-ts-config");
|
|
|
22
21
|
const add_swc_dependencies_1 = require("@nx/js/src/utils/swc/add-swc-dependencies");
|
|
23
22
|
const chalk = require("chalk");
|
|
24
23
|
const show_possible_warnings_1 = require("./lib/show-possible-warnings");
|
|
24
|
+
const add_e2e_1 = require("./lib/add-e2e");
|
|
25
25
|
function addLinting(host, options) {
|
|
26
26
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
27
27
|
const tasks = [];
|
|
@@ -43,7 +43,7 @@ function addLinting(host, options) {
|
|
|
43
43
|
tasks.push(lintTask);
|
|
44
44
|
(0, devkit_1.updateJson)(host, (0, devkit_1.joinPathFragments)(options.appProjectRoot, '.eslintrc.json'), lint_1.extendReactEslintJson);
|
|
45
45
|
if (!options.skipPackageJson) {
|
|
46
|
-
const installTask =
|
|
46
|
+
const installTask = (0, devkit_1.addDependenciesToPackageJson)(host, lint_1.extraEslintDependencies.dependencies, lint_1.extraEslintDependencies.devDependencies);
|
|
47
47
|
const addSwcTask = (0, add_swc_dependencies_1.addSwcDependencies)(host);
|
|
48
48
|
tasks.push(installTask, addSwcTask);
|
|
49
49
|
}
|
|
@@ -118,8 +118,8 @@ function applicationGenerator(host, schema) {
|
|
|
118
118
|
}
|
|
119
119
|
const lintTask = yield addLinting(host, options);
|
|
120
120
|
tasks.push(lintTask);
|
|
121
|
-
const
|
|
122
|
-
tasks.push(
|
|
121
|
+
const e2eTask = yield (0, add_e2e_1.addE2e)(host, options);
|
|
122
|
+
tasks.push(e2eTask);
|
|
123
123
|
if (options.unitTestRunner === 'jest') {
|
|
124
124
|
const jestTask = yield (0, add_jest_1.addJest)(host, options);
|
|
125
125
|
tasks.push(jestTask);
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
"extends": "./tsconfig.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"outDir": "<%= offsetFromRoot %>dist/out-tsc",
|
|
5
|
-
"types": [
|
|
5
|
+
"types": [
|
|
6
|
+
"node",
|
|
7
|
+
<% if (style === 'styled-jsx') { %>"@nx/react/typings/styled-jsx.d.ts",<% } %>
|
|
8
|
+
"@nx/react/typings/cssmodule.d.ts",
|
|
9
|
+
"@nx/react/typings/image.d.ts"
|
|
10
|
+
]
|
|
6
11
|
},
|
|
7
|
-
"files": [
|
|
8
|
-
<% if (style === 'styled-jsx') { %>"<%= offsetFromRoot %>node_modules/@nx/react/typings/styled-jsx.d.ts",<% } %>
|
|
9
|
-
"<%= offsetFromRoot %>node_modules/@nx/react/typings/cssmodule.d.ts",
|
|
10
|
-
"<%= offsetFromRoot %>node_modules/@nx/react/typings/image.d.ts"
|
|
11
|
-
],
|
|
12
12
|
"exclude": ["jest.config.ts","src/**/*.spec.ts", "src/**/*.test.ts", "src/**/*.spec.tsx", "src/**/*.test.tsx", "src/**/*.spec.js", "src/**/*.test.js", "src/**/*.spec.jsx", "src/**/*.test.jsx"],
|
|
13
13
|
"include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"]
|
|
14
14
|
}
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
"extends": "./tsconfig.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"outDir": "<%= offsetFromRoot %>dist/out-tsc",
|
|
5
|
-
"types": [
|
|
5
|
+
"types": [
|
|
6
|
+
"node",
|
|
7
|
+
<% if (style === 'styled-jsx') { %>"@nx/react/typings/styled-jsx.d.ts",<% } %>
|
|
8
|
+
"@nx/react/typings/cssmodule.d.ts",
|
|
9
|
+
"@nx/react/typings/image.d.ts"
|
|
10
|
+
]
|
|
6
11
|
},
|
|
7
|
-
"files": [
|
|
8
|
-
<% if (style === 'styled-jsx') { %>"<%= offsetFromRoot %>node_modules/@nx/react/typings/styled-jsx.d.ts",<% } %>
|
|
9
|
-
"<%= offsetFromRoot %>node_modules/@nx/react/typings/cssmodule.d.ts",
|
|
10
|
-
"<%= offsetFromRoot %>node_modules/@nx/react/typings/image.d.ts"
|
|
11
|
-
],
|
|
12
12
|
"exclude": ["src/**/*.spec.ts", "src/**/*.test.ts", "src/**/*.spec.tsx", "src/**/*.test.tsx", "src/**/*.spec.js", "src/**/*.test.js", "src/**/*.spec.jsx", "src/**/*.test.jsx"],
|
|
13
13
|
"include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"]
|
|
14
14
|
}
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
"extends": "./tsconfig.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"outDir": "<%= offsetFromRoot %>dist/out-tsc",
|
|
5
|
-
"types": [
|
|
5
|
+
"types": [
|
|
6
|
+
"node",
|
|
7
|
+
<% if (style === 'styled-jsx') { %>"@nx/react/typings/styled-jsx.d.ts",<% } %>
|
|
8
|
+
"@nx/react/typings/cssmodule.d.ts",
|
|
9
|
+
"@nx/react/typings/image.d.ts"
|
|
10
|
+
]
|
|
6
11
|
},
|
|
7
|
-
"files": [
|
|
8
|
-
<% if (style === 'styled-jsx') { %>"<%= offsetFromRoot %>node_modules/@nx/react/typings/styled-jsx.d.ts",<% } %>
|
|
9
|
-
"<%= offsetFromRoot %>node_modules/@nx/react/typings/cssmodule.d.ts",
|
|
10
|
-
"<%= offsetFromRoot %>node_modules/@nx/react/typings/image.d.ts"
|
|
11
|
-
],
|
|
12
12
|
"exclude": ["jest.config.ts","src/**/*.spec.ts", "src/**/*.test.ts", "src/**/*.spec.tsx", "src/**/*.test.tsx", "src/**/*.spec.js", "src/**/*.test.js", "src/**/*.spec.jsx", "src/**/*.test.jsx"],
|
|
13
13
|
"include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"]
|
|
14
14
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addE2e = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
const web_1 = require("@nx/web");
|
|
7
|
+
const versions_1 = require("../../../utils/versions");
|
|
8
|
+
function addE2e(tree, options) {
|
|
9
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
10
|
+
switch (options.e2eTestRunner) {
|
|
11
|
+
case 'cypress':
|
|
12
|
+
(0, web_1.webStaticServeGenerator)(tree, {
|
|
13
|
+
buildTarget: `${options.projectName}:build`,
|
|
14
|
+
targetName: 'serve-static',
|
|
15
|
+
});
|
|
16
|
+
const { cypressProjectGenerator } = (0, devkit_1.ensurePackage)('@nx/cypress', versions_1.nxVersion);
|
|
17
|
+
return yield cypressProjectGenerator(tree, Object.assign(Object.assign({}, options), { name: options.e2eProjectName, directory: options.directory, project: options.projectName, bundler: options.bundler === 'rspack' ? 'webpack' : options.bundler, skipFormat: true }));
|
|
18
|
+
case 'playwright':
|
|
19
|
+
const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/playwright', versions_1.nxVersion);
|
|
20
|
+
(0, devkit_1.addProjectConfiguration)(tree, options.e2eProjectName, {
|
|
21
|
+
root: options.e2eProjectRoot,
|
|
22
|
+
sourceRoot: (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'src'),
|
|
23
|
+
targets: {},
|
|
24
|
+
implicitDependencies: [options.projectName],
|
|
25
|
+
});
|
|
26
|
+
return configurationGenerator(tree, {
|
|
27
|
+
project: options.e2eProjectName,
|
|
28
|
+
skipFormat: true,
|
|
29
|
+
skipPackageJson: options.skipPackageJson,
|
|
30
|
+
directory: 'src',
|
|
31
|
+
js: false,
|
|
32
|
+
linter: options.linter,
|
|
33
|
+
setParserOptionsProject: options.setParserOptionsProject,
|
|
34
|
+
webServerCommand: `${(0, devkit_1.getPackageManagerCommand)().exec} nx serve ${options.name}`,
|
|
35
|
+
});
|
|
36
|
+
case 'none':
|
|
37
|
+
default:
|
|
38
|
+
return () => { };
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
exports.addE2e = addE2e;
|
|
@@ -28,6 +28,7 @@ function installCommonDependencies(host, options) {
|
|
|
28
28
|
// babel-loader is currently included in @nx/webpack
|
|
29
29
|
// TODO(jack): Install babel-loader and other babel packages only as needed
|
|
30
30
|
devDependencies['@babel/preset-react'] = versions_1.babelPresetReactVersion;
|
|
31
|
+
devDependencies['@babel/core'] = versions_1.babelCoreVersion;
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
34
|
return (0, devkit_1.addDependenciesToPackageJson)(host, {}, devDependencies);
|
|
@@ -29,6 +29,9 @@ function normalizeOptions(host, options) {
|
|
|
29
29
|
const appProjectRoot = options.rootProject
|
|
30
30
|
? '.'
|
|
31
31
|
: (0, devkit_1.normalizePath)(`${appsDir}/${appDirectory}`);
|
|
32
|
+
const e2eProjectRoot = options.rootProject
|
|
33
|
+
? 'e2e'
|
|
34
|
+
: (0, devkit_1.joinPathFragments)(appsDir, `${appDirectory}-e2e`);
|
|
32
35
|
const parsedTags = options.tags
|
|
33
36
|
? options.tags.split(',').map((s) => s.trim())
|
|
34
37
|
: [];
|
|
@@ -42,6 +45,7 @@ function normalizeOptions(host, options) {
|
|
|
42
45
|
}
|
|
43
46
|
const normalized = Object.assign(Object.assign({}, options), { name: (0, devkit_1.names)(options.name).fileName, projectName: appProjectName, appProjectRoot,
|
|
44
47
|
e2eProjectName,
|
|
48
|
+
e2eProjectRoot,
|
|
45
49
|
parsedTags,
|
|
46
50
|
fileName,
|
|
47
51
|
styledModule, hasStyles: options.style !== 'none' });
|
|
@@ -8,14 +8,15 @@ function updateSpecConfig(host, options) {
|
|
|
8
8
|
return;
|
|
9
9
|
}
|
|
10
10
|
(0, devkit_1.updateJson)(host, `${options.appProjectRoot}/tsconfig.spec.json`, (json) => {
|
|
11
|
-
|
|
12
|
-
json.files = [
|
|
13
|
-
`${offset}node_modules/@nx/react/typings/cssmodule.d.ts`,
|
|
14
|
-
`${offset}node_modules/@nx/react/typings/image.d.ts`,
|
|
15
|
-
];
|
|
11
|
+
json.types = json.types || [];
|
|
16
12
|
if (options.style === 'styled-jsx') {
|
|
17
|
-
json.
|
|
13
|
+
json.types.push('@nx/react/typings/styled-jsx.d.ts');
|
|
18
14
|
}
|
|
15
|
+
json.types = [
|
|
16
|
+
...json.types,
|
|
17
|
+
'@nx/react/typings/cssmodule.d.ts',
|
|
18
|
+
'@nx/react/typings/image.d.ts',
|
|
19
|
+
];
|
|
19
20
|
return json;
|
|
20
21
|
});
|
|
21
22
|
if (options.unitTestRunner !== 'jest') {
|
|
@@ -9,7 +9,7 @@ export interface Schema {
|
|
|
9
9
|
tags?: string;
|
|
10
10
|
unitTestRunner?: 'jest' | 'vitest' | 'none';
|
|
11
11
|
inSourceTests?: boolean;
|
|
12
|
-
e2eTestRunner: 'cypress' | 'none';
|
|
12
|
+
e2eTestRunner: 'cypress' | 'playwright' | 'none';
|
|
13
13
|
linter: Linter;
|
|
14
14
|
pascalCaseFiles?: boolean;
|
|
15
15
|
classComponent?: boolean;
|
|
@@ -32,6 +32,7 @@ export interface NormalizedSchema<T extends Schema = Schema> extends T {
|
|
|
32
32
|
projectName: string;
|
|
33
33
|
appProjectRoot: string;
|
|
34
34
|
e2eProjectName: string;
|
|
35
|
+
e2eProjectRoot: string;
|
|
35
36
|
parsedTags: string[];
|
|
36
37
|
fileName: string;
|
|
37
38
|
styledModule: null | SupportedStyles;
|
|
@@ -117,8 +117,9 @@
|
|
|
117
117
|
},
|
|
118
118
|
"e2eTestRunner": {
|
|
119
119
|
"type": "string",
|
|
120
|
-
"enum": ["cypress", "none"],
|
|
120
|
+
"enum": ["cypress", "playwright", "none"],
|
|
121
121
|
"description": "Test runner to use for end to end (E2E) tests.",
|
|
122
|
+
"x-prompt": "Which E2E test runner would you like to use?",
|
|
122
123
|
"default": "cypress"
|
|
123
124
|
},
|
|
124
125
|
"tags": {
|
|
@@ -32,7 +32,10 @@ function installCommonDependencies(host, options) {
|
|
|
32
32
|
tasks.push((0, add_swc_dependencies_1.addSwcDependencies)(host));
|
|
33
33
|
}
|
|
34
34
|
else if (options.compiler === 'babel') {
|
|
35
|
-
tasks.push((0, devkit_1.addDependenciesToPackageJson)(host, {}, {
|
|
35
|
+
tasks.push((0, devkit_1.addDependenciesToPackageJson)(host, {}, {
|
|
36
|
+
'@babel/preset-react': versions_1.babelPresetReactVersion,
|
|
37
|
+
'@babel/core': versions_1.babelCoreVersion,
|
|
38
|
+
}));
|
|
36
39
|
}
|
|
37
40
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
38
41
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const versions_1 = require("../../utils/versions");
|
|
6
|
+
function addBabelCore(tree) {
|
|
7
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
8
|
+
const packageJson = (0, devkit_1.readJson)(tree, 'package.json');
|
|
9
|
+
if (packageJson === null || packageJson === void 0 ? void 0 : packageJson.devDependencies['@babel/preset-react']) {
|
|
10
|
+
(0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
|
|
11
|
+
'@babel/core': versions_1.babelCoreVersion,
|
|
12
|
+
});
|
|
13
|
+
yield (0, devkit_1.formatFiles)(tree);
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
exports.default = addBabelCore;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
function addTypings(tree) {
|
|
6
|
+
var _a, _b;
|
|
7
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
8
|
+
const projects = (0, devkit_1.getProjects)(tree);
|
|
9
|
+
const buildExecutors = [
|
|
10
|
+
'@nx/webpack:webpack',
|
|
11
|
+
'@nx/vite:build',
|
|
12
|
+
'@nx/rspack:rspack',
|
|
13
|
+
];
|
|
14
|
+
const relatedTsConfigs = [
|
|
15
|
+
'tsconfig.app.json',
|
|
16
|
+
'tsconfig.lib.json',
|
|
17
|
+
'tsconfig.spec.json',
|
|
18
|
+
];
|
|
19
|
+
const typesToAdd = [
|
|
20
|
+
'@nx/react/typings/cssmodule.d.ts',
|
|
21
|
+
'@nx/react/typings/image.d.ts',
|
|
22
|
+
];
|
|
23
|
+
for (const [, config] of projects) {
|
|
24
|
+
if (buildExecutors.includes((_b = (_a = config === null || config === void 0 ? void 0 : config.targets) === null || _a === void 0 ? void 0 : _a.build) === null || _b === void 0 ? void 0 : _b.executor)) {
|
|
25
|
+
const rootPath = config.root;
|
|
26
|
+
relatedTsConfigs.forEach((tsConfig) => {
|
|
27
|
+
const tsConfigPath = (0, devkit_1.joinPathFragments)(rootPath, tsConfig);
|
|
28
|
+
if (tree.exists(tsConfigPath)) {
|
|
29
|
+
(0, devkit_1.updateJson)(tree, tsConfigPath, (json) => {
|
|
30
|
+
var _a;
|
|
31
|
+
const compilerOptions = json.compilerOptions || {};
|
|
32
|
+
compilerOptions.types = [
|
|
33
|
+
...new Set([...(compilerOptions.types || []), ...typesToAdd]),
|
|
34
|
+
];
|
|
35
|
+
if (((_a = json.files) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
36
|
+
json.files = json.files.filter((file) => !['cssmodule.d.ts', 'image.d.ts'].includes(file));
|
|
37
|
+
}
|
|
38
|
+
return Object.assign(Object.assign({}, json), { compilerOptions });
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
yield (0, devkit_1.formatFiles)(tree);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
exports.default = addTypings;
|
package/src/utils/versions.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export declare const typesReactDomVersion = "18.2.6";
|
|
|
10
10
|
export declare const typesReactIsVersion = "18.2.1";
|
|
11
11
|
export declare const typesNodeVersion = "18.14.2";
|
|
12
12
|
export declare const babelPresetReactVersion = "^7.14.5";
|
|
13
|
+
export declare const babelCoreVersion = "^7.14.5";
|
|
13
14
|
export declare const styledComponentsVersion = "5.3.6";
|
|
14
15
|
export declare const typesStyledComponentsVersion = "5.1.26";
|
|
15
16
|
export declare const emotionStyledVersion = "11.11.0";
|
package/src/utils/versions.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.swcPluginStyledComponentsVersion = exports.swcPluginEmotionVersion = exports.swcPluginStyledJsxVersion = exports.svgrRollupVersion = exports.rollupPluginUrlVersion = exports.stylusVersion = exports.sassVersion = exports.lessVersion = 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.reactTestRendererVersion = exports.reactReduxVersion = exports.reduxjsToolkitVersion = exports.testingLibraryReactVersion = exports.reactRouterDomVersion = exports.styledJsxVersion = exports.emotionBabelPlugin = exports.emotionReactVersion = exports.emotionStyledVersion = exports.typesStyledComponentsVersion = exports.styledComponentsVersion = exports.babelPresetReactVersion = exports.typesNodeVersion = exports.typesReactIsVersion = exports.typesReactDomVersion = exports.typesReactVersion = exports.babelLoaderVersion = exports.swcLoaderVersion = exports.reactIsVersion = exports.reactDomVersion = exports.reactVersion = exports.nxRspackVersion = exports.nxVersion = void 0;
|
|
3
|
+
exports.swcPluginStyledComponentsVersion = exports.swcPluginEmotionVersion = exports.swcPluginStyledJsxVersion = exports.svgrRollupVersion = exports.rollupPluginUrlVersion = exports.stylusVersion = exports.sassVersion = exports.lessVersion = 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.reactTestRendererVersion = 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.typesReactIsVersion = exports.typesReactDomVersion = exports.typesReactVersion = exports.babelLoaderVersion = exports.swcLoaderVersion = exports.reactIsVersion = exports.reactDomVersion = exports.reactVersion = exports.nxRspackVersion = exports.nxVersion = void 0;
|
|
4
4
|
exports.nxVersion = require('../../package.json').version;
|
|
5
5
|
// Always pull the latest version until we merge rspack plugin into the repo.
|
|
6
6
|
exports.nxRspackVersion = '*';
|
|
@@ -14,6 +14,7 @@ exports.typesReactDomVersion = '18.2.6';
|
|
|
14
14
|
exports.typesReactIsVersion = '18.2.1';
|
|
15
15
|
exports.typesNodeVersion = '18.14.2';
|
|
16
16
|
exports.babelPresetReactVersion = '^7.14.5';
|
|
17
|
+
exports.babelCoreVersion = '^7.14.5';
|
|
17
18
|
exports.styledComponentsVersion = '5.3.6';
|
|
18
19
|
exports.typesStyledComponentsVersion = '5.1.26';
|
|
19
20
|
exports.emotionStyledVersion = '11.11.0';
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addCypress = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const devkit_1 = require("@nx/devkit");
|
|
6
|
-
const web_1 = require("@nx/web");
|
|
7
|
-
const versions_1 = require("../../../utils/versions");
|
|
8
|
-
function addCypress(host, options) {
|
|
9
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
10
|
-
if (options.e2eTestRunner !== 'cypress') {
|
|
11
|
-
return () => { };
|
|
12
|
-
}
|
|
13
|
-
yield (0, web_1.webStaticServeGenerator)(host, {
|
|
14
|
-
buildTarget: `${options.projectName}:build`,
|
|
15
|
-
targetName: 'serve-static',
|
|
16
|
-
});
|
|
17
|
-
const { cypressProjectGenerator } = (0, devkit_1.ensurePackage)('@nx/cypress', versions_1.nxVersion);
|
|
18
|
-
return yield cypressProjectGenerator(host, Object.assign(Object.assign({}, options), { name: options.e2eProjectName, directory: options.directory, project: options.projectName, bundler: options.bundler === 'rspack' ? 'webpack' : options.bundler, skipFormat: true }));
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
exports.addCypress = addCypress;
|