@nx/detox 16.8.0-beta.4 → 16.8.0-beta.6
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 +8 -8
- package/src/executors/build/build.impl.js +10 -13
- package/src/executors/test/test.impl.js +17 -17
- package/src/generators/application/application.js +17 -16
- package/src/generators/application/lib/add-linting.js +17 -20
- package/src/generators/application/lib/add-project.js +25 -13
- package/src/generators/application/lib/create-files.js +6 -1
- package/src/generators/application/lib/normalize-options.js +20 -16
- package/src/generators/init/init.js +20 -16
- package/src/migrations/update-13-10-3/add-verbose-jest-config-13-10-3.js +7 -11
- package/src/migrations/update-13-5-0/add-build-target-test-13-5-0.js +13 -17
- package/src/migrations/update-13-8-2/remove-types-detox-13-8-2.js +15 -18
- package/src/migrations/update-16-0-0/update-detoxrc-json.js +8 -12
- package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +3 -6
- package/src/migrations/update-16-1-4/update-detoxrc-json-expo.js +16 -23
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/detox",
|
|
3
|
-
"version": "16.8.0-beta.
|
|
3
|
+
"version": "16.8.0-beta.6",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The Nx Plugin for Detox contains executors and generators for allowing your workspace to use the powerful Detox integration testing capabilities.",
|
|
6
6
|
"keywords": [
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
"main": "./index.js",
|
|
26
26
|
"types": "index.d.ts",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@nrwl/detox": "16.8.0-beta.
|
|
29
|
-
"@nx/devkit": "16.8.0-beta.
|
|
30
|
-
"@nx/jest": "16.8.0-beta.
|
|
31
|
-
"@nx/js": "16.8.0-beta.
|
|
32
|
-
"@nx/linter": "16.8.0-beta.
|
|
33
|
-
"@nx/react": "16.8.0-beta.
|
|
28
|
+
"@nrwl/detox": "16.8.0-beta.6",
|
|
29
|
+
"@nx/devkit": "16.8.0-beta.6",
|
|
30
|
+
"@nx/jest": "16.8.0-beta.6",
|
|
31
|
+
"@nx/js": "16.8.0-beta.6",
|
|
32
|
+
"@nx/linter": "16.8.0-beta.6",
|
|
33
|
+
"@nx/react": "16.8.0-beta.6",
|
|
34
34
|
"tslib": "^2.3.0"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"access": "public"
|
|
47
47
|
},
|
|
48
48
|
"type": "commonjs",
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "0cc6ba996f2ef09f00b932c8eacf42de642457f3"
|
|
50
50
|
}
|
|
@@ -1,23 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.runCliBuild = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const path_1 = require("path");
|
|
6
5
|
const child_process_1 = require("child_process");
|
|
7
6
|
let childProcess;
|
|
8
|
-
function detoxBuildExecutor(options, context) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
async function* detoxBuildExecutor(options, context) {
|
|
8
|
+
const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
|
|
9
|
+
try {
|
|
10
|
+
await runCliBuild(context.root, projectRoot, options);
|
|
11
|
+
yield { success: true };
|
|
12
|
+
}
|
|
13
|
+
finally {
|
|
14
|
+
if (childProcess) {
|
|
15
|
+
childProcess.kill();
|
|
14
16
|
}
|
|
15
|
-
|
|
16
|
-
if (childProcess) {
|
|
17
|
-
childProcess.kill();
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
});
|
|
17
|
+
}
|
|
21
18
|
}
|
|
22
19
|
exports.default = detoxBuildExecutor;
|
|
23
20
|
function runCliBuild(workspaceRoot, projectRoot, options) {
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
3
|
const devkit_1 = require("@nx/devkit");
|
|
5
4
|
const devkit_2 = require("@nx/devkit");
|
|
6
5
|
const path_1 = require("path");
|
|
7
6
|
const child_process_1 = require("child_process");
|
|
8
7
|
const build_impl_1 = require("../build/build.impl");
|
|
9
8
|
let childProcess;
|
|
10
|
-
function detoxTestExecutor(options, context) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
yield yield tslib_1.__await({ success: true });
|
|
9
|
+
async function* detoxTestExecutor(options, context) {
|
|
10
|
+
const projectRoot = context.projectsConfigurations.projects[context.projectName].root;
|
|
11
|
+
try {
|
|
12
|
+
if (!options.reuse && options.buildTarget) {
|
|
13
|
+
const buildTarget = (0, devkit_1.parseTargetString)(options.buildTarget, context.projectGraph);
|
|
14
|
+
const buildOptions = (0, devkit_1.readTargetOptions)(buildTarget, context);
|
|
15
|
+
await (0, build_impl_1.runCliBuild)(context.root, projectRoot, {
|
|
16
|
+
...buildOptions,
|
|
17
|
+
detoxConfiguration: options.detoxConfiguration,
|
|
18
|
+
});
|
|
21
19
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
await runCliTest(context.root, projectRoot, options);
|
|
21
|
+
yield { success: true };
|
|
22
|
+
}
|
|
23
|
+
finally {
|
|
24
|
+
if (childProcess) {
|
|
25
|
+
childProcess.kill();
|
|
26
26
|
}
|
|
27
|
-
}
|
|
27
|
+
}
|
|
28
28
|
}
|
|
29
29
|
exports.default = detoxTestExecutor;
|
|
30
30
|
function runCliTest(workspaceRoot, projectRoot, options) {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.detoxApplicationSchematic = exports.detoxApplicationGeneratorInternal = exports.detoxApplicationGenerator = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const devkit_1 = require("@nx/devkit");
|
|
6
5
|
const init_1 = require("../init/init");
|
|
7
6
|
const add_git_ignore_entry_1 = require("./lib/add-git-ignore-entry");
|
|
@@ -9,25 +8,27 @@ const add_linting_1 = require("./lib/add-linting");
|
|
|
9
8
|
const add_project_1 = require("./lib/add-project");
|
|
10
9
|
const create_files_1 = require("./lib/create-files");
|
|
11
10
|
const normalize_options_1 = require("./lib/normalize-options");
|
|
12
|
-
function detoxApplicationGenerator(host, schema) {
|
|
13
|
-
return
|
|
14
|
-
|
|
11
|
+
async function detoxApplicationGenerator(host, schema) {
|
|
12
|
+
return await detoxApplicationGeneratorInternal(host, {
|
|
13
|
+
projectNameAndRootFormat: 'derived',
|
|
14
|
+
...schema,
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
17
|
exports.detoxApplicationGenerator = detoxApplicationGenerator;
|
|
18
|
-
function detoxApplicationGeneratorInternal(host, schema) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
(0, add_project_1.addProject)(host, options);
|
|
24
|
-
(0, add_git_ignore_entry_1.addGitIgnoreEntry)(host, options);
|
|
25
|
-
const lintingTask = yield (0, add_linting_1.addLinting)(host, options);
|
|
26
|
-
if (!options.skipFormat) {
|
|
27
|
-
yield (0, devkit_1.formatFiles)(host);
|
|
28
|
-
}
|
|
29
|
-
return (0, devkit_1.runTasksInSerial)(initTask, lintingTask);
|
|
18
|
+
async function detoxApplicationGeneratorInternal(host, schema) {
|
|
19
|
+
const options = await (0, normalize_options_1.normalizeOptions)(host, schema);
|
|
20
|
+
const initTask = await (0, init_1.default)(host, {
|
|
21
|
+
...options,
|
|
22
|
+
skipFormat: true,
|
|
30
23
|
});
|
|
24
|
+
(0, create_files_1.createFiles)(host, options);
|
|
25
|
+
(0, add_project_1.addProject)(host, options);
|
|
26
|
+
(0, add_git_ignore_entry_1.addGitIgnoreEntry)(host, options);
|
|
27
|
+
const lintingTask = await (0, add_linting_1.addLinting)(host, options);
|
|
28
|
+
if (!options.skipFormat) {
|
|
29
|
+
await (0, devkit_1.formatFiles)(host);
|
|
30
|
+
}
|
|
31
|
+
return (0, devkit_1.runTasksInSerial)(initTask, lintingTask);
|
|
31
32
|
}
|
|
32
33
|
exports.detoxApplicationGeneratorInternal = detoxApplicationGeneratorInternal;
|
|
33
34
|
exports.default = detoxApplicationGenerator;
|
|
@@ -1,30 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addLinting = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const linter_1 = require("@nx/linter");
|
|
6
5
|
const devkit_1 = require("@nx/devkit");
|
|
7
6
|
const react_1 = require("@nx/react");
|
|
8
7
|
const eslint_file_1 = require("@nx/linter/src/generators/utils/eslint-file");
|
|
9
|
-
function addLinting(host, options) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
skipFormat: true,
|
|
22
|
-
});
|
|
23
|
-
if ((0, eslint_file_1.isEslintConfigSupported)(host)) {
|
|
24
|
-
(0, eslint_file_1.addExtendsToLintConfig)(host, options.e2eProjectRoot, 'plugin:@nx/react');
|
|
25
|
-
}
|
|
26
|
-
const installTask = (0, devkit_1.addDependenciesToPackageJson)(host, react_1.extraEslintDependencies.dependencies, react_1.extraEslintDependencies.devDependencies);
|
|
27
|
-
return (0, devkit_1.runTasksInSerial)(lintTask, installTask);
|
|
8
|
+
async function addLinting(host, options) {
|
|
9
|
+
if (options.linter === linter_1.Linter.None) {
|
|
10
|
+
return () => { };
|
|
11
|
+
}
|
|
12
|
+
const lintTask = await (0, linter_1.lintProjectGenerator)(host, {
|
|
13
|
+
linter: options.linter,
|
|
14
|
+
project: options.e2eProjectName,
|
|
15
|
+
tsConfigPaths: [
|
|
16
|
+
(0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'tsconfig.app.json'),
|
|
17
|
+
],
|
|
18
|
+
eslintFilePatterns: [`${options.e2eProjectRoot}/**/*.{ts,tsx,js,jsx}`],
|
|
19
|
+
skipFormat: true,
|
|
28
20
|
});
|
|
21
|
+
if ((0, eslint_file_1.isEslintConfigSupported)(host)) {
|
|
22
|
+
(0, eslint_file_1.addExtendsToLintConfig)(host, options.e2eProjectRoot, 'plugin:@nx/react');
|
|
23
|
+
}
|
|
24
|
+
const installTask = (0, devkit_1.addDependenciesToPackageJson)(host, react_1.extraEslintDependencies.dependencies, react_1.extraEslintDependencies.devDependencies);
|
|
25
|
+
return (0, devkit_1.runTasksInSerial)(lintTask, installTask);
|
|
29
26
|
}
|
|
30
27
|
exports.addLinting = addLinting;
|
|
@@ -8,7 +8,7 @@ function addProject(host, options) {
|
|
|
8
8
|
root: options.e2eProjectRoot,
|
|
9
9
|
sourceRoot: `${options.e2eProjectRoot}/src`,
|
|
10
10
|
projectType: 'application',
|
|
11
|
-
targets:
|
|
11
|
+
targets: { ...getTargets(options) },
|
|
12
12
|
tags: [],
|
|
13
13
|
implicitDependencies: [options.appProject],
|
|
14
14
|
});
|
|
@@ -16,17 +16,29 @@ function addProject(host, options) {
|
|
|
16
16
|
exports.addProject = addProject;
|
|
17
17
|
function getTargets(options) {
|
|
18
18
|
const targets = {};
|
|
19
|
-
targets['build-ios'] =
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
targets['
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
19
|
+
targets['build-ios'] = {
|
|
20
|
+
executor: '@nx/detox:build',
|
|
21
|
+
...(options.framework === 'react-native'
|
|
22
|
+
? (0, get_targets_1.reactNativeBuildTarget)('ios.sim')
|
|
23
|
+
: (0, get_targets_1.expoBuildTarget)('ios.sim')),
|
|
24
|
+
};
|
|
25
|
+
targets['test-ios'] = {
|
|
26
|
+
executor: '@nx/detox:test',
|
|
27
|
+
...(options.framework === 'react-native'
|
|
28
|
+
? (0, get_targets_1.reactNativeTestTarget)('ios.sim', options.e2eProjectName)
|
|
29
|
+
: (0, get_targets_1.expoTestTarget)('ios.sim', options.e2eProjectName)),
|
|
30
|
+
};
|
|
31
|
+
targets['build-android'] = {
|
|
32
|
+
executor: '@nx/detox:build',
|
|
33
|
+
...(options.framework === 'react-native'
|
|
34
|
+
? (0, get_targets_1.reactNativeBuildTarget)('android.emu')
|
|
35
|
+
: (0, get_targets_1.expoBuildTarget)('android.emu')),
|
|
36
|
+
};
|
|
37
|
+
targets['test-android'] = {
|
|
38
|
+
executor: '@nx/detox:test',
|
|
39
|
+
...(options.framework === 'react-native'
|
|
40
|
+
? (0, get_targets_1.reactNativeTestTarget)('android.emu', options.e2eProjectName)
|
|
41
|
+
: (0, get_targets_1.expoTestTarget)('android.emu', options.e2eProjectName)),
|
|
42
|
+
};
|
|
31
43
|
return targets;
|
|
32
44
|
}
|
|
@@ -5,7 +5,12 @@ const devkit_1 = require("@nx/devkit");
|
|
|
5
5
|
const js_1 = require("@nx/js");
|
|
6
6
|
const path_1 = require("path");
|
|
7
7
|
function createFiles(host, options) {
|
|
8
|
-
(0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, '../files/app'), options.e2eProjectRoot,
|
|
8
|
+
(0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, '../files/app'), options.e2eProjectRoot, {
|
|
9
|
+
...options,
|
|
10
|
+
exec: (0, devkit_1.getPackageManagerCommand)((0, devkit_1.detectPackageManager)(host.root)).exec,
|
|
11
|
+
offsetFromRoot: (0, devkit_1.offsetFromRoot)(options.e2eProjectRoot),
|
|
12
|
+
rootTsConfigPath: (0, js_1.getRelativePathToRootTsConfig)(host, options.e2eProjectRoot),
|
|
13
|
+
});
|
|
9
14
|
if (options.js) {
|
|
10
15
|
(0, devkit_1.toJS)(host);
|
|
11
16
|
}
|
|
@@ -1,24 +1,28 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.normalizeOptions = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const devkit_1 = require("@nx/devkit");
|
|
6
5
|
const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
|
|
7
|
-
function normalizeOptions(host, options) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
projectNameAndRootFormat: options.projectNameAndRootFormat,
|
|
15
|
-
callingGenerator: '@nx/detox:application',
|
|
16
|
-
});
|
|
17
|
-
const { fileName: appFileName, className: appClassName } = (0, devkit_1.names)(options.appName || options.appProject);
|
|
18
|
-
const { root: appRoot } = (0, devkit_1.readProjectConfiguration)(host, (0, devkit_1.names)(options.appProject).fileName);
|
|
19
|
-
return Object.assign(Object.assign({}, options), { appFileName,
|
|
20
|
-
appClassName, appDisplayName: options.appDisplayName || appClassName, appExpoName: ((_a = options.appDisplayName) === null || _a === void 0 ? void 0 : _a.replace(/\s/g, '')) || appClassName, appRoot, e2eName: e2eProjectName, e2eProjectName,
|
|
21
|
-
e2eProjectRoot });
|
|
6
|
+
async function normalizeOptions(host, options) {
|
|
7
|
+
const { projectName: e2eProjectName, projectRoot: e2eProjectRoot } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
|
|
8
|
+
name: options.e2eName,
|
|
9
|
+
projectType: 'application',
|
|
10
|
+
directory: options.e2eDirectory,
|
|
11
|
+
projectNameAndRootFormat: options.projectNameAndRootFormat,
|
|
12
|
+
callingGenerator: '@nx/detox:application',
|
|
22
13
|
});
|
|
14
|
+
const { fileName: appFileName, className: appClassName } = (0, devkit_1.names)(options.appName || options.appProject);
|
|
15
|
+
const { root: appRoot } = (0, devkit_1.readProjectConfiguration)(host, (0, devkit_1.names)(options.appProject).fileName);
|
|
16
|
+
return {
|
|
17
|
+
...options,
|
|
18
|
+
appFileName,
|
|
19
|
+
appClassName,
|
|
20
|
+
appDisplayName: options.appDisplayName || appClassName,
|
|
21
|
+
appExpoName: options.appDisplayName?.replace(/\s/g, '') || appClassName,
|
|
22
|
+
appRoot,
|
|
23
|
+
e2eName: e2eProjectName,
|
|
24
|
+
e2eProjectName,
|
|
25
|
+
e2eProjectRoot,
|
|
26
|
+
};
|
|
23
27
|
}
|
|
24
28
|
exports.normalizeOptions = normalizeOptions;
|
|
@@ -1,28 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.detoxInitSchematic = exports.updateDependencies = exports.detoxInitGenerator = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
4
|
const devkit_1 = require("@nx/devkit");
|
|
6
5
|
const versions_1 = require("@nx/jest/src/utils/versions");
|
|
7
6
|
const versions_2 = require("../../utils/versions");
|
|
8
|
-
function detoxInitGenerator(host, schema) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
19
|
-
});
|
|
7
|
+
async function detoxInitGenerator(host, schema) {
|
|
8
|
+
const tasks = [];
|
|
9
|
+
if (!schema.skipPackageJson) {
|
|
10
|
+
tasks.push(moveDependency(host));
|
|
11
|
+
tasks.push(updateDependencies(host, schema));
|
|
12
|
+
}
|
|
13
|
+
if (!schema.skipFormat) {
|
|
14
|
+
await (0, devkit_1.formatFiles)(host);
|
|
15
|
+
}
|
|
16
|
+
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
20
17
|
}
|
|
21
18
|
exports.detoxInitGenerator = detoxInitGenerator;
|
|
22
19
|
function updateDependencies(host, schema) {
|
|
23
|
-
return (0, devkit_1.addDependenciesToPackageJson)(host, {},
|
|
24
|
-
|
|
25
|
-
:
|
|
20
|
+
return (0, devkit_1.addDependenciesToPackageJson)(host, {}, {
|
|
21
|
+
'@nx/detox': versions_2.nxVersion,
|
|
22
|
+
detox: versions_2.detoxVersion,
|
|
23
|
+
'@testing-library/jest-dom': versions_2.testingLibraryJestDom,
|
|
24
|
+
'@types/node': versions_1.typesNodeVersion,
|
|
25
|
+
'jest-circus': versions_1.jestVersion,
|
|
26
|
+
...(schema.framework === 'expo'
|
|
27
|
+
? { '@config-plugins/detox': versions_2.configPluginsDetoxVersion }
|
|
28
|
+
: {}),
|
|
29
|
+
});
|
|
26
30
|
}
|
|
27
31
|
exports.updateDependencies = updateDependencies;
|
|
28
32
|
function moveDependency(host) {
|
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
3
|
const devkit_1 = require("@nx/devkit");
|
|
5
4
|
/**
|
|
6
5
|
* Update jest.config.json under detox project, add key verbsoe: true
|
|
7
6
|
*/
|
|
8
|
-
function update(tree) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return;
|
|
15
|
-
updateJestConfig(tree, project);
|
|
16
|
-
});
|
|
17
|
-
yield (0, devkit_1.formatFiles)(tree);
|
|
7
|
+
async function update(tree) {
|
|
8
|
+
const projects = (0, devkit_1.getProjects)(tree);
|
|
9
|
+
projects.forEach((project) => {
|
|
10
|
+
if (project.targets?.['test-ios']?.executor !== '@nrwl/detox:test')
|
|
11
|
+
return;
|
|
12
|
+
updateJestConfig(tree, project);
|
|
18
13
|
});
|
|
14
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
19
15
|
}
|
|
20
16
|
exports.default = update;
|
|
21
17
|
function updateJestConfig(host, project) {
|
|
@@ -1,26 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
3
|
const devkit_1 = require("@nx/devkit");
|
|
5
4
|
/**
|
|
6
5
|
* This function buildTarget to test-ios and test-android
|
|
7
6
|
*/
|
|
8
|
-
function update(tree) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
config.targets['test-ios'].options.buildTarget = `${name}:build-ios`;
|
|
15
|
-
config.targets['test-ios'].configurations.production.buildTarget = `${name}:build-ios:prod`;
|
|
16
|
-
}
|
|
17
|
-
if (((_d = (_c = config.targets) === null || _c === void 0 ? void 0 : _c['test-android']) === null || _d === void 0 ? void 0 : _d.executor) === '@nrwl/detox:test') {
|
|
18
|
-
config.targets['test-android'].options.buildTarget = `${name}:build-android`;
|
|
19
|
-
config.targets['test-android'].configurations.production.buildTarget = `${name}:build-android:prod`;
|
|
20
|
-
}
|
|
21
|
-
(0, devkit_1.updateProjectConfiguration)(tree, name, config);
|
|
7
|
+
async function update(tree) {
|
|
8
|
+
const projects = (0, devkit_1.getProjects)(tree);
|
|
9
|
+
for (const [name, config] of projects.entries()) {
|
|
10
|
+
if (config.targets?.['test-ios']?.executor === '@nrwl/detox:test') {
|
|
11
|
+
config.targets['test-ios'].options.buildTarget = `${name}:build-ios`;
|
|
12
|
+
config.targets['test-ios'].configurations.production.buildTarget = `${name}:build-ios:prod`;
|
|
22
13
|
}
|
|
23
|
-
|
|
24
|
-
|
|
14
|
+
if (config.targets?.['test-android']?.executor === '@nrwl/detox:test') {
|
|
15
|
+
config.targets['test-android'].options.buildTarget = `${name}:build-android`;
|
|
16
|
+
config.targets['test-android'].configurations.production.buildTarget = `${name}:build-android:prod`;
|
|
17
|
+
}
|
|
18
|
+
(0, devkit_1.updateProjectConfiguration)(tree, name, config);
|
|
19
|
+
}
|
|
20
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
25
21
|
}
|
|
26
22
|
exports.default = update;
|
|
@@ -1,24 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
3
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
function update(tree) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return packageJson;
|
|
21
|
-
});
|
|
4
|
+
async function update(tree) {
|
|
5
|
+
const packageJson = (0, devkit_1.readJson)(tree, 'package.json');
|
|
6
|
+
if (!packageJson.devDependencies['@types/detox']) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
const projects = (0, devkit_1.getProjects)(tree);
|
|
10
|
+
const hasDetoxProject = Array.from(projects)
|
|
11
|
+
.map(([_, project]) => project)
|
|
12
|
+
.some((project) => project.targets?.['test-ios']?.executor === '@nrwl/detox:test');
|
|
13
|
+
if (!hasDetoxProject) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
(0, devkit_1.updateJson)(tree, 'package.json', (packageJson) => {
|
|
17
|
+
delete packageJson.devDependencies['@types/detox'];
|
|
18
|
+
return packageJson;
|
|
22
19
|
});
|
|
23
20
|
}
|
|
24
21
|
exports.default = update;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
3
|
const devkit_1 = require("@nx/devkit");
|
|
5
4
|
/**
|
|
6
5
|
* Update .detoxrc.json under detox project:
|
|
@@ -10,18 +9,15 @@ const devkit_1 = require("@nx/devkit");
|
|
|
10
9
|
* - remove key: transform
|
|
11
10
|
* - add key: rootDir, testMatch, reporter, globalSetup, globalTeardown, verbose
|
|
12
11
|
*/
|
|
13
|
-
function update(tree) {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
updateDetoxrcJson(tree, project);
|
|
21
|
-
updateJestConfigJson(tree, project);
|
|
22
|
-
});
|
|
23
|
-
yield (0, devkit_1.formatFiles)(tree);
|
|
12
|
+
async function update(tree) {
|
|
13
|
+
const projects = (0, devkit_1.getProjects)(tree);
|
|
14
|
+
projects.forEach((project) => {
|
|
15
|
+
if (project.targets?.['test-ios']?.executor !== '@nx/detox:test')
|
|
16
|
+
return;
|
|
17
|
+
updateDetoxrcJson(tree, project);
|
|
18
|
+
updateJestConfigJson(tree, project);
|
|
24
19
|
});
|
|
20
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
25
21
|
}
|
|
26
22
|
exports.default = update;
|
|
27
23
|
function updateDetoxrcJson(host, project) {
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
3
|
const devkit_1 = require("@nx/devkit");
|
|
5
4
|
const replace_package_1 = require("@nx/devkit/src/utils/replace-package");
|
|
6
|
-
function replacePackage(tree) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
yield (0, devkit_1.formatFiles)(tree);
|
|
10
|
-
});
|
|
5
|
+
async function replacePackage(tree) {
|
|
6
|
+
(0, replace_package_1.replaceNrwlPackageWithNxPackage)(tree, '@nrwl/detox', '@nx/detox');
|
|
7
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
11
8
|
}
|
|
12
9
|
exports.default = replacePackage;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
3
|
const devkit_1 = require("@nx/devkit");
|
|
5
4
|
/**
|
|
6
5
|
* Update .detoxrc.json under detox project for expo:
|
|
@@ -8,45 +7,40 @@ const devkit_1 = require("@nx/devkit");
|
|
|
8
7
|
* - fix the local build command
|
|
9
8
|
* - update project.json targets
|
|
10
9
|
*/
|
|
11
|
-
function update(tree) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
updateDetoxrcJson(tree, project);
|
|
19
|
-
updateProjectJson(tree, project);
|
|
20
|
-
});
|
|
21
|
-
yield (0, devkit_1.formatFiles)(tree);
|
|
10
|
+
async function update(tree) {
|
|
11
|
+
const projects = (0, devkit_1.getProjects)(tree);
|
|
12
|
+
projects.forEach((project) => {
|
|
13
|
+
if (project.targets?.['test-ios']?.executor !== '@nx/detox:test')
|
|
14
|
+
return;
|
|
15
|
+
updateDetoxrcJson(tree, project);
|
|
16
|
+
updateProjectJson(tree, project);
|
|
22
17
|
});
|
|
18
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
23
19
|
}
|
|
24
20
|
exports.default = update;
|
|
25
21
|
function updateDetoxrcJson(host, project) {
|
|
26
|
-
var _a, _b;
|
|
27
22
|
const detoxConfigPath = `${project.root}/.detoxrc.json`;
|
|
28
|
-
const projectName =
|
|
23
|
+
const projectName = project.name?.endsWith('-e2e')
|
|
29
24
|
? project.name.substring(0, project.name.indexOf('-e2e'))
|
|
30
25
|
: project.name;
|
|
31
|
-
const appRoot = (
|
|
26
|
+
const appRoot = (0, devkit_1.getProjects)(host).get(projectName)?.root;
|
|
32
27
|
const appName = (0, devkit_1.names)(projectName).className;
|
|
33
28
|
const offset = (0, devkit_1.offsetFromRoot)(project.root);
|
|
34
29
|
const exec = (0, devkit_1.getPackageManagerCommand)((0, devkit_1.detectPackageManager)(host.root)).exec;
|
|
35
30
|
if (!host.exists(detoxConfigPath))
|
|
36
31
|
return;
|
|
37
32
|
(0, devkit_1.updateJson)(host, detoxConfigPath, (json) => {
|
|
38
|
-
|
|
39
|
-
if ((_a = json.apps) === null || _a === void 0 ? void 0 : _a['ios.eas']) {
|
|
33
|
+
if (json.apps?.['ios.eas']) {
|
|
40
34
|
json.apps['ios.eas'].build = `${exec} nx run ${projectName}:download --platform ios --distribution simulator --output=${offset}${appRoot}/dist/`;
|
|
41
35
|
}
|
|
42
|
-
if (
|
|
36
|
+
if (json.apps?.['android.eas']) {
|
|
43
37
|
json.apps['android.eas'].build = `${exec} nx run ${projectName}:download --platform android --distribution simulator --output=${offset}${appRoot}/dist/`;
|
|
44
38
|
json.apps['android.eas'].type = 'android.apk';
|
|
45
39
|
}
|
|
46
|
-
if (
|
|
40
|
+
if (json.apps?.['ios.local']) {
|
|
47
41
|
json.apps['ios.local'].build = `${exec} nx run ${projectName}:build --platform ios --profile preview --wait --local --no-interactive --output=${offset}${appRoot}/dist/${appName}.tar.gz`;
|
|
48
42
|
}
|
|
49
|
-
if (
|
|
43
|
+
if (json.apps?.['android.local']) {
|
|
50
44
|
json.apps['android.local'].build = `${exec} nx run ${projectName}:build --platform android --profile preview --wait --local --no-interactive --output=${offset}${appRoot}/dist/${appName}.apk`;
|
|
51
45
|
json.apps['android.local'].type = 'android.apk';
|
|
52
46
|
}
|
|
@@ -54,11 +48,10 @@ function updateDetoxrcJson(host, project) {
|
|
|
54
48
|
});
|
|
55
49
|
}
|
|
56
50
|
function updateProjectJson(host, project) {
|
|
57
|
-
|
|
58
|
-
if (((_c = (_b = (_a = project.targets) === null || _a === void 0 ? void 0 : _a['test-ios']) === null || _b === void 0 ? void 0 : _b.options) === null || _c === void 0 ? void 0 : _c.detoxConfiguration) == 'ios.sim.eas') {
|
|
51
|
+
if (project.targets?.['test-ios']?.options?.detoxConfiguration == 'ios.sim.eas') {
|
|
59
52
|
project.targets['build-ios'].options.detoxConfiguration = 'ios.sim.eas';
|
|
60
53
|
}
|
|
61
|
-
if (
|
|
54
|
+
if (project.targets?.['test-android']?.options?.detoxConfiguration ==
|
|
62
55
|
'android.sim.eas') {
|
|
63
56
|
project.targets['build-android'].options.detoxConfiguration =
|
|
64
57
|
'android.sim.eas';
|