@nx/playwright 0.0.0-pr-22179-271588f → 0.0.0-pr-26482-ebe2dba
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/LICENSE +1 -1
- package/generators.json +5 -0
- package/package.json +7 -5
- package/plugin.d.ts +1 -1
- package/plugin.js +2 -2
- package/src/executors/playwright/playwright.impl.d.ts +1 -1
- package/src/executors/playwright/schema.json +1 -1
- package/src/generators/convert-to-inferred/convert-to-inferred.d.ts +8 -0
- package/src/generators/convert-to-inferred/convert-to-inferred.js +31 -0
- package/src/generators/convert-to-inferred/schema.json +19 -0
- package/src/generators/init/init.js +2 -20
- package/src/plugins/plugin.d.ts +6 -2
- package/src/plugins/plugin.js +87 -49
- package/src/utils/add-linter.js +2 -1
package/LICENSE
CHANGED
package/generators.json
CHANGED
|
@@ -11,6 +11,11 @@
|
|
|
11
11
|
"factory": "./src/generators/init/init#initGeneratorInternal",
|
|
12
12
|
"schema": "./src/generators/init/schema.json",
|
|
13
13
|
"description": "Initializes a Playwright project in the current workspace"
|
|
14
|
+
},
|
|
15
|
+
"convert-to-inferred": {
|
|
16
|
+
"factory": "./src/generators/convert-to-inferred/convert-to-inferred",
|
|
17
|
+
"schema": "./src/generators/convert-to-inferred/schema.json",
|
|
18
|
+
"description": "Convert existing Playwright project(s) using `@nx/playwright:playwright` executor to use `@nx/playwright/plugin`."
|
|
14
19
|
}
|
|
15
20
|
}
|
|
16
21
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/playwright",
|
|
3
|
-
"version": "0.0.0-pr-
|
|
3
|
+
"version": "0.0.0-pr-26482-ebe2dba",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"homepage": "https://nx.dev",
|
|
6
6
|
"private": false,
|
|
@@ -17,7 +17,9 @@
|
|
|
17
17
|
"Nest",
|
|
18
18
|
"Jest",
|
|
19
19
|
"Playwright",
|
|
20
|
-
"CLI"
|
|
20
|
+
"CLI",
|
|
21
|
+
"Testing",
|
|
22
|
+
"Front-end"
|
|
21
23
|
],
|
|
22
24
|
"main": "./index.js",
|
|
23
25
|
"typings": "./index.d.ts",
|
|
@@ -33,9 +35,9 @@
|
|
|
33
35
|
},
|
|
34
36
|
"dependencies": {
|
|
35
37
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
36
|
-
"@nx/devkit": "0.0.0-pr-
|
|
37
|
-
"@nx/eslint": "0.0.0-pr-
|
|
38
|
-
"@nx/js": "0.0.0-pr-
|
|
38
|
+
"@nx/devkit": "0.0.0-pr-26482-ebe2dba",
|
|
39
|
+
"@nx/eslint": "0.0.0-pr-26482-ebe2dba",
|
|
40
|
+
"@nx/js": "0.0.0-pr-26482-ebe2dba",
|
|
39
41
|
"tslib": "^2.3.0",
|
|
40
42
|
"minimatch": "9.0.3"
|
|
41
43
|
},
|
package/plugin.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { createNodes,
|
|
1
|
+
export { createNodes, createNodesV2, PlaywrightPluginOptions, } from './src/plugins/plugin';
|
package/plugin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.createNodesV2 = exports.createNodes = void 0;
|
|
4
4
|
var plugin_1 = require("./src/plugins/plugin");
|
|
5
5
|
Object.defineProperty(exports, "createNodes", { enumerable: true, get: function () { return plugin_1.createNodes; } });
|
|
6
|
-
Object.defineProperty(exports, "
|
|
6
|
+
Object.defineProperty(exports, "createNodesV2", { enumerable: true, get: function () { return plugin_1.createNodesV2; } });
|
|
@@ -28,7 +28,7 @@ export interface PlaywrightExecutorSchema {
|
|
|
28
28
|
updateSnapshots?: boolean;
|
|
29
29
|
ui?: boolean;
|
|
30
30
|
uiHost?: string;
|
|
31
|
-
uiPort?:
|
|
31
|
+
uiPort?: number;
|
|
32
32
|
skipInstall?: boolean;
|
|
33
33
|
}
|
|
34
34
|
export declare function playwrightExecutor(options: PlaywrightExecutorSchema, context: ExecutorContext): Promise<{
|
|
@@ -155,7 +155,7 @@
|
|
|
155
155
|
"description": "Host to serve UI on; specifying this option opens UI in a browser tab"
|
|
156
156
|
},
|
|
157
157
|
"uiPort": {
|
|
158
|
-
"type": "
|
|
158
|
+
"type": "number",
|
|
159
159
|
"description": "Port to serve UI on, 0 for any free port; specifying this option opens UI in a browser tab"
|
|
160
160
|
},
|
|
161
161
|
"skipInstall": {
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertToInferred = void 0;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const plugin_1 = require("../../plugins/plugin");
|
|
6
|
+
const executor_to_plugin_migrator_1 = require("@nx/devkit/src/generators/plugin-migrations/executor-to-plugin-migrator");
|
|
7
|
+
async function convertToInferred(tree, options) {
|
|
8
|
+
const projectGraph = await (0, devkit_1.createProjectGraphAsync)();
|
|
9
|
+
const migratedProjects = await (0, executor_to_plugin_migrator_1.migrateExecutorToPlugin)(tree, projectGraph, '@nx/playwright:playwright', '@nx/playwright/plugin', (targetName) => ({ targetName, ciTargetName: 'e2e-ci' }), postTargetTransformer, plugin_1.createNodesV2, options.project);
|
|
10
|
+
if (migratedProjects.size === 0) {
|
|
11
|
+
throw new Error('Could not find any targets to migrate.');
|
|
12
|
+
}
|
|
13
|
+
if (!options.skipFormat) {
|
|
14
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.convertToInferred = convertToInferred;
|
|
18
|
+
function postTargetTransformer(target) {
|
|
19
|
+
if (target.options) {
|
|
20
|
+
if (target.options?.config) {
|
|
21
|
+
delete target.options.config;
|
|
22
|
+
}
|
|
23
|
+
for (const [key, value] of Object.entries(target.options)) {
|
|
24
|
+
const newKeyName = (0, devkit_1.names)(key).fileName;
|
|
25
|
+
delete target.options[key];
|
|
26
|
+
target.options[newKeyName] = value;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return target;
|
|
30
|
+
}
|
|
31
|
+
exports.default = convertToInferred;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/schema",
|
|
3
|
+
"$id": "NxPlaywrightConvertToInferred",
|
|
4
|
+
"description": "Convert existing Playwright project(s) using `@nx/playwright:playwright` executor to use `@nx/playwright/plugin`. Defaults to migrating all projects. Pass '--project' to migrate only one target.",
|
|
5
|
+
"title": "Convert Playwright project from executor to plugin",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"project": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"description": "The project to convert from using the `@nx/playwright:playwright` executor to use `@nx/playwright/plugin`.",
|
|
11
|
+
"x-priority": "important"
|
|
12
|
+
},
|
|
13
|
+
"skipFormat": {
|
|
14
|
+
"type": "boolean",
|
|
15
|
+
"description": "Whether to format files at the end of the migration.",
|
|
16
|
+
"default": false
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.initGeneratorInternal = exports.initGenerator = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const
|
|
5
|
+
const add_plugin_1 = require("@nx/devkit/src/utils/add-plugin");
|
|
6
6
|
const plugin_1 = require("../../plugins/plugin");
|
|
7
7
|
const versions_1 = require("../../utils/versions");
|
|
8
8
|
function initGenerator(tree, options) {
|
|
@@ -22,10 +22,7 @@ async function initGeneratorInternal(tree, options) {
|
|
|
22
22
|
}, undefined, options.keepExistingVersions));
|
|
23
23
|
}
|
|
24
24
|
if (options.addPlugin) {
|
|
25
|
-
addPlugin(tree);
|
|
26
|
-
}
|
|
27
|
-
if (options.updatePackageScripts) {
|
|
28
|
-
await (0, update_package_scripts_1.updatePackageScripts)(tree, plugin_1.createNodes);
|
|
25
|
+
await (0, add_plugin_1.addPlugin)(tree, await (0, devkit_1.createProjectGraphAsync)(), '@nx/playwright/plugin', plugin_1.createNodesV2, { targetName: ['e2e', 'playwright:e2e', 'playwright-e2e'] }, options.updatePackageScripts);
|
|
29
26
|
}
|
|
30
27
|
if (!options.skipFormat) {
|
|
31
28
|
await (0, devkit_1.formatFiles)(tree);
|
|
@@ -33,19 +30,4 @@ async function initGeneratorInternal(tree, options) {
|
|
|
33
30
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
34
31
|
}
|
|
35
32
|
exports.initGeneratorInternal = initGeneratorInternal;
|
|
36
|
-
function addPlugin(tree) {
|
|
37
|
-
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
38
|
-
nxJson.plugins ??= [];
|
|
39
|
-
if (!nxJson.plugins.some((p) => typeof p === 'string'
|
|
40
|
-
? p === '@nx/playwright/plugin'
|
|
41
|
-
: p.plugin === '@nx/playwright/plugin')) {
|
|
42
|
-
nxJson.plugins.push({
|
|
43
|
-
plugin: '@nx/playwright/plugin',
|
|
44
|
-
options: {
|
|
45
|
-
targetName: 'e2e',
|
|
46
|
-
},
|
|
47
|
-
});
|
|
48
|
-
(0, devkit_1.updateNxJson)(tree, nxJson);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
33
|
exports.default = initGenerator;
|
package/src/plugins/plugin.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CreateNodes, CreateNodesV2 } from '@nx/devkit';
|
|
2
2
|
export interface PlaywrightPluginOptions {
|
|
3
3
|
targetName?: string;
|
|
4
4
|
ciTargetName?: string;
|
|
5
5
|
}
|
|
6
|
-
export declare const
|
|
6
|
+
export declare const createNodesV2: CreateNodesV2<PlaywrightPluginOptions>;
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated This is replaced with {@link createNodesV2}. Update your plugin to export its own `createNodesV2` function that wraps this one instead.
|
|
9
|
+
* This function will change to the v2 function in Nx 20.
|
|
10
|
+
*/
|
|
7
11
|
export declare const createNodes: CreateNodes<PlaywrightPluginOptions>;
|
package/src/plugins/plugin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createNodes = exports.
|
|
3
|
+
exports.createNodes = exports.createNodesV2 = void 0;
|
|
4
4
|
const fs_1 = require("fs");
|
|
5
5
|
const path_1 = require("path");
|
|
6
6
|
const devkit_1 = require("@nx/devkit");
|
|
@@ -11,47 +11,61 @@ const minimatch_1 = require("minimatch");
|
|
|
11
11
|
const cache_directory_1 = require("nx/src/utils/cache-directory");
|
|
12
12
|
const js_1 = require("@nx/js");
|
|
13
13
|
const config_utils_1 = require("@nx/devkit/src/utils/config-utils");
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
function readTargetsCache() {
|
|
18
|
-
return (0, devkit_1.readJsonFile)(cachePath);
|
|
14
|
+
const file_hasher_1 = require("nx/src/hasher/file-hasher");
|
|
15
|
+
function readTargetsCache(cachePath) {
|
|
16
|
+
return (0, fs_1.existsSync)(cachePath) ? (0, devkit_1.readJsonFile)(cachePath) : {};
|
|
19
17
|
}
|
|
20
|
-
function writeTargetsToCache(
|
|
21
|
-
(0, devkit_1.writeJsonFile)(cachePath,
|
|
18
|
+
function writeTargetsToCache(cachePath, results) {
|
|
19
|
+
(0, devkit_1.writeJsonFile)(cachePath, results);
|
|
22
20
|
}
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
!siblingFiles.includes('project.json')) {
|
|
36
|
-
return {};
|
|
21
|
+
const playwrightConfigGlob = '**/playwright.config.{js,ts,cjs,cts,mjs,mts}';
|
|
22
|
+
exports.createNodesV2 = [
|
|
23
|
+
playwrightConfigGlob,
|
|
24
|
+
async (configFilePaths, options, context) => {
|
|
25
|
+
const optionsHash = (0, file_hasher_1.hashObject)(options);
|
|
26
|
+
const cachePath = (0, path_1.join)(cache_directory_1.workspaceDataDirectory, `playwright-${optionsHash}.hash`);
|
|
27
|
+
const targetsCache = readTargetsCache(cachePath);
|
|
28
|
+
try {
|
|
29
|
+
return await (0, devkit_1.createNodesFromFiles)((configFile, options, context) => createNodesInternal(configFile, options, context, targetsCache), configFilePaths, options, context);
|
|
30
|
+
}
|
|
31
|
+
finally {
|
|
32
|
+
writeTargetsToCache(cachePath, targetsCache);
|
|
37
33
|
}
|
|
38
|
-
const normalizedOptions = normalizeOptions(options);
|
|
39
|
-
const hash = (0, calculate_hash_for_create_nodes_1.calculateHashForCreateNodes)(projectRoot, options, context, [
|
|
40
|
-
(0, js_1.getLockFileName)((0, devkit_1.detectPackageManager)(context.workspaceRoot)),
|
|
41
|
-
]);
|
|
42
|
-
const targets = targetsCache[hash] ??
|
|
43
|
-
(await buildPlaywrightTargets(configFilePath, projectRoot, normalizedOptions, context));
|
|
44
|
-
calculatedTargets[hash] = targets;
|
|
45
|
-
return {
|
|
46
|
-
projects: {
|
|
47
|
-
[projectRoot]: {
|
|
48
|
-
root: projectRoot,
|
|
49
|
-
targets,
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
};
|
|
53
34
|
},
|
|
54
35
|
];
|
|
36
|
+
/**
|
|
37
|
+
* @deprecated This is replaced with {@link createNodesV2}. Update your plugin to export its own `createNodesV2` function that wraps this one instead.
|
|
38
|
+
* This function will change to the v2 function in Nx 20.
|
|
39
|
+
*/
|
|
40
|
+
exports.createNodes = [
|
|
41
|
+
playwrightConfigGlob,
|
|
42
|
+
async (configFile, options, context) => {
|
|
43
|
+
devkit_1.logger.warn('`createNodes` is deprecated. Update your plugin to utilize createNodesV2 instead. In Nx 20, this will change to the createNodesV2 API.');
|
|
44
|
+
return createNodesInternal(configFile, options, context, {});
|
|
45
|
+
},
|
|
46
|
+
];
|
|
47
|
+
async function createNodesInternal(configFilePath, options, context, targetsCache) {
|
|
48
|
+
const projectRoot = (0, path_1.dirname)(configFilePath);
|
|
49
|
+
// Do not create a project if package.json and project.json isn't there.
|
|
50
|
+
const siblingFiles = (0, fs_1.readdirSync)((0, path_1.join)(context.workspaceRoot, projectRoot));
|
|
51
|
+
if (!siblingFiles.includes('package.json') &&
|
|
52
|
+
!siblingFiles.includes('project.json')) {
|
|
53
|
+
return {};
|
|
54
|
+
}
|
|
55
|
+
const normalizedOptions = normalizeOptions(options);
|
|
56
|
+
const hash = await (0, calculate_hash_for_create_nodes_1.calculateHashForCreateNodes)(projectRoot, options, context, [(0, js_1.getLockFileName)((0, devkit_1.detectPackageManager)(context.workspaceRoot))]);
|
|
57
|
+
targetsCache[hash] ??= await buildPlaywrightTargets(configFilePath, projectRoot, normalizedOptions, context);
|
|
58
|
+
const { targets, metadata } = targetsCache[hash];
|
|
59
|
+
return {
|
|
60
|
+
projects: {
|
|
61
|
+
[projectRoot]: {
|
|
62
|
+
root: projectRoot,
|
|
63
|
+
targets,
|
|
64
|
+
metadata,
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
}
|
|
55
69
|
async function buildPlaywrightTargets(configFilePath, projectRoot, options, context) {
|
|
56
70
|
// Playwright forbids importing the `@playwright/test` module twice. This would affect running the tests,
|
|
57
71
|
// but we're just reading the config so let's delete the variable they are using to detect this.
|
|
@@ -60,41 +74,60 @@ async function buildPlaywrightTargets(configFilePath, projectRoot, options, cont
|
|
|
60
74
|
const playwrightConfig = await (0, config_utils_1.loadConfigFile)((0, path_1.join)(context.workspaceRoot, configFilePath));
|
|
61
75
|
const namedInputs = (0, get_named_inputs_1.getNamedInputs)(projectRoot, context);
|
|
62
76
|
const targets = {};
|
|
77
|
+
let metadata;
|
|
63
78
|
const baseTargetConfig = {
|
|
64
79
|
command: 'playwright test',
|
|
65
80
|
options: {
|
|
66
81
|
cwd: '{projectRoot}',
|
|
67
82
|
},
|
|
83
|
+
metadata: {
|
|
84
|
+
technologies: ['playwright'],
|
|
85
|
+
description: 'Runs Playwright Tests',
|
|
86
|
+
},
|
|
68
87
|
};
|
|
69
88
|
targets[options.targetName] = {
|
|
70
89
|
...baseTargetConfig,
|
|
71
90
|
cache: true,
|
|
72
|
-
inputs:
|
|
73
|
-
|
|
74
|
-
|
|
91
|
+
inputs: [
|
|
92
|
+
...('production' in namedInputs
|
|
93
|
+
? ['default', '^production']
|
|
94
|
+
: ['default', '^default']),
|
|
95
|
+
{ externalDependencies: ['@playwright/test'] },
|
|
96
|
+
],
|
|
75
97
|
outputs: getOutputs(projectRoot, playwrightConfig),
|
|
76
98
|
};
|
|
77
99
|
if (options.ciTargetName) {
|
|
78
100
|
const ciBaseTargetConfig = {
|
|
79
101
|
...baseTargetConfig,
|
|
80
102
|
cache: true,
|
|
81
|
-
inputs:
|
|
82
|
-
|
|
83
|
-
|
|
103
|
+
inputs: [
|
|
104
|
+
...('production' in namedInputs
|
|
105
|
+
? ['default', '^production']
|
|
106
|
+
: ['default', '^default']),
|
|
107
|
+
{ externalDependencies: ['@playwright/test'] },
|
|
108
|
+
],
|
|
84
109
|
outputs: getOutputs(projectRoot, playwrightConfig),
|
|
85
110
|
};
|
|
111
|
+
const groupName = 'E2E (CI)';
|
|
112
|
+
metadata = { targetGroups: { [groupName]: [] } };
|
|
113
|
+
const ciTargetGroup = metadata.targetGroups[groupName];
|
|
86
114
|
const testDir = playwrightConfig.testDir
|
|
87
115
|
? (0, devkit_1.joinPathFragments)(projectRoot, playwrightConfig.testDir)
|
|
88
116
|
: projectRoot;
|
|
89
117
|
// Playwright defaults to the following pattern.
|
|
90
118
|
playwrightConfig.testMatch ??= '**/*.@(spec|test).?(c|m)[jt]s?(x)';
|
|
91
119
|
const dependsOn = [];
|
|
92
|
-
forEachTestFile((testFile) => {
|
|
93
|
-
const
|
|
94
|
-
const targetName = `${options.ciTargetName}--${
|
|
120
|
+
await forEachTestFile((testFile) => {
|
|
121
|
+
const relativeSpecFilePath = (0, devkit_1.normalizePath)((0, path_1.relative)(projectRoot, testFile));
|
|
122
|
+
const targetName = `${options.ciTargetName}--${relativeSpecFilePath}`;
|
|
123
|
+
ciTargetGroup.push(targetName);
|
|
95
124
|
targets[targetName] = {
|
|
96
125
|
...ciBaseTargetConfig,
|
|
97
|
-
command: `${baseTargetConfig.command} ${
|
|
126
|
+
command: `${baseTargetConfig.command} ${relativeSpecFilePath}`,
|
|
127
|
+
metadata: {
|
|
128
|
+
technologies: ['playwright'],
|
|
129
|
+
description: `Runs Playwright Tests in ${relativeSpecFilePath} in CI`,
|
|
130
|
+
},
|
|
98
131
|
};
|
|
99
132
|
dependsOn.push({
|
|
100
133
|
target: targetName,
|
|
@@ -113,12 +146,17 @@ async function buildPlaywrightTargets(configFilePath, projectRoot, options, cont
|
|
|
113
146
|
inputs: ciBaseTargetConfig.inputs,
|
|
114
147
|
outputs: ciBaseTargetConfig.outputs,
|
|
115
148
|
dependsOn,
|
|
149
|
+
metadata: {
|
|
150
|
+
technologies: ['playwright'],
|
|
151
|
+
description: 'Runs Playwright Tests in CI',
|
|
152
|
+
},
|
|
116
153
|
};
|
|
154
|
+
ciTargetGroup.push(options.ciTargetName);
|
|
117
155
|
}
|
|
118
|
-
return targets;
|
|
156
|
+
return { targets, metadata };
|
|
119
157
|
}
|
|
120
158
|
async function forEachTestFile(cb, opts) {
|
|
121
|
-
const files = (0, workspace_context_1.getFilesInDirectoryUsingContext)(opts.context.workspaceRoot, opts.path);
|
|
159
|
+
const files = await (0, workspace_context_1.getFilesInDirectoryUsingContext)(opts.context.workspaceRoot, opts.path);
|
|
122
160
|
const matcher = createMatcher(opts.config.testMatch);
|
|
123
161
|
const ignoredMatcher = opts.config.testIgnore
|
|
124
162
|
? createMatcher(opts.config.testIgnore)
|
package/src/utils/add-linter.js
CHANGED
|
@@ -31,7 +31,8 @@ async function addLinterToPlaywrightProject(tree, options) {
|
|
|
31
31
|
tasks.push(!options.skipPackageJson
|
|
32
32
|
? (0, devkit_1.addDependenciesToPackageJson)(tree, {}, { 'eslint-plugin-playwright': versions_1.eslintPluginPlaywrightVersion })
|
|
33
33
|
: () => { });
|
|
34
|
-
if ((0, eslint_file_1.isEslintConfigSupported)(tree)
|
|
34
|
+
if ((0, eslint_file_1.isEslintConfigSupported)(tree, projectConfig.root) ||
|
|
35
|
+
(0, eslint_file_1.isEslintConfigSupported)(tree)) {
|
|
35
36
|
(0, eslint_file_1.addExtendsToLintConfig)(tree, projectConfig.root, 'plugin:playwright/recommended');
|
|
36
37
|
if (options.rootProject) {
|
|
37
38
|
(0, eslint_file_1.addPluginsToLintConfig)(tree, projectConfig.root, '@nx');
|