@nx/playwright 19.6.0-canary.20240813-c72ba9b → 19.6.0-canary.20240815-5410794
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/playwright",
|
|
3
|
-
"version": "19.6.0-canary.
|
|
3
|
+
"version": "19.6.0-canary.20240815-5410794",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"homepage": "https://nx.dev",
|
|
6
6
|
"private": false,
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
38
|
-
"@nx/devkit": "19.6.0-canary.
|
|
39
|
-
"@nx/eslint": "19.6.0-canary.
|
|
40
|
-
"@nx/webpack": "19.6.0-canary.
|
|
41
|
-
"@nx/vite": "19.6.0-canary.
|
|
42
|
-
"@nx/js": "19.6.0-canary.
|
|
38
|
+
"@nx/devkit": "19.6.0-canary.20240815-5410794",
|
|
39
|
+
"@nx/eslint": "19.6.0-canary.20240815-5410794",
|
|
40
|
+
"@nx/webpack": "19.6.0-canary.20240815-5410794",
|
|
41
|
+
"@nx/vite": "19.6.0-canary.20240815-5410794",
|
|
42
|
+
"@nx/js": "19.6.0-canary.20240815-5410794",
|
|
43
43
|
"tslib": "^2.3.0",
|
|
44
44
|
"minimatch": "9.0.3"
|
|
45
45
|
},
|
|
@@ -66,5 +66,6 @@
|
|
|
66
66
|
},
|
|
67
67
|
"nx-migrations": {
|
|
68
68
|
"migrations": "./migrations.json"
|
|
69
|
-
}
|
|
69
|
+
},
|
|
70
|
+
"types": "./index.d.ts"
|
|
70
71
|
}
|
|
@@ -58,17 +58,21 @@ async function default_1(tree) {
|
|
|
58
58
|
(0, devkit_1.joinPathFragments)(graph.nodes[project].data.root, 'webpack.config.ts'),
|
|
59
59
|
(0, devkit_1.joinPathFragments)(graph.nodes[project].data.root, 'webpack.config.js'),
|
|
60
60
|
].find((p) => tree.exists(p));
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
61
|
+
const configFile = pathToWebpackConfig ?? pathToViteConfig;
|
|
62
|
+
// Only migrate projects that have a webpack or vite config file
|
|
63
|
+
if (configFile) {
|
|
64
|
+
collectedProjects.push({
|
|
65
|
+
projectName: project,
|
|
66
|
+
configFile,
|
|
67
|
+
configFileType: pathToWebpackConfig ? 'webpack' : 'vite',
|
|
68
|
+
playwrightConfigFile: path,
|
|
69
|
+
commandValueNode,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
68
72
|
});
|
|
69
73
|
for (const projectToMigrate of collectedProjects) {
|
|
70
74
|
let playwrightConfigFileContents = tree.read(projectToMigrate.playwrightConfigFile, 'utf-8');
|
|
71
|
-
const targetName = await getServeStaticTargetNameForConfigFile(tree, projectToMigrate.configFileType === 'webpack'
|
|
75
|
+
const targetName = (await getServeStaticTargetNameForConfigFile(tree, projectToMigrate.configFileType === 'webpack'
|
|
72
76
|
? '@nx/webpack/plugin'
|
|
73
77
|
: '@nx/vite/plugin', projectToMigrate.configFile, projectToMigrate.configFileType === 'webpack'
|
|
74
78
|
? 'serve-static'
|
|
@@ -76,7 +80,13 @@ async function default_1(tree) {
|
|
|
76
80
|
? 'serveStaticTargetName'
|
|
77
81
|
: 'previewTargetName', projectToMigrate.configFileType === 'webpack'
|
|
78
82
|
? plugin_1.createNodesV2
|
|
79
|
-
: plugin_2.createNodesV2)
|
|
83
|
+
: plugin_2.createNodesV2)) ??
|
|
84
|
+
getServeStaticLikeTarget(tree, graph, projectToMigrate.projectName, projectToMigrate.configFileType === 'webpack'
|
|
85
|
+
? '@nx/web:file-server'
|
|
86
|
+
: '@nx/vite:preview-server');
|
|
87
|
+
if (!targetName) {
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
80
90
|
const oldCommand = projectToMigrate.commandValueNode.getText();
|
|
81
91
|
const newCommand = oldCommand.replace(/nx.*[^"']/, `nx run ${projectToMigrate.projectName}:${targetName}`);
|
|
82
92
|
if (projectToMigrate.configFileType === 'webpack') {
|
|
@@ -117,9 +127,9 @@ async function getServeStaticTargetNameForConfigFile(tree, pluginName, configFil
|
|
|
117
127
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
118
128
|
const matchingPluginRegistrations = nxJson.plugins?.filter((p) => typeof p === 'string' ? p === pluginName : p.plugin === pluginName);
|
|
119
129
|
if (!matchingPluginRegistrations) {
|
|
120
|
-
return
|
|
130
|
+
return undefined;
|
|
121
131
|
}
|
|
122
|
-
let targetName =
|
|
132
|
+
let targetName = undefined;
|
|
123
133
|
for (const plugin of matchingPluginRegistrations) {
|
|
124
134
|
let projectConfigs;
|
|
125
135
|
try {
|
|
@@ -144,3 +154,13 @@ async function getServeStaticTargetNameForConfigFile(tree, pluginName, configFil
|
|
|
144
154
|
}
|
|
145
155
|
return targetName;
|
|
146
156
|
}
|
|
157
|
+
function getServeStaticLikeTarget(tree, graph, projectName, executorName) {
|
|
158
|
+
if (!graph.nodes[projectName]?.data?.targets) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
for (const [targetName, targetOptions] of Object.entries(graph.nodes[projectName].data.targets)) {
|
|
162
|
+
if (targetOptions.executor && targetOptions.executor === executorName) {
|
|
163
|
+
return targetName;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|