@nrwl/react 14.6.0-rc.2 → 14.6.2
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/CHANGELOG.md +1 -1
- package/migrations.json +25 -0
- package/package.json +10 -10
- package/plugins/component-testing/index.d.ts +12 -4
- package/plugins/component-testing/index.js +114 -134
- package/plugins/component-testing/index.js.map +1 -1
- package/plugins/component-testing/webpack-fallback.d.ts +5 -0
- package/plugins/component-testing/webpack-fallback.js +135 -0
- package/plugins/component-testing/webpack-fallback.js.map +1 -0
- package/src/generators/component-test/component-test.js +3 -0
- package/src/generators/component-test/component-test.js.map +1 -1
- package/src/generators/cypress-component-configuration/cypress-component-configuration.d.ts +1 -1
- package/src/generators/cypress-component-configuration/cypress-component-configuration.js +5 -79
- package/src/generators/cypress-component-configuration/cypress-component-configuration.js.map +1 -1
- package/src/generators/cypress-component-configuration/files/cypress.config.ts__tpl__ +1 -1
- package/src/generators/cypress-component-configuration/lib/add-files.d.ts +3 -0
- package/src/generators/cypress-component-configuration/lib/add-files.js +39 -0
- package/src/generators/cypress-component-configuration/lib/add-files.js.map +1 -0
- package/src/generators/cypress-component-configuration/lib/update-configs.d.ts +4 -0
- package/src/generators/cypress-component-configuration/lib/update-configs.js +71 -0
- package/src/generators/cypress-component-configuration/lib/update-configs.js.map +1 -0
- package/src/generators/cypress-component-configuration/schema.d.ts +4 -3
- package/src/generators/cypress-component-configuration/schema.json +6 -1
- package/src/utils/versions.d.ts +5 -5
- package/src/utils/versions.js +5 -5
- package/src/utils/versions.js.map +1 -1
- package/src/generators/cypress-component-configuration/schema.js +0 -3
- package/src/generators/cypress-component-configuration/schema.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
## [14.6.2](https://github.com/nrwl/nx/compare/14.6.1...14.6.2) (2022-09-01)
|
|
7
7
|
|
|
8
8
|
**Note:** Version bump only for package @nrwl/react
|
package/migrations.json
CHANGED
|
@@ -658,6 +658,31 @@
|
|
|
658
658
|
"alwaysAddToPackageJson": false
|
|
659
659
|
}
|
|
660
660
|
}
|
|
661
|
+
},
|
|
662
|
+
"14.6.0": {
|
|
663
|
+
"version": "14.6.0-beta.0",
|
|
664
|
+
"packages": {
|
|
665
|
+
"@types/react": {
|
|
666
|
+
"version": "18.0.18",
|
|
667
|
+
"alwaysAddToPackageJson": false
|
|
668
|
+
},
|
|
669
|
+
"@types/node": {
|
|
670
|
+
"version": "18.7.14",
|
|
671
|
+
"alwaysAddToPackageJson": false
|
|
672
|
+
},
|
|
673
|
+
"@emotion/styled": {
|
|
674
|
+
"version": "11.10.4",
|
|
675
|
+
"alwaysAddToPackageJson": false
|
|
676
|
+
},
|
|
677
|
+
"@emotion/react": {
|
|
678
|
+
"version": "11.10.4",
|
|
679
|
+
"alwaysAddToPackageJson": false
|
|
680
|
+
},
|
|
681
|
+
"eslint-plugin-react": {
|
|
682
|
+
"version": "7.31.1",
|
|
683
|
+
"alwaysAddToPackageJson": false
|
|
684
|
+
}
|
|
685
|
+
}
|
|
661
686
|
}
|
|
662
687
|
}
|
|
663
688
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nrwl/react",
|
|
3
|
-
"version": "14.6.
|
|
3
|
+
"version": "14.6.2",
|
|
4
4
|
"description": "The React plugin 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.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -32,14 +32,14 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@babel/core": "^7.15.0",
|
|
34
34
|
"@babel/preset-react": "^7.14.5",
|
|
35
|
-
"@nrwl/cypress": "14.6.
|
|
36
|
-
"@nrwl/devkit": "14.6.
|
|
37
|
-
"@nrwl/jest": "14.6.
|
|
38
|
-
"@nrwl/js": "14.6.
|
|
39
|
-
"@nrwl/linter": "14.6.
|
|
40
|
-
"@nrwl/storybook": "14.6.
|
|
41
|
-
"@nrwl/web": "14.6.
|
|
42
|
-
"@nrwl/workspace": "14.6.
|
|
35
|
+
"@nrwl/cypress": "14.6.2",
|
|
36
|
+
"@nrwl/devkit": "14.6.2",
|
|
37
|
+
"@nrwl/jest": "14.6.2",
|
|
38
|
+
"@nrwl/js": "14.6.2",
|
|
39
|
+
"@nrwl/linter": "14.6.2",
|
|
40
|
+
"@nrwl/storybook": "14.6.2",
|
|
41
|
+
"@nrwl/web": "14.6.2",
|
|
42
|
+
"@nrwl/workspace": "14.6.2",
|
|
43
43
|
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.7",
|
|
44
44
|
"@svgr/webpack": "^6.1.2",
|
|
45
45
|
"chalk": "4.1.0",
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"webpack": "^5.58.1",
|
|
55
55
|
"webpack-merge": "^5.8.0"
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "278bb5165fed42d284067092c02d90a99e26f18f"
|
|
58
58
|
}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
export interface ReactComponentTestingOptions {
|
|
2
|
+
/**
|
|
3
|
+
* the component testing target name.
|
|
4
|
+
* this is only when customized away from the default value of `component-test`
|
|
5
|
+
* @example 'component-test'
|
|
6
|
+
*/
|
|
7
|
+
ctTargetName: string;
|
|
8
|
+
}
|
|
2
9
|
/**
|
|
3
10
|
* React nx preset for Cypress Component Testing
|
|
4
11
|
*
|
|
@@ -14,13 +21,14 @@ import type { Configuration } from 'webpack';
|
|
|
14
21
|
* }
|
|
15
22
|
* })
|
|
16
23
|
*
|
|
17
|
-
* @param pathToConfig will be used to construct the output paths for videos and screenshots
|
|
24
|
+
* @param pathToConfig will be used for loading project options and to construct the output paths for videos and screenshots
|
|
25
|
+
* @param options override options
|
|
18
26
|
*/
|
|
19
|
-
export declare function nxComponentTestingPreset(pathToConfig: string): {
|
|
27
|
+
export declare function nxComponentTestingPreset(pathToConfig: string, options?: ReactComponentTestingOptions): {
|
|
20
28
|
devServer: {
|
|
21
29
|
readonly framework: "react";
|
|
22
30
|
readonly bundler: "webpack";
|
|
23
|
-
readonly webpackConfig:
|
|
31
|
+
readonly webpackConfig: any;
|
|
24
32
|
};
|
|
25
33
|
videosFolder: string;
|
|
26
34
|
screenshotsFolder: string;
|
|
@@ -2,8 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.nxComponentTestingPreset = void 0;
|
|
4
4
|
const cypress_preset_1 = require("@nrwl/cypress/plugins/cypress-preset");
|
|
5
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
6
|
+
const normalize_1 = require("@nrwl/web/src/utils/normalize");
|
|
5
7
|
const web_config_1 = require("@nrwl/web/src/utils/web.config");
|
|
6
|
-
const
|
|
8
|
+
const runtime_lint_utils_1 = require("@nrwl/workspace/src/utils/runtime-lint-utils");
|
|
9
|
+
const fs_1 = require("fs");
|
|
10
|
+
const project_graph_1 = require("nx/src/project-graph/project-graph");
|
|
11
|
+
const path_1 = require("path");
|
|
12
|
+
const webpack_fallback_1 = require("./webpack-fallback");
|
|
7
13
|
/**
|
|
8
14
|
* React nx preset for Cypress Component Testing
|
|
9
15
|
*
|
|
@@ -19,149 +25,123 @@ const tsconfig_paths_webpack_plugin_1 = require("tsconfig-paths-webpack-plugin")
|
|
|
19
25
|
* }
|
|
20
26
|
* })
|
|
21
27
|
*
|
|
22
|
-
* @param pathToConfig will be used to construct the output paths for videos and screenshots
|
|
28
|
+
* @param pathToConfig will be used for loading project options and to construct the output paths for videos and screenshots
|
|
29
|
+
* @param options override options
|
|
23
30
|
*/
|
|
24
|
-
function nxComponentTestingPreset(pathToConfig) {
|
|
31
|
+
function nxComponentTestingPreset(pathToConfig, options) {
|
|
32
|
+
let webpackConfig;
|
|
33
|
+
try {
|
|
34
|
+
const graph = (0, devkit_1.readCachedProjectGraph)();
|
|
35
|
+
const { targets: ctTargets, name: ctProjectName } = getConfigByPath(graph, pathToConfig);
|
|
36
|
+
const ctTargetName = (options === null || options === void 0 ? void 0 : options.ctTargetName) || 'component-test';
|
|
37
|
+
const ctConfigurationName = process.env.NX_CYPRESS_TARGET_CONFIGURATION;
|
|
38
|
+
const ctExecutorContext = createExecutorContext(graph, ctTargets, ctProjectName, ctTargetName, ctConfigurationName);
|
|
39
|
+
const ctExecutorOptions = (0, devkit_1.readTargetOptions)({
|
|
40
|
+
project: ctProjectName,
|
|
41
|
+
target: ctTargetName,
|
|
42
|
+
configuration: ctConfigurationName,
|
|
43
|
+
}, ctExecutorContext);
|
|
44
|
+
const buildTarget = ctExecutorOptions.devServerTarget;
|
|
45
|
+
if (!buildTarget) {
|
|
46
|
+
throw new Error(`Unable to find the 'devServerTarget' executor option in the '${ctTargetName}' target of the '${ctProjectName}' project`);
|
|
47
|
+
}
|
|
48
|
+
webpackConfig = buildTargetWebpack(graph, buildTarget, ctProjectName);
|
|
49
|
+
}
|
|
50
|
+
catch (e) {
|
|
51
|
+
devkit_1.logger.warn((0, devkit_1.stripIndents) `Unable to build a webpack config with the project graph.
|
|
52
|
+
Falling back to default webpack config.`);
|
|
53
|
+
devkit_1.logger.warn(e);
|
|
54
|
+
webpackConfig = (0, webpack_fallback_1.buildBaseWebpackConfig)({
|
|
55
|
+
tsConfigPath: 'tsconfig.cy.json',
|
|
56
|
+
compiler: 'babel',
|
|
57
|
+
});
|
|
58
|
+
}
|
|
25
59
|
return Object.assign(Object.assign({}, (0, cypress_preset_1.nxBaseCypressPreset)(pathToConfig)), { devServer: {
|
|
26
60
|
// cypress uses string union type,
|
|
27
61
|
// need to use const to prevent typing to string
|
|
28
62
|
framework: 'react',
|
|
29
63
|
bundler: 'webpack',
|
|
30
|
-
webpackConfig
|
|
31
|
-
tsConfigPath: 'tsconfig.cy.json',
|
|
32
|
-
compiler: 'babel',
|
|
33
|
-
}),
|
|
64
|
+
webpackConfig,
|
|
34
65
|
} });
|
|
35
66
|
}
|
|
36
67
|
exports.nxComponentTestingPreset = nxComponentTestingPreset;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
config.module.rules.push({
|
|
75
|
-
test: /\.([jt])sx?$/,
|
|
76
|
-
loader: require.resolve('swc-loader'),
|
|
77
|
-
exclude: /node_modules/,
|
|
78
|
-
options: {
|
|
79
|
-
jsc: {
|
|
80
|
-
parser: {
|
|
81
|
-
syntax: 'typescript',
|
|
82
|
-
decorators: true,
|
|
83
|
-
tsx: true,
|
|
84
|
-
},
|
|
85
|
-
transform: {
|
|
86
|
-
react: {
|
|
87
|
-
runtime: 'automatic',
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
loose: true,
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
});
|
|
68
|
+
/**
|
|
69
|
+
* apply the schema.json defaults from the @nrwl/web:webpack executor to the target options
|
|
70
|
+
*/
|
|
71
|
+
function withSchemaDefaults(target, context) {
|
|
72
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
73
|
+
const options = (0, devkit_1.readTargetOptions)(target, context);
|
|
74
|
+
(_a = options.compiler) !== null && _a !== void 0 ? _a : (options.compiler = 'babel');
|
|
75
|
+
(_b = options.deleteOutputPath) !== null && _b !== void 0 ? _b : (options.deleteOutputPath = true);
|
|
76
|
+
(_c = options.vendorChunk) !== null && _c !== void 0 ? _c : (options.vendorChunk = true);
|
|
77
|
+
(_d = options.commonChunk) !== null && _d !== void 0 ? _d : (options.commonChunk = true);
|
|
78
|
+
(_e = options.runtimeChunk) !== null && _e !== void 0 ? _e : (options.runtimeChunk = true);
|
|
79
|
+
(_f = options.sourceMap) !== null && _f !== void 0 ? _f : (options.sourceMap = true);
|
|
80
|
+
(_g = options.assets) !== null && _g !== void 0 ? _g : (options.assets = []);
|
|
81
|
+
(_h = options.scripts) !== null && _h !== void 0 ? _h : (options.scripts = []);
|
|
82
|
+
(_j = options.styles) !== null && _j !== void 0 ? _j : (options.styles = []);
|
|
83
|
+
(_k = options.budgets) !== null && _k !== void 0 ? _k : (options.budgets = []);
|
|
84
|
+
(_l = options.namedChunks) !== null && _l !== void 0 ? _l : (options.namedChunks = true);
|
|
85
|
+
(_m = options.outputHashing) !== null && _m !== void 0 ? _m : (options.outputHashing = 'none');
|
|
86
|
+
(_o = options.extractCss) !== null && _o !== void 0 ? _o : (options.extractCss = true);
|
|
87
|
+
(_p = options.memoryLimit) !== null && _p !== void 0 ? _p : (options.memoryLimit = 2048);
|
|
88
|
+
(_q = options.maxWorkers) !== null && _q !== void 0 ? _q : (options.maxWorkers = 2);
|
|
89
|
+
(_r = options.fileReplacements) !== null && _r !== void 0 ? _r : (options.fileReplacements = []);
|
|
90
|
+
(_s = options.buildLibsFromSource) !== null && _s !== void 0 ? _s : (options.buildLibsFromSource = true);
|
|
91
|
+
(_t = options.generateIndexHtml) !== null && _t !== void 0 ? _t : (options.generateIndexHtml = true);
|
|
92
|
+
return options;
|
|
93
|
+
}
|
|
94
|
+
function buildTargetWebpack(graph, buildTarget, componentTestingProjectName) {
|
|
95
|
+
var _a, _b;
|
|
96
|
+
const parsed = (0, devkit_1.parseTargetString)(buildTarget);
|
|
97
|
+
const buildableProjectConfig = (_a = graph.nodes[parsed.project]) === null || _a === void 0 ? void 0 : _a.data;
|
|
98
|
+
const ctProjectConfig = (_b = graph.nodes[componentTestingProjectName]) === null || _b === void 0 ? void 0 : _b.data;
|
|
99
|
+
if (!buildableProjectConfig || !ctProjectConfig) {
|
|
100
|
+
throw new Error((0, devkit_1.stripIndents) `Unable to load project configs from graph.
|
|
101
|
+
Using build target '${buildTarget}'
|
|
102
|
+
Has build config? ${!!buildableProjectConfig}
|
|
103
|
+
Has component config? ${!!ctProjectConfig}
|
|
104
|
+
`);
|
|
94
105
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
options
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
106
|
+
const options = (0, normalize_1.normalizeWebBuildOptions)(withSchemaDefaults(parsed, createExecutorContext(graph, buildableProjectConfig.targets, parsed.project, parsed.target, parsed.target)), devkit_1.workspaceRoot, buildableProjectConfig.sourceRoot);
|
|
107
|
+
const isScriptOptimizeOn = typeof options.optimization === 'boolean'
|
|
108
|
+
? options.optimization
|
|
109
|
+
: options.optimization && options.optimization.scripts
|
|
110
|
+
? options.optimization.scripts
|
|
111
|
+
: false;
|
|
112
|
+
return (0, web_config_1.getWebConfig)(devkit_1.workspaceRoot, ctProjectConfig.root, ctProjectConfig.sourceRoot, options, true, isScriptOptimizeOn, parsed.configuration);
|
|
113
|
+
}
|
|
114
|
+
function getConfigByPath(graph, configPath) {
|
|
115
|
+
var _a, _b, _c;
|
|
116
|
+
var _d;
|
|
117
|
+
const configFileFromWorkspaceRoot = (0, path_1.relative)(devkit_1.workspaceRoot, configPath);
|
|
118
|
+
const normalizedPathFromWorkspaceRoot = (0, fs_1.lstatSync)(configPath).isFile()
|
|
119
|
+
? configFileFromWorkspaceRoot.replace((0, path_1.extname)(configPath), '')
|
|
120
|
+
: configFileFromWorkspaceRoot;
|
|
121
|
+
const mappedGraph = (0, runtime_lint_utils_1.mapProjectGraphFiles)(graph);
|
|
122
|
+
const componentTestingProjectName = mappedGraph.allFiles[normalizedPathFromWorkspaceRoot];
|
|
123
|
+
if (!componentTestingProjectName ||
|
|
124
|
+
!((_a = graph.nodes[componentTestingProjectName]) === null || _a === void 0 ? void 0 : _a.data)) {
|
|
125
|
+
throw new Error((0, devkit_1.stripIndents) `Unable to find the project configuration that includes ${normalizedPathFromWorkspaceRoot}.
|
|
126
|
+
Found project name? ${componentTestingProjectName}.
|
|
127
|
+
Graph has data? ${!!((_b = graph.nodes[componentTestingProjectName]) === null || _b === void 0 ? void 0 : _b.data)}`);
|
|
105
128
|
}
|
|
106
|
-
|
|
129
|
+
// make sure name is set since it can be undefined
|
|
130
|
+
(_c = (_d = graph.nodes[componentTestingProjectName].data).name) !== null && _c !== void 0 ? _c : (_d.name = componentTestingProjectName);
|
|
131
|
+
return graph.nodes[componentTestingProjectName].data;
|
|
132
|
+
}
|
|
133
|
+
function createExecutorContext(graph, targets, projectName, targetName, configurationName) {
|
|
134
|
+
const projectConfigs = (0, project_graph_1.readProjectsConfigurationFromProjectGraph)(graph);
|
|
135
|
+
return {
|
|
136
|
+
cwd: process.cwd(),
|
|
137
|
+
projectGraph: graph,
|
|
138
|
+
target: targets[targetName],
|
|
139
|
+
targetName,
|
|
140
|
+
configurationName,
|
|
141
|
+
root: devkit_1.workspaceRoot,
|
|
142
|
+
isVerbose: false,
|
|
143
|
+
projectName,
|
|
144
|
+
workspace: Object.assign(Object.assign({}, (0, devkit_1.readNxJson)()), projectConfigs),
|
|
145
|
+
};
|
|
107
146
|
}
|
|
108
|
-
const loaderModulesOptions = {
|
|
109
|
-
modules: {
|
|
110
|
-
mode: 'local',
|
|
111
|
-
getLocalIdent: web_config_1.getCSSModuleLocalIdent,
|
|
112
|
-
},
|
|
113
|
-
importLoaders: 1,
|
|
114
|
-
};
|
|
115
|
-
const commonLoaders = [
|
|
116
|
-
{
|
|
117
|
-
loader: require.resolve('style-loader'),
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
loader: require.resolve('css-loader'),
|
|
121
|
-
options: loaderModulesOptions,
|
|
122
|
-
},
|
|
123
|
-
];
|
|
124
|
-
const CSS_MODULES_LOADER = {
|
|
125
|
-
test: /\.css$|\.scss$|\.sass$|\.less$|\.styl$/,
|
|
126
|
-
oneOf: [
|
|
127
|
-
{
|
|
128
|
-
test: /\.module\.css$/,
|
|
129
|
-
use: commonLoaders,
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
test: /\.module\.(scss|sass)$/,
|
|
133
|
-
use: [
|
|
134
|
-
...commonLoaders,
|
|
135
|
-
{
|
|
136
|
-
loader: require.resolve('sass-loader'),
|
|
137
|
-
options: {
|
|
138
|
-
implementation: require('sass'),
|
|
139
|
-
sassOptions: {
|
|
140
|
-
fiber: false,
|
|
141
|
-
precision: 8,
|
|
142
|
-
},
|
|
143
|
-
},
|
|
144
|
-
},
|
|
145
|
-
],
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
test: /\.module\.less$/,
|
|
149
|
-
use: [
|
|
150
|
-
...commonLoaders,
|
|
151
|
-
{
|
|
152
|
-
loader: require.resolve('less-loader'),
|
|
153
|
-
},
|
|
154
|
-
],
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
test: /\.module\.styl$/,
|
|
158
|
-
use: [
|
|
159
|
-
...commonLoaders,
|
|
160
|
-
{
|
|
161
|
-
loader: require.resolve('stylus-loader'),
|
|
162
|
-
},
|
|
163
|
-
],
|
|
164
|
-
},
|
|
165
|
-
],
|
|
166
|
-
};
|
|
167
147
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/react/plugins/component-testing/index.ts"],"names":[],"mappings":";;;AAAA,yEAA2E;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/react/plugins/component-testing/index.ts"],"names":[],"mappings":";;;AAAA,yEAA2E;AAE3E,yCAasB;AAEtB,6DAAyE;AACzE,+DAA8D;AAC9D,qFAAoF;AACpF,2BAA+B;AAC/B,sEAA+F;AAC/F,+BAAyC;AACzC,yDAA4D;AAW5D;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,wBAAwB,CACtC,YAAoB,EACpB,OAAsC;IAEtC,IAAI,aAAa,CAAC;IAClB,IAAI;QACF,MAAM,KAAK,GAAG,IAAA,+BAAsB,GAAE,CAAC;QACvC,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,eAAe,CACjE,KAAK,EACL,YAAY,CACb,CAAC;QACF,MAAM,YAAY,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,YAAY,KAAI,gBAAgB,CAAC;QAC/D,MAAM,mBAAmB,GAAG,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC;QAExE,MAAM,iBAAiB,GAAG,qBAAqB,CAC7C,KAAK,EACL,SAAS,EACT,aAAa,EACb,YAAY,EACZ,mBAAmB,CACpB,CAAC;QAEF,MAAM,iBAAiB,GAAG,IAAA,0BAAiB,EACzC;YACE,OAAO,EAAE,aAAa;YACtB,MAAM,EAAE,YAAY;YACpB,aAAa,EAAE,mBAAmB;SACnC,EACD,iBAAiB,CAClB,CAAC;QAEF,MAAM,WAAW,GAAG,iBAAiB,CAAC,eAAe,CAAC;QAEtD,IAAI,CAAC,WAAW,EAAE;YAChB,MAAM,IAAI,KAAK,CACb,gEAAgE,YAAY,oBAAoB,aAAa,WAAW,CACzH,CAAC;SACH;QAED,aAAa,GAAG,kBAAkB,CAAC,KAAK,EAAE,WAAW,EAAE,aAAa,CAAC,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A2B,CAAC,0CAAE,IAAI,CAAA,EAC/C;QACA,MAAM,IAAI,KAAK,CACb,IAAA,qBAAY,EAAA,0DAA0D,+BAA+B;4BAC/E,2BAA2B;wBAC/B,CAAC,CAAC,CAAA,MAAA,KAAK,CAAC,KAAK,CAAC,2BAA2B,CAAC,0CAAE,IAAI,CAAA,EAAE,CACrE,CAAC;KACH;IACD,kDAAkD;IAClD,YAAA,KAAK,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC,IAAI,EAAC,IAAI,uCAAJ,IAAI,GAChD,2BAA2B,EAAC;IAC9B,OAAO,KAAK,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC,IAAI,CAAC;AACvD,CAAC;AAED,SAAS,qBAAqB,CAC5B,KAAmB,EACnB,OAA4C,EAC5C,WAAmB,EACnB,UAAkB,EAClB,iBAAyB;IAEzB,MAAM,cAAc,GAAG,IAAA,yDAAyC,EAAC,KAAK,CAAC,CAAC;IACxE,OAAO;QACL,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;QAClB,YAAY,EAAE,KAAK;QACnB,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC;QAC3B,UAAU;QACV,iBAAiB;QACjB,IAAI,EAAE,sBAAa;QACnB,SAAS,EAAE,KAAK;QAChB,WAAW;QACX,SAAS,kCACJ,IAAA,mBAAU,GAAE,GACZ,cAAc,CAClB;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildBaseWebpackConfig = void 0;
|
|
4
|
+
const web_config_1 = require("@nrwl/web/src/utils/web.config");
|
|
5
|
+
const tsconfig_paths_webpack_plugin_1 = require("tsconfig-paths-webpack-plugin");
|
|
6
|
+
function buildBaseWebpackConfig({ tsConfigPath = 'tsconfig.cy.json', compiler = 'babel', }) {
|
|
7
|
+
const extensions = ['.ts', '.tsx', '.mjs', '.js', '.jsx'];
|
|
8
|
+
const config = {
|
|
9
|
+
target: 'web',
|
|
10
|
+
resolve: {
|
|
11
|
+
extensions,
|
|
12
|
+
plugins: [
|
|
13
|
+
new tsconfig_paths_webpack_plugin_1.TsconfigPathsPlugin({
|
|
14
|
+
configFile: tsConfigPath,
|
|
15
|
+
extensions,
|
|
16
|
+
}),
|
|
17
|
+
],
|
|
18
|
+
},
|
|
19
|
+
mode: 'development',
|
|
20
|
+
devtool: false,
|
|
21
|
+
output: {
|
|
22
|
+
publicPath: '/',
|
|
23
|
+
chunkFilename: '[name].bundle.js',
|
|
24
|
+
},
|
|
25
|
+
module: {
|
|
26
|
+
rules: [
|
|
27
|
+
{
|
|
28
|
+
test: /\.(bmp|png|jpe?g|gif|webp|avif)$/,
|
|
29
|
+
type: 'asset',
|
|
30
|
+
parser: {
|
|
31
|
+
dataUrlCondition: {
|
|
32
|
+
maxSize: 10000, // 10 kB
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
CSS_MODULES_LOADER,
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
if (compiler === 'swc') {
|
|
41
|
+
config.module.rules.push({
|
|
42
|
+
test: /\.([jt])sx?$/,
|
|
43
|
+
loader: require.resolve('swc-loader'),
|
|
44
|
+
exclude: /node_modules/,
|
|
45
|
+
options: {
|
|
46
|
+
jsc: {
|
|
47
|
+
parser: {
|
|
48
|
+
syntax: 'typescript',
|
|
49
|
+
decorators: true,
|
|
50
|
+
tsx: true,
|
|
51
|
+
},
|
|
52
|
+
transform: {
|
|
53
|
+
react: {
|
|
54
|
+
runtime: 'automatic',
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
loose: true,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
if (compiler === 'babel') {
|
|
63
|
+
config.module.rules.push({
|
|
64
|
+
test: /\.(js|jsx|mjs|ts|tsx)$/,
|
|
65
|
+
loader: require.resolve('babel-loader'),
|
|
66
|
+
options: {
|
|
67
|
+
presets: [`@nrwl/react/babel`],
|
|
68
|
+
rootMode: 'upward',
|
|
69
|
+
babelrc: true,
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
return config;
|
|
74
|
+
}
|
|
75
|
+
exports.buildBaseWebpackConfig = buildBaseWebpackConfig;
|
|
76
|
+
const loaderModulesOptions = {
|
|
77
|
+
modules: {
|
|
78
|
+
mode: 'local',
|
|
79
|
+
getLocalIdent: web_config_1.getCSSModuleLocalIdent,
|
|
80
|
+
},
|
|
81
|
+
importLoaders: 1,
|
|
82
|
+
};
|
|
83
|
+
const commonLoaders = [
|
|
84
|
+
{
|
|
85
|
+
loader: require.resolve('style-loader'),
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
loader: require.resolve('css-loader'),
|
|
89
|
+
options: loaderModulesOptions,
|
|
90
|
+
},
|
|
91
|
+
];
|
|
92
|
+
const CSS_MODULES_LOADER = {
|
|
93
|
+
test: /\.css$|\.scss$|\.sass$|\.less$|\.styl$/,
|
|
94
|
+
oneOf: [
|
|
95
|
+
{
|
|
96
|
+
test: /\.module\.css$/,
|
|
97
|
+
use: commonLoaders,
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
test: /\.module\.(scss|sass)$/,
|
|
101
|
+
use: [
|
|
102
|
+
...commonLoaders,
|
|
103
|
+
{
|
|
104
|
+
loader: require.resolve('sass-loader'),
|
|
105
|
+
options: {
|
|
106
|
+
implementation: require('sass'),
|
|
107
|
+
sassOptions: {
|
|
108
|
+
fiber: false,
|
|
109
|
+
precision: 8,
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
],
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
test: /\.module\.less$/,
|
|
117
|
+
use: [
|
|
118
|
+
...commonLoaders,
|
|
119
|
+
{
|
|
120
|
+
loader: require.resolve('less-loader'),
|
|
121
|
+
},
|
|
122
|
+
],
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
test: /\.module\.styl$/,
|
|
126
|
+
use: [
|
|
127
|
+
...commonLoaders,
|
|
128
|
+
{
|
|
129
|
+
loader: require.resolve('stylus-loader'),
|
|
130
|
+
},
|
|
131
|
+
],
|
|
132
|
+
},
|
|
133
|
+
],
|
|
134
|
+
};
|
|
135
|
+
//# sourceMappingURL=webpack-fallback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webpack-fallback.js","sourceRoot":"","sources":["../../../../../packages/react/plugins/component-testing/webpack-fallback.ts"],"names":[],"mappings":";;;AAAA,+DAAwE;AACxE,iFAAoE;AAGpE,SAAgB,sBAAsB,CAAC,EACrC,YAAY,GAAG,kBAAkB,EACjC,QAAQ,GAAG,OAAO,GAInB;IACC,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IAC1D,MAAM,MAAM,GAAkB;QAC5B,MAAM,EAAE,KAAK;QACb,OAAO,EAAE;YACP,UAAU;YACV,OAAO,EAAE;gBACP,IAAI,mDAAmB,CAAC;oBACtB,UAAU,EAAE,YAAY;oBACxB,UAAU;iBACX,CAAU;aACZ;SACF;QACD,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,KAAK;QACd,MAAM,EAAE;YACN,UAAU,EAAE,GAAG;YACf,aAAa,EAAE,kBAAkB;SAClC;QACD,MAAM,EAAE;YACN,KAAK,EAAE;gBACL;oBACE,IAAI,EAAE,kCAAkC;oBACxC,IAAI,EAAE,OAAO;oBACb,MAAM,EAAE;wBACN,gBAAgB,EAAE;4BAChB,OAAO,EAAE,KAAM,EAAE,QAAQ;yBAC1B;qBACF;iBACF;gBACD,kBAAkB;aACnB;SACF;KACF,CAAC;IAEF,IAAI,QAAQ,KAAK,KAAK,EAAE;QACtB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;Y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AE;gBACH,GAAG,aAAa;gBAChB;oBACE,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC;oBACtC,OAAO,EAAE;wBACP,cAAc,EAAE,OAAO,CAAC,MAAM,CAAC;wBAC/B,WAAW,EAAE;4BACX,KAAK,EAAE,KAAK;4BACZ,SAAS,EAAE,CAAC;yBACb;qBACF;iBACF;aACF;SACF;QACD;YACE,IAAI,EAAE,iBAAiB;YACvB,GAAG,EAAE;gBACH,GAAG,aAAa;gBAChB;oBACE,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC;iBACvC;aACF;SACF;QACD;YACE,IAAI,EAAE,iBAAiB;YACvB,GAAG,EAAE;gBACH,GAAG,aAAa;gBAChB;oBACE,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC;iBACzC;aACF;SACF;KACF;CACF,CAAC"}
|
|
@@ -25,6 +25,9 @@ function generateSpecsForComponents(tree, filePath) {
|
|
|
25
25
|
const componentDir = (0, path_1.dirname)(filePath);
|
|
26
26
|
const ext = (0, path_1.extname)(filePath);
|
|
27
27
|
const fileName = (0, path_1.basename)(filePath, ext);
|
|
28
|
+
if (tree.exists((0, devkit_1.joinPathFragments)(componentDir, `${fileName}.cy${ext}`))) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
28
31
|
const defaultExport = (0, ast_utils_1.getComponentNode)(sourceFile);
|
|
29
32
|
if (cmpNodes === null || cmpNodes === void 0 ? void 0 : cmpNodes.length) {
|
|
30
33
|
const components = cmpNodes.map((cmp) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-test.js","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/component-test/component-test.ts"],"names":[],"mappings":";;;AAAA,6EAAsF;AACtF,yCAKsB;AACtB,+BAA4D;AAC5D,iCAAiC;AACjC,qDAG+B;AAC/B,iEAAsE;AAGtE,SAAgB,sBAAsB,CACpC,IAAU,EACV,OAA4B;IAE5B,IAAA,6CAA2B,EAAC,EAAE,CAAC,CAAC;IAEhC,MAAM,aAAa,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAEtE,MAAM,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,UAAU,CACrD,aAAa,CAAC,UAAU,CACzB;QACC,CAAC,CAAC,IAAA,eAAQ,EAAC,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,aAAa,CAAC;QAC3D,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC;IAE1B,MAAM,aAAa,GAAG,IAAA,0BAAiB,EACrC,aAAa,CAAC,UAAU,EACxB,cAAc,CACf,CAAC;IAEF,IAAI,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE;QAC9B,0BAA0B,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;KACjD;AACH,CAAC;AAtBD,wDAsBC;AAED,SAAS,0BAA0B,CAAC,IAAU,EAAE,QAAgB;IAC9D,MAAM,UAAU,GAAG,EAAE,CAAC,gBAAgB,CACpC,QAAQ,EACR,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,EAC5B,EAAE,CAAC,YAAY,CAAC,MAAM,EACtB,IAAI,CACL,CAAC;IAEF,MAAM,QAAQ,GAAG,IAAA,wCAA4B,EAAC,UAAU,CAAC,CAAC;IAC1D,MAAM,YAAY,GAAG,IAAA,cAAO,EAAC,QAAQ,CAAC,CAAC;IACvC,MAAM,GAAG,GAAG,IAAA,cAAO,EAAC,QAAQ,CAAC,CAAC;IAC9B,MAAM,QAAQ,GAAG,IAAA,eAAQ,EAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"component-test.js","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/component-test/component-test.ts"],"names":[],"mappings":";;;AAAA,6EAAsF;AACtF,yCAKsB;AACtB,+BAA4D;AAC5D,iCAAiC;AACjC,qDAG+B;AAC/B,iEAAsE;AAGtE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A,0BAAiB,EAAC,SAAS,EAAE,OAAO,CAAC,EAAE,YAAY,EAAE;YACvE,QAAQ;YACR,UAAU;YACV,eAAe,EAAE,aAAa;gBAC5B,CAAC,CAAC,UACG,aAAqB,CAAC,IAAI,CAAC,IAC9B,GAAG,oBAAoB,YAAY,QAAQ,GAAG;gBAChD,CAAC,CAAC,YAAY,YAAY,cAAc,QAAQ,GAAG;YACrD,GAAG;SACJ,CAAC,CAAC;KACJ;AACH,CAAC;AAED,kBAAe,sBAAsB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Tree } from '@nrwl/devkit';
|
|
2
|
-
import { CypressComponentConfigurationSchema } from './schema';
|
|
2
|
+
import { CypressComponentConfigurationSchema } from './schema.d';
|
|
3
3
|
/**
|
|
4
4
|
* This is for using cypresses own Component testing, if you want to use test
|
|
5
5
|
* storybook components then use componentCypressGenerator instead.
|
|
@@ -4,11 +4,8 @@ exports.cypressComponentConfigGenerator = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const cypress_1 = require("@nrwl/cypress");
|
|
6
6
|
const devkit_1 = require("@nrwl/devkit");
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const component_test_1 = require("../component-test/component-test");
|
|
10
|
-
const allowedFileExt = new RegExp(/\.[jt]sx?/g);
|
|
11
|
-
const isSpecFile = new RegExp(/(spec|test)\./g);
|
|
7
|
+
const add_files_1 = require("./lib/add-files");
|
|
8
|
+
const update_configs_1 = require("./lib/update-configs");
|
|
12
9
|
/**
|
|
13
10
|
* This is for using cypresses own Component testing, if you want to use test
|
|
14
11
|
* storybook components then use componentCypressGenerator instead.
|
|
@@ -21,8 +18,9 @@ function cypressComponentConfigGenerator(tree, options) {
|
|
|
21
18
|
project: options.project,
|
|
22
19
|
skipFormat: true,
|
|
23
20
|
});
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
yield (0, update_configs_1.updateProjectConfig)(tree, options);
|
|
22
|
+
(0, add_files_1.addFiles)(tree, projectConfig, options);
|
|
23
|
+
(0, update_configs_1.updateTsConfig)(tree, projectConfig);
|
|
26
24
|
if (options.skipFormat) {
|
|
27
25
|
yield (0, devkit_1.formatFiles)(tree);
|
|
28
26
|
}
|
|
@@ -32,77 +30,5 @@ function cypressComponentConfigGenerator(tree, options) {
|
|
|
32
30
|
});
|
|
33
31
|
}
|
|
34
32
|
exports.cypressComponentConfigGenerator = cypressComponentConfigGenerator;
|
|
35
|
-
function addFiles(tree, projectConfig, options) {
|
|
36
|
-
const cypressConfigPath = (0, devkit_1.joinPathFragments)(projectConfig.root, 'cypress.config.ts');
|
|
37
|
-
if (tree.exists(cypressConfigPath)) {
|
|
38
|
-
tree.delete(cypressConfigPath);
|
|
39
|
-
}
|
|
40
|
-
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files'), projectConfig.root, {
|
|
41
|
-
tpl: '',
|
|
42
|
-
});
|
|
43
|
-
if (options.generateTests) {
|
|
44
|
-
(0, devkit_1.visitNotIgnoredFiles)(tree, projectConfig.sourceRoot, (filePath) => {
|
|
45
|
-
if (isComponent(tree, filePath)) {
|
|
46
|
-
(0, component_test_1.default)(tree, {
|
|
47
|
-
project: options.project,
|
|
48
|
-
componentPath: filePath,
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
function updateTsConfig(tree, projectConfig) {
|
|
55
|
-
const tsConfigPath = (0, devkit_1.joinPathFragments)(projectConfig.root, projectConfig.projectType === 'library'
|
|
56
|
-
? 'tsconfig.lib.json'
|
|
57
|
-
: 'tsconfig.app.json');
|
|
58
|
-
if (tree.exists(tsConfigPath)) {
|
|
59
|
-
(0, devkit_1.updateJson)(tree, tsConfigPath, (json) => {
|
|
60
|
-
const excluded = new Set([
|
|
61
|
-
...(json.exclude || []),
|
|
62
|
-
'cypress/**/*',
|
|
63
|
-
'cypress.config.ts',
|
|
64
|
-
'**/*.cy.ts',
|
|
65
|
-
'**/*.cy.js',
|
|
66
|
-
'**/*.cy.tsx',
|
|
67
|
-
'**/*.cy.jsx',
|
|
68
|
-
]);
|
|
69
|
-
json.exclude = Array.from(excluded);
|
|
70
|
-
return json;
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
const projectBaseTsConfig = (0, devkit_1.joinPathFragments)(projectConfig.root, 'tsconfig.json');
|
|
74
|
-
if (tree.exists(projectBaseTsConfig)) {
|
|
75
|
-
(0, devkit_1.updateJson)(tree, projectBaseTsConfig, (json) => {
|
|
76
|
-
if (json.references) {
|
|
77
|
-
const hasCyTsConfig = json.references.some((r) => r.path === './tsconfig.cy.json');
|
|
78
|
-
if (!hasCyTsConfig) {
|
|
79
|
-
json.references.push({ path: './tsconfig.cy.json' });
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
const excluded = new Set([
|
|
84
|
-
...(json.exclude || []),
|
|
85
|
-
'cypress/**/*',
|
|
86
|
-
'cypress.config.ts',
|
|
87
|
-
'**/*.cy.ts',
|
|
88
|
-
'**/*.cy.js',
|
|
89
|
-
'**/*.cy.tsx',
|
|
90
|
-
'**/*.cy.jsx',
|
|
91
|
-
]);
|
|
92
|
-
json.exclude = Array.from(excluded);
|
|
93
|
-
}
|
|
94
|
-
return json;
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
function isComponent(tree, filePath) {
|
|
99
|
-
if (isSpecFile.test(filePath) || !allowedFileExt.test(filePath)) {
|
|
100
|
-
return false;
|
|
101
|
-
}
|
|
102
|
-
const content = tree.read(filePath, 'utf-8');
|
|
103
|
-
const sourceFile = ts.createSourceFile(filePath, content, ts.ScriptTarget.Latest, true);
|
|
104
|
-
const cmpDeclaration = (0, ast_utils_1.getComponentNode)(sourceFile);
|
|
105
|
-
return !!cmpDeclaration;
|
|
106
|
-
}
|
|
107
33
|
exports.default = cypressComponentConfigGenerator;
|
|
108
34
|
//# sourceMappingURL=cypress-component-configuration.js.map
|
package/src/generators/cypress-component-configuration/cypress-component-configuration.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cypress-component-configuration.js","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/cypress-component-configuration/cypress-component-configuration.ts"],"names":[],"mappings":";;;;AAAA,2CAAwD;AACxD,
|
|
1
|
+
{"version":3,"file":"cypress-component-configuration.js","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/cypress-component-configuration/cypress-component-configuration.ts"],"names":[],"mappings":";;;;AAAA,2CAAwD;AACxD,yCAA2E;AAC3E,+CAA2C;AAC3C,yDAA2E;AAG3E;;;;GAIG;AACH,SAAsB,+BAA+B,CACnD,IAAU,EACV,OAA4C;;QAE5C,MAAM,aAAa,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QACtE,MAAM,WAAW,GAAG,MAAM,IAAA,iCAAuB,EAAC,IAAI,EAAE;YACtD,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,UAAU,EAAE,IAAI;SACjB,CAAC,CAAC;QAEH,MAAM,IAAA,oCAAmB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACzC,IAAA,oBAAQ,EAAC,IAAI,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC;QACvC,IAAA,+BAAc,EAAC,IAAI,EAAE,aAAa,CAAC,CAAC;QACpC,IAAI,OAAO,CAAC,UAAU,EAAE;YACtB,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;SACzB;QAED,OAAO,GAAG,EAAE;YACV,WAAW,EAAE,CAAC;QAChB,CAAC,CAAC;IACJ,CAAC;CAAA;AApBD,0EAoBC;AAED,kBAAe,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addFiles = void 0;
|
|
4
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
5
|
+
const ts = require("typescript");
|
|
6
|
+
const ast_utils_1 = require("../../../utils/ast-utils");
|
|
7
|
+
const component_test_1 = require("../../component-test/component-test");
|
|
8
|
+
const allowedFileExt = new RegExp(/\.[jt]sx?/g);
|
|
9
|
+
const isSpecFile = new RegExp(/(spec|test)\./g);
|
|
10
|
+
function addFiles(tree, projectConfig, options) {
|
|
11
|
+
const cypressConfigPath = (0, devkit_1.joinPathFragments)(projectConfig.root, 'cypress.config.ts');
|
|
12
|
+
if (tree.exists(cypressConfigPath)) {
|
|
13
|
+
tree.delete(cypressConfigPath);
|
|
14
|
+
}
|
|
15
|
+
(0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, '..', 'files'), projectConfig.root, {
|
|
16
|
+
tpl: '',
|
|
17
|
+
});
|
|
18
|
+
if (options.generateTests) {
|
|
19
|
+
(0, devkit_1.visitNotIgnoredFiles)(tree, projectConfig.sourceRoot, (filePath) => {
|
|
20
|
+
if (isComponent(tree, filePath)) {
|
|
21
|
+
(0, component_test_1.componentTestGenerator)(tree, {
|
|
22
|
+
project: options.project,
|
|
23
|
+
componentPath: filePath,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.addFiles = addFiles;
|
|
30
|
+
function isComponent(tree, filePath) {
|
|
31
|
+
if (isSpecFile.test(filePath) || !allowedFileExt.test(filePath)) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
const content = tree.read(filePath, 'utf-8');
|
|
35
|
+
const sourceFile = ts.createSourceFile(filePath, content, ts.ScriptTarget.Latest, true);
|
|
36
|
+
const cmpDeclaration = (0, ast_utils_1.getComponentNode)(sourceFile);
|
|
37
|
+
return !!cmpDeclaration;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=add-files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-files.js","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/cypress-component-configuration/lib/add-files.ts"],"names":[],"mappings":";;;AAAA,yCAMsB;AACtB,iCAAiC;AACjC,wDAA4D;AAC5D,wEAA6E;AAG7E,MAAM,cAAc,GAAG,IAAI,MAAM,CAAC,YAAY,CAAC,CAAC;AAChD,MAAM,UAAU,GAAG,IAAI,MAAM,CAAC,gBAAgB,CAAC,CAAC;AAEhD,SAAgB,QAAQ,CACtB,IAAU,EACV,aAAmC,EACnC,OAA4C;IAE5C,MAAM,iBAAiB,GAAG,IAAA,0BAAiB,EACzC,aAAa,CAAC,IAAI,EAClB,mBAAmB,CACpB,CAAC;IACF,IAAI,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,EAAE;QAClC,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC;KAChC;IAED,IAAA,sBAAa,EACX,IAAI,EACJ,IAAA,0BAAiB,EAAC,SAAS,EAAE,IAAI,EAAE,OAAO,CAAC,EAC3C,aAAa,CAAC,IAAI,EAClB;QACE,GAAG,EAAE,EAAE;KACR,CACF,CAAC;IAEF,IAAI,OAAO,CAAC,aAAa,EAAE;QACzB,IAAA,6BAAoB,EAAC,IAAI,EAAE,aAAa,CAAC,UAAU,EAAE,CAAC,QAAQ,EAAE,EAAE;YAChE,IAAI,WAAW,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE;gBAC/B,IAAA,uCAAsB,EAAC,IAAI,EAAE;oBAC3B,OAAO,EAAE,OAAO,CAAC,OAAO;oBACxB,aAAa,EAAE,QAAQ;iBACxB,CAAC,CAAC;aACJ;QACH,CAAC,CAAC,CAAC;KACJ;AACH,CAAC;AAhCD,4BAgCC;AAED,SAAS,WAAW,CAAC,IAAU,EAAE,QAAgB;IAC/C,IAAI,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE;QAC/D,OAAO,KAAK,CAAC;KACd;IAED,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC7C,MAAM,UAAU,GAAG,EAAE,CAAC,gBAAgB,CACpC,QAAQ,EACR,OAAO,EACP,EAAE,CAAC,YAAY,CAAC,MAAM,EACtB,IAAI,CACL,CAAC;IAEF,MAAM,cAAc,GAAG,IAAA,4BAAgB,EAAC,UAAU,CAAC,CAAC;IACpD,OAAO,CAAC,CAAC,cAAc,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ProjectConfiguration, Tree } from '@nrwl/devkit';
|
|
2
|
+
import { CypressComponentConfigurationSchema } from '../schema';
|
|
3
|
+
export declare function updateTsConfig(tree: Tree, projectConfig: ProjectConfiguration): void;
|
|
4
|
+
export declare function updateProjectConfig(tree: Tree, options: CypressComponentConfigurationSchema): Promise<void>;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateProjectConfig = exports.updateTsConfig = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const find_target_options_1 = require("@nrwl/cypress/src/utils/find-target-options");
|
|
6
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
7
|
+
function updateTsConfig(tree, projectConfig) {
|
|
8
|
+
const tsConfigPath = (0, devkit_1.joinPathFragments)(projectConfig.root, projectConfig.projectType === 'library'
|
|
9
|
+
? 'tsconfig.lib.json'
|
|
10
|
+
: 'tsconfig.app.json');
|
|
11
|
+
if (tree.exists(tsConfigPath)) {
|
|
12
|
+
(0, devkit_1.updateJson)(tree, tsConfigPath, (json) => {
|
|
13
|
+
const excluded = new Set([
|
|
14
|
+
...(json.exclude || []),
|
|
15
|
+
'cypress/**/*',
|
|
16
|
+
'cypress.config.ts',
|
|
17
|
+
'**/*.cy.ts',
|
|
18
|
+
'**/*.cy.js',
|
|
19
|
+
'**/*.cy.tsx',
|
|
20
|
+
'**/*.cy.jsx',
|
|
21
|
+
]);
|
|
22
|
+
json.exclude = Array.from(excluded);
|
|
23
|
+
return json;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
const projectBaseTsConfig = (0, devkit_1.joinPathFragments)(projectConfig.root, 'tsconfig.json');
|
|
27
|
+
if (tree.exists(projectBaseTsConfig)) {
|
|
28
|
+
(0, devkit_1.updateJson)(tree, projectBaseTsConfig, (json) => {
|
|
29
|
+
if (json.references) {
|
|
30
|
+
const hasCyTsConfig = json.references.some((r) => r.path === './tsconfig.cy.json');
|
|
31
|
+
if (!hasCyTsConfig) {
|
|
32
|
+
json.references.push({ path: './tsconfig.cy.json' });
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
const excluded = new Set([
|
|
37
|
+
...(json.exclude || []),
|
|
38
|
+
'cypress/**/*',
|
|
39
|
+
'cypress.config.ts',
|
|
40
|
+
'**/*.cy.ts',
|
|
41
|
+
'**/*.cy.js',
|
|
42
|
+
'**/*.cy.tsx',
|
|
43
|
+
'**/*.cy.jsx',
|
|
44
|
+
]);
|
|
45
|
+
json.exclude = Array.from(excluded);
|
|
46
|
+
}
|
|
47
|
+
return json;
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
exports.updateTsConfig = updateTsConfig;
|
|
52
|
+
function updateProjectConfig(tree, options) {
|
|
53
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
54
|
+
const found = yield (0, find_target_options_1.findBuildConfig)(tree, {
|
|
55
|
+
project: options.project,
|
|
56
|
+
buildTarget: options.buildTarget,
|
|
57
|
+
validExecutorNames: new Set(['@nrwl/web:webpack']),
|
|
58
|
+
});
|
|
59
|
+
assetValidConfig(found.config);
|
|
60
|
+
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
61
|
+
projectConfig.targets['component-test'].options = Object.assign(Object.assign({}, projectConfig.targets['component-test'].options), { devServerTarget: found.target, skipServe: true });
|
|
62
|
+
(0, devkit_1.updateProjectConfiguration)(tree, options.project, projectConfig);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
exports.updateProjectConfig = updateProjectConfig;
|
|
66
|
+
function assetValidConfig(config) {
|
|
67
|
+
if (!config) {
|
|
68
|
+
throw new Error('Unable to find a valid build configuration. Try passing in a target for a React app. --build-target=<project>:<target>[:<configuration>]');
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
//# sourceMappingURL=update-configs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-configs.js","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/cypress-component-configuration/lib/update-configs.ts"],"names":[],"mappings":";;;;AAAA,qFAA8E;AAC9E,yCAOsB;AAGtB,SAAgB,cAAc,CAC5B,IAAU,EACV,aAAmC;IAEnC,MAAM,YAAY,GAAG,IAAA,0BAAiB,EACpC,aAAa,CAAC,IAAI,EAClB,aAAa,CAAC,WAAW,KAAK,SAAS;QACrC,CAAC,CAAC,mBAAmB;QACrB,CAAC,CAAC,mBAAmB,CACxB,CAAC;IACF,IAAI,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE;QAC7B,IAAA,mBAAU,EAAC,IAAI,EAAE,YAAY,EAAE,CAAC,IAAI,EAAE,EAAE;YACtC,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC;gBACvB,GAAG,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC;gBACvB,cAAc;gBACd,mBAAmB;gBACnB,YAAY;gBACZ,YAAY;gBACZ,aAAa;gBACb,aAAa;aACd,CAAC,CAAC;YAEH,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YACpC,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;KACJ;IAED,MAAM,mBAAmB,GAAG,IAAA,0BAAiB,EAC3C,aAAa,CAAC,IAAI,EAClB,eA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,OAAO,CAAC,gBAAgB,CAAC,CAAC,OAAO,mCAC1C,aAAa,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,OAAO,KAClD,eAAe,EAAE,KAAK,CAAC,MAAM,EAC7B,SAAS,EAAE,IAAI,GAChB,CAAC;QACF,IAAA,mCAA0B,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;IACnE,CAAC;CAAA;AAnBD,kDAmBC;AAED,SAAS,gBAAgB,CAAC,MAAe;IACvC,IAAI,CAAC,MAAM,EAAE;QACX,MAAM,IAAI,KAAK,CACb,0IAA0I,CAC3I,CAAC;KACH;AACH,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
3
|
"cli": "nx",
|
|
4
4
|
"$id": "NxReactCypressComponentTestConfiguration",
|
|
5
5
|
"title": "Add Cypress component testing",
|
|
@@ -24,6 +24,11 @@
|
|
|
24
24
|
},
|
|
25
25
|
"x-prompt": "What project should we add Cypress component testing to?"
|
|
26
26
|
},
|
|
27
|
+
"buildTarget": {
|
|
28
|
+
"type": "string",
|
|
29
|
+
"description": "A build target used to configure Cypress component testing in the format of `project:target[:configuration]`. The build target should be from a React app. If not provided we will try to infer it from your projects usage.",
|
|
30
|
+
"pattern": "^[^:\\s]+:[^:\\s]+(:\\S+)?$"
|
|
31
|
+
},
|
|
27
32
|
"generateTests": {
|
|
28
33
|
"type": "boolean",
|
|
29
34
|
"description": "Generate default component tests for existing components in the project",
|
package/src/utils/versions.d.ts
CHANGED
|
@@ -2,14 +2,14 @@ export declare const nxVersion: any;
|
|
|
2
2
|
export declare const reactVersion = "18.2.0";
|
|
3
3
|
export declare const reactDomVersion = "18.2.0";
|
|
4
4
|
export declare const reactIsVersion = "18.2.0";
|
|
5
|
-
export declare const typesReactVersion = "18.0.
|
|
5
|
+
export declare const typesReactVersion = "18.0.18";
|
|
6
6
|
export declare const typesReactDomVersion = "18.0.6";
|
|
7
7
|
export declare const typesReactIsVersion = "17.0.3";
|
|
8
|
-
export declare const typesNodeVersion = "18.7.
|
|
8
|
+
export declare const typesNodeVersion = "18.7.14";
|
|
9
9
|
export declare const styledComponentsVersion = "5.3.5";
|
|
10
10
|
export declare const typesStyledComponentsVersion = "5.1.26";
|
|
11
|
-
export declare const emotionStyledVersion = "11.10.
|
|
12
|
-
export declare const emotionReactVersion = "11.10.
|
|
11
|
+
export declare const emotionStyledVersion = "11.10.4";
|
|
12
|
+
export declare const emotionReactVersion = "11.10.4";
|
|
13
13
|
export declare const emotionBabelPlugin = "11.10.2";
|
|
14
14
|
export declare const styledJsxVersion = "5.0.4";
|
|
15
15
|
export declare const reactRouterDomVersion = "6.3.0";
|
|
@@ -20,7 +20,7 @@ export declare const reactReduxVersion = "8.0.2";
|
|
|
20
20
|
export declare const reactTestRendererVersion = "18.2.0";
|
|
21
21
|
export declare const eslintPluginImportVersion = "2.26.0";
|
|
22
22
|
export declare const eslintPluginJsxA11yVersion = "6.6.1";
|
|
23
|
-
export declare const eslintPluginReactVersion = "7.
|
|
23
|
+
export declare const eslintPluginReactVersion = "7.31.1";
|
|
24
24
|
export declare const eslintPluginReactHooksVersion = "4.6.0";
|
|
25
25
|
export declare const babelPluginStyledComponentsVersion = "1.10.7";
|
|
26
26
|
export declare const tsLibVersion = "^2.3.0";
|
package/src/utils/versions.js
CHANGED
|
@@ -5,14 +5,14 @@ exports.nxVersion = require('../../package.json').version;
|
|
|
5
5
|
exports.reactVersion = '18.2.0';
|
|
6
6
|
exports.reactDomVersion = '18.2.0';
|
|
7
7
|
exports.reactIsVersion = '18.2.0';
|
|
8
|
-
exports.typesReactVersion = '18.0.
|
|
8
|
+
exports.typesReactVersion = '18.0.18';
|
|
9
9
|
exports.typesReactDomVersion = '18.0.6';
|
|
10
10
|
exports.typesReactIsVersion = '17.0.3';
|
|
11
|
-
exports.typesNodeVersion = '18.7.
|
|
11
|
+
exports.typesNodeVersion = '18.7.14';
|
|
12
12
|
exports.styledComponentsVersion = '5.3.5';
|
|
13
13
|
exports.typesStyledComponentsVersion = '5.1.26';
|
|
14
|
-
exports.emotionStyledVersion = '11.10.
|
|
15
|
-
exports.emotionReactVersion = '11.10.
|
|
14
|
+
exports.emotionStyledVersion = '11.10.4';
|
|
15
|
+
exports.emotionReactVersion = '11.10.4';
|
|
16
16
|
exports.emotionBabelPlugin = '11.10.2';
|
|
17
17
|
// WARNING: This needs to be in sync with Next.js' dependency or else there might be issues.
|
|
18
18
|
exports.styledJsxVersion = '5.0.4';
|
|
@@ -24,7 +24,7 @@ exports.reactReduxVersion = '8.0.2';
|
|
|
24
24
|
exports.reactTestRendererVersion = '18.2.0';
|
|
25
25
|
exports.eslintPluginImportVersion = '2.26.0';
|
|
26
26
|
exports.eslintPluginJsxA11yVersion = '6.6.1';
|
|
27
|
-
exports.eslintPluginReactVersion = '7.
|
|
27
|
+
exports.eslintPluginReactVersion = '7.31.1';
|
|
28
28
|
exports.eslintPluginReactHooksVersion = '4.6.0';
|
|
29
29
|
exports.babelPluginStyledComponentsVersion = '1.10.7';
|
|
30
30
|
exports.tsLibVersion = '^2.3.0';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"versions.js","sourceRoot":"","sources":["../../../../../packages/react/src/utils/versions.ts"],"names":[],"mappings":";;;AAAa,QAAA,SAAS,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC,OAAO,CAAC;AAElD,QAAA,YAAY,GAAG,QAAQ,CAAC;AACxB,QAAA,eAAe,GAAG,QAAQ,CAAC;AAC3B,QAAA,cAAc,GAAG,QAAQ,CAAC;AAC1B,QAAA,iBAAiB,GAAG,SAAS,CAAC;AAC9B,QAAA,oBAAoB,GAAG,QAAQ,CAAC;AAChC,QAAA,mBAAmB,GAAG,QAAQ,CAAC;AAE/B,QAAA,gBAAgB,GAAG,
|
|
1
|
+
{"version":3,"file":"versions.js","sourceRoot":"","sources":["../../../../../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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/cypress-component-configuration/schema.ts"],"names":[],"mappings":""}
|