@nx/detox 17.0.5 → 17.0.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/LICENSE +1 -1
- package/README.md +4 -9
- package/generators.json +1 -1
- package/migrations.json +0 -26
- package/package.json +7 -7
- package/src/generators/application/application.js +1 -4
- package/src/generators/application/lib/add-linting.js +1 -1
- package/src/generators/application/lib/add-project.js +1 -5
- package/src/generators/application/lib/normalize-options.js +0 -4
- package/src/generators/application/schema.json +1 -1
- package/src/generators/init/init.d.ts +0 -1
- package/src/generators/init/init.js +14 -43
- package/src/generators/init/schema.json +6 -12
- package/src/utils/versions.d.ts +3 -3
- package/src/utils/versions.js +3 -3
- package/plugin.d.ts +0 -1
- package/plugin.js +0 -6
- package/src/generators/application/lib/ensure-dependencies.d.ts +0 -3
- package/src/generators/application/lib/ensure-dependencies.js +0 -18
- package/src/plugins/plugin.d.ts +0 -8
- package/src/plugins/plugin.js +0 -89
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
<p style="text-align: center;">
|
|
2
|
-
<picture>
|
|
3
|
-
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-dark.svg">
|
|
4
|
-
<img alt="Nx - Smart Monorepos · Fast CI" src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-light.svg" width="100%">
|
|
5
|
-
</picture>
|
|
6
|
-
</p>
|
|
1
|
+
<p style="text-align: center;"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx.png" width="600" alt="Nx - Smart, Fast and Extensible Build System"></p>
|
|
7
2
|
|
|
8
3
|
<div style="text-align: center;">
|
|
9
4
|
|
|
@@ -20,9 +15,9 @@
|
|
|
20
15
|
|
|
21
16
|
<hr>
|
|
22
17
|
|
|
23
|
-
# Nx: Smart
|
|
18
|
+
# Nx: Smart, Fast and Extensible Build System
|
|
24
19
|
|
|
25
|
-
Nx is a build system with
|
|
20
|
+
Nx is a next generation build system with first class monorepo support and powerful integrations.
|
|
26
21
|
|
|
27
22
|
This package is a [Detox plugin for Nx](https://nx.dev/detox/overview).
|
|
28
23
|
|
|
@@ -64,5 +59,5 @@ npx nx@latest init
|
|
|
64
59
|
- [Blog Posts About Nx](https://blog.nrwl.io/nx/home)
|
|
65
60
|
|
|
66
61
|
<p style="text-align: center;"><a href="https://nx.dev/#learning-materials" target="_blank" rel="noreferrer"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-courses-and-videos.svg"
|
|
67
|
-
width="100%" alt="Nx - Smart
|
|
62
|
+
width="100%" alt="Nx - Smart, Fast and Extensible Build System"></a></p>
|
|
68
63
|
|
package/generators.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"extends": ["@nx/workspace"],
|
|
5
5
|
"generators": {
|
|
6
6
|
"init": {
|
|
7
|
-
"factory": "./src/generators/init/init#
|
|
7
|
+
"factory": "./src/generators/init/init#detoxInitGenerator",
|
|
8
8
|
"schema": "./src/generators/init/schema.json",
|
|
9
9
|
"description": "Initialize the `@nrwl/detox` plugin.",
|
|
10
10
|
"hidden": true
|
package/migrations.json
CHANGED
|
@@ -99,32 +99,6 @@
|
|
|
99
99
|
"alwaysAddToPackageJson": false
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
|
-
},
|
|
103
|
-
"18.0.0": {
|
|
104
|
-
"version": "18.0.0-beta.0",
|
|
105
|
-
"packages": {
|
|
106
|
-
"detox": {
|
|
107
|
-
"version": "^20.16.0",
|
|
108
|
-
"alwaysAddToPackageJson": false
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
},
|
|
112
|
-
"18.1.0": {
|
|
113
|
-
"version": "18.1.0-beta.0",
|
|
114
|
-
"packages": {
|
|
115
|
-
"detox": {
|
|
116
|
-
"version": "~20.18.1",
|
|
117
|
-
"alwaysAddToPackageJson": false
|
|
118
|
-
},
|
|
119
|
-
"@config-plugins/detox": {
|
|
120
|
-
"version": "~7.0.0",
|
|
121
|
-
"alwaysAddToPackageJson": false
|
|
122
|
-
},
|
|
123
|
-
"@testing-library/jest-dom": {
|
|
124
|
-
"version": "~6.4.2",
|
|
125
|
-
"alwaysAddToPackageJson": false
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
102
|
}
|
|
129
103
|
}
|
|
130
104
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/detox",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "v17.0.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,13 +25,13 @@
|
|
|
25
25
|
"main": "./index.js",
|
|
26
26
|
"types": "index.d.ts",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@nx/devkit": "
|
|
29
|
-
"@nx/jest": "
|
|
30
|
-
"@nx/js": "
|
|
31
|
-
"@nx/eslint": "
|
|
32
|
-
"@nx/react": "
|
|
28
|
+
"@nx/devkit": "v17.0.6",
|
|
29
|
+
"@nx/jest": "v17.0.6",
|
|
30
|
+
"@nx/js": "v17.0.6",
|
|
31
|
+
"@nx/eslint": "v17.0.6",
|
|
32
|
+
"@nx/react": "v17.0.6",
|
|
33
33
|
"tslib": "^2.3.0",
|
|
34
|
-
"@nrwl/detox": "
|
|
34
|
+
"@nrwl/detox": "v17.0.6"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"detox": "^20.9.0"
|
|
@@ -8,10 +8,8 @@ const add_linting_1 = require("./lib/add-linting");
|
|
|
8
8
|
const add_project_1 = require("./lib/add-project");
|
|
9
9
|
const create_files_1 = require("./lib/create-files");
|
|
10
10
|
const normalize_options_1 = require("./lib/normalize-options");
|
|
11
|
-
const ensure_dependencies_1 = require("./lib/ensure-dependencies");
|
|
12
11
|
async function detoxApplicationGenerator(host, schema) {
|
|
13
12
|
return await detoxApplicationGeneratorInternal(host, {
|
|
14
|
-
addPlugin: false,
|
|
15
13
|
projectNameAndRootFormat: 'derived',
|
|
16
14
|
...schema,
|
|
17
15
|
});
|
|
@@ -27,11 +25,10 @@ async function detoxApplicationGeneratorInternal(host, schema) {
|
|
|
27
25
|
(0, add_project_1.addProject)(host, options);
|
|
28
26
|
(0, add_git_ignore_entry_1.addGitIgnoreEntry)(host, options);
|
|
29
27
|
const lintingTask = await (0, add_linting_1.addLinting)(host, options);
|
|
30
|
-
const depsTask = (0, ensure_dependencies_1.ensureDependencies)(host, options);
|
|
31
28
|
if (!options.skipFormat) {
|
|
32
29
|
await (0, devkit_1.formatFiles)(host);
|
|
33
30
|
}
|
|
34
|
-
return (0, devkit_1.runTasksInSerial)(initTask, lintingTask
|
|
31
|
+
return (0, devkit_1.runTasksInSerial)(initTask, lintingTask);
|
|
35
32
|
}
|
|
36
33
|
exports.detoxApplicationGeneratorInternal = detoxApplicationGeneratorInternal;
|
|
37
34
|
exports.default = detoxApplicationGenerator;
|
|
@@ -15,8 +15,8 @@ async function addLinting(host, options) {
|
|
|
15
15
|
tsConfigPaths: [
|
|
16
16
|
(0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'tsconfig.app.json'),
|
|
17
17
|
],
|
|
18
|
+
eslintFilePatterns: [`${options.e2eProjectRoot}/**/*.{ts,tsx,js,jsx}`],
|
|
18
19
|
skipFormat: true,
|
|
19
|
-
addPlugin: options.addPlugin,
|
|
20
20
|
});
|
|
21
21
|
if ((0, eslint_file_1.isEslintConfigSupported)(host)) {
|
|
22
22
|
(0, eslint_file_1.addExtendsToLintConfig)(host, options.e2eProjectRoot, 'plugin:@nx/react');
|
|
@@ -4,15 +4,11 @@ exports.addProject = void 0;
|
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const get_targets_1 = require("./get-targets");
|
|
6
6
|
function addProject(host, options) {
|
|
7
|
-
const nxJson = (0, devkit_1.readNxJson)(host);
|
|
8
|
-
const hasPlugin = nxJson.plugins?.some((p) => typeof p === 'string'
|
|
9
|
-
? p === '@nx/detox/plugin'
|
|
10
|
-
: p.plugin === '@nx/detox/plugin');
|
|
11
7
|
(0, devkit_1.addProjectConfiguration)(host, options.e2eProjectName, {
|
|
12
8
|
root: options.e2eProjectRoot,
|
|
13
9
|
sourceRoot: `${options.e2eProjectRoot}/src`,
|
|
14
10
|
projectType: 'application',
|
|
15
|
-
targets:
|
|
11
|
+
targets: { ...getTargets(options) },
|
|
16
12
|
tags: [],
|
|
17
13
|
implicitDependencies: [options.appProject],
|
|
18
14
|
});
|
|
@@ -11,10 +11,6 @@ async function normalizeOptions(host, options) {
|
|
|
11
11
|
projectNameAndRootFormat: options.projectNameAndRootFormat,
|
|
12
12
|
callingGenerator: '@nx/detox:application',
|
|
13
13
|
});
|
|
14
|
-
const nxJson = (0, devkit_1.readNxJson)(host);
|
|
15
|
-
const addPlugin = process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
16
|
-
nxJson.useInferencePlugins !== false;
|
|
17
|
-
options.addPlugin ??= addPlugin;
|
|
18
14
|
const { fileName: appFileName, className: appClassName } = (0, devkit_1.names)(options.appName || options.appProject);
|
|
19
15
|
const { root: appRoot } = (0, devkit_1.readProjectConfiguration)(host, (0, devkit_1.names)(options.appProject).fileName);
|
|
20
16
|
return {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { GeneratorCallback, Tree } from '@nx/devkit';
|
|
2
2
|
import { Schema } from './schema';
|
|
3
3
|
export declare function detoxInitGenerator(host: Tree, schema: Schema): Promise<GeneratorCallback>;
|
|
4
|
-
export declare function detoxInitGeneratorInternal(host: Tree, schema: Schema): Promise<GeneratorCallback>;
|
|
5
4
|
export declare function updateDependencies(host: Tree, schema: Schema): GeneratorCallback;
|
|
6
5
|
export default detoxInitGenerator;
|
|
@@ -1,64 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateDependencies = exports.
|
|
3
|
+
exports.updateDependencies = exports.detoxInitGenerator = void 0;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
function detoxInitGenerator(host, schema) {
|
|
9
|
-
return detoxInitGeneratorInternal(host, { addPlugin: false, ...schema });
|
|
10
|
-
}
|
|
11
|
-
exports.detoxInitGenerator = detoxInitGenerator;
|
|
12
|
-
async function detoxInitGeneratorInternal(host, schema) {
|
|
5
|
+
const versions_1 = require("@nx/jest/src/utils/versions");
|
|
6
|
+
const versions_2 = require("../../utils/versions");
|
|
7
|
+
async function detoxInitGenerator(host, schema) {
|
|
13
8
|
const tasks = [];
|
|
14
|
-
const nxJson = (0, devkit_1.readNxJson)(host);
|
|
15
|
-
const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
|
|
16
|
-
nxJson.useInferencePlugins !== false;
|
|
17
|
-
schema.addPlugin ??= addPluginDefault;
|
|
18
9
|
if (!schema.skipPackageJson) {
|
|
19
10
|
tasks.push(moveDependency(host));
|
|
20
11
|
tasks.push(updateDependencies(host, schema));
|
|
21
12
|
}
|
|
22
|
-
if (schema.addPlugin) {
|
|
23
|
-
addPlugin(host);
|
|
24
|
-
}
|
|
25
|
-
if (schema.updatePackageScripts) {
|
|
26
|
-
await (0, update_package_scripts_1.updatePackageScripts)(host, plugin_1.createNodes);
|
|
27
|
-
}
|
|
28
13
|
if (!schema.skipFormat) {
|
|
29
14
|
await (0, devkit_1.formatFiles)(host);
|
|
30
15
|
}
|
|
31
16
|
return (0, devkit_1.runTasksInSerial)(...tasks);
|
|
32
17
|
}
|
|
33
|
-
exports.
|
|
18
|
+
exports.detoxInitGenerator = detoxInitGenerator;
|
|
34
19
|
function updateDependencies(host, schema) {
|
|
35
20
|
return (0, devkit_1.addDependenciesToPackageJson)(host, {}, {
|
|
36
|
-
'@nx/detox':
|
|
37
|
-
detox:
|
|
38
|
-
|
|
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
|
+
});
|
|
39
30
|
}
|
|
40
31
|
exports.updateDependencies = updateDependencies;
|
|
41
32
|
function moveDependency(host) {
|
|
42
33
|
return (0, devkit_1.removeDependenciesFromPackageJson)(host, ['@nx/detox'], []);
|
|
43
34
|
}
|
|
44
|
-
function addPlugin(host) {
|
|
45
|
-
const nxJson = (0, devkit_1.readNxJson)(host);
|
|
46
|
-
nxJson.plugins ??= [];
|
|
47
|
-
for (const plugin of nxJson.plugins) {
|
|
48
|
-
if (typeof plugin === 'string'
|
|
49
|
-
? plugin === '@nx/detox/plugin'
|
|
50
|
-
: plugin.plugin === '@nx/detox/plugin') {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
nxJson.plugins.push({
|
|
55
|
-
plugin: '@nx/detox/plugin',
|
|
56
|
-
options: {
|
|
57
|
-
buildTargetName: 'build',
|
|
58
|
-
startTargetName: 'start',
|
|
59
|
-
testTargetName: 'test',
|
|
60
|
-
},
|
|
61
|
-
});
|
|
62
|
-
(0, devkit_1.updateNxJson)(host, nxJson);
|
|
63
|
-
}
|
|
64
35
|
exports.default = detoxInitGenerator;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"$schema": "
|
|
2
|
+
"$schema": "http://json-schema.org/schema",
|
|
3
3
|
"title": "Add Detox Schematics",
|
|
4
4
|
"description": "Add Detox Schematics.",
|
|
5
5
|
"type": "object",
|
|
@@ -16,17 +16,11 @@
|
|
|
16
16
|
"description": "Do not add dependencies to `package.json`.",
|
|
17
17
|
"x-priority": "internal"
|
|
18
18
|
},
|
|
19
|
-
"
|
|
20
|
-
"type": "
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"default":
|
|
24
|
-
},
|
|
25
|
-
"updatePackageScripts": {
|
|
26
|
-
"type": "boolean",
|
|
27
|
-
"x-priority": "internal",
|
|
28
|
-
"description": "Update `package.json` scripts with inferred targets",
|
|
29
|
-
"default": false
|
|
19
|
+
"framework": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"description": "App framework to test",
|
|
22
|
+
"enum": ["react-native", "expo"],
|
|
23
|
+
"default": "react-native"
|
|
30
24
|
}
|
|
31
25
|
},
|
|
32
26
|
"required": []
|
package/src/utils/versions.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export declare const nxVersion: any;
|
|
2
|
-
export declare const detoxVersion = "
|
|
3
|
-
export declare const testingLibraryJestDom = "
|
|
4
|
-
export declare const configPluginsDetoxVersion = "~
|
|
2
|
+
export declare const detoxVersion = "^20.11.1";
|
|
3
|
+
export declare const testingLibraryJestDom = "5.16.5";
|
|
4
|
+
export declare const configPluginsDetoxVersion = "~6.0.0";
|
package/src/utils/versions.js
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.configPluginsDetoxVersion = exports.testingLibraryJestDom = exports.detoxVersion = exports.nxVersion = void 0;
|
|
4
4
|
exports.nxVersion = require('../../package.json').version;
|
|
5
|
-
exports.detoxVersion = '
|
|
6
|
-
exports.testingLibraryJestDom = '
|
|
7
|
-
exports.configPluginsDetoxVersion = '~
|
|
5
|
+
exports.detoxVersion = '^20.11.1';
|
|
6
|
+
exports.testingLibraryJestDom = '5.16.5';
|
|
7
|
+
exports.configPluginsDetoxVersion = '~6.0.0'; // only required for expo
|
package/plugin.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { createNodes, createDependencies, DetoxPluginOptions, } from './src/plugins/plugin';
|
package/plugin.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createDependencies = exports.createNodes = void 0;
|
|
4
|
-
var plugin_1 = require("./src/plugins/plugin");
|
|
5
|
-
Object.defineProperty(exports, "createNodes", { enumerable: true, get: function () { return plugin_1.createNodes; } });
|
|
6
|
-
Object.defineProperty(exports, "createDependencies", { enumerable: true, get: function () { return plugin_1.createDependencies; } });
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ensureDependencies = void 0;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const versions_1 = require("@nx/jest/src/utils/versions");
|
|
6
|
-
const versions_2 = require("../../../utils/versions");
|
|
7
|
-
function ensureDependencies(tree, options) {
|
|
8
|
-
const devDependencies = {
|
|
9
|
-
'@testing-library/jest-dom': versions_2.testingLibraryJestDom,
|
|
10
|
-
'@types/node': versions_1.typesNodeVersion,
|
|
11
|
-
'jest-circus': versions_1.jestVersion,
|
|
12
|
-
};
|
|
13
|
-
if (options.framework === 'expo') {
|
|
14
|
-
devDependencies['@config-plugins/detox'] = versions_2.configPluginsDetoxVersion;
|
|
15
|
-
}
|
|
16
|
-
return (0, devkit_1.addDependenciesToPackageJson)(tree, {}, devDependencies);
|
|
17
|
-
}
|
|
18
|
-
exports.ensureDependencies = ensureDependencies;
|
package/src/plugins/plugin.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { CreateDependencies, CreateNodes } from '@nx/devkit';
|
|
2
|
-
export interface DetoxPluginOptions {
|
|
3
|
-
buildTargetName?: string;
|
|
4
|
-
startTargetName?: string;
|
|
5
|
-
testTargetName?: string;
|
|
6
|
-
}
|
|
7
|
-
export declare const createDependencies: CreateDependencies;
|
|
8
|
-
export declare const createNodes: CreateNodes<DetoxPluginOptions>;
|
package/src/plugins/plugin.js
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createNodes = exports.createDependencies = void 0;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
|
-
const path_1 = require("path");
|
|
6
|
-
const js_1 = require("@nx/js");
|
|
7
|
-
const get_named_inputs_1 = require("@nx/devkit/src/utils/get-named-inputs");
|
|
8
|
-
const fs_1 = require("fs");
|
|
9
|
-
const calculate_hash_for_create_nodes_1 = require("@nx/devkit/src/utils/calculate-hash-for-create-nodes");
|
|
10
|
-
const cache_directory_1 = require("nx/src/utils/cache-directory");
|
|
11
|
-
const cachePath = (0, path_1.join)(cache_directory_1.projectGraphCacheDirectory, 'detox.hash');
|
|
12
|
-
const targetsCache = (0, fs_1.existsSync)(cachePath) ? readTargetsCache() : {};
|
|
13
|
-
const calculatedTargets = {};
|
|
14
|
-
function readTargetsCache() {
|
|
15
|
-
return (0, devkit_1.readJsonFile)(cachePath);
|
|
16
|
-
}
|
|
17
|
-
function writeTargetsToCache(targets) {
|
|
18
|
-
(0, devkit_1.writeJsonFile)(cachePath, targets);
|
|
19
|
-
}
|
|
20
|
-
const createDependencies = () => {
|
|
21
|
-
writeTargetsToCache(calculatedTargets);
|
|
22
|
-
return [];
|
|
23
|
-
};
|
|
24
|
-
exports.createDependencies = createDependencies;
|
|
25
|
-
exports.createNodes = [
|
|
26
|
-
'**/{detox.config,.detoxrc}.{json,js}',
|
|
27
|
-
(configFilePath, options, context) => {
|
|
28
|
-
options = normalizeOptions(options);
|
|
29
|
-
const projectRoot = (0, path_1.dirname)(configFilePath);
|
|
30
|
-
// Do not create a project if project.json isn't there.
|
|
31
|
-
const siblingFiles = (0, fs_1.readdirSync)((0, path_1.join)(context.workspaceRoot, projectRoot));
|
|
32
|
-
if (!siblingFiles.includes('project.json')) {
|
|
33
|
-
return {};
|
|
34
|
-
}
|
|
35
|
-
const hash = (0, calculate_hash_for_create_nodes_1.calculateHashForCreateNodes)(projectRoot, options, context, [
|
|
36
|
-
(0, js_1.getLockFileName)((0, devkit_1.detectPackageManager)(context.workspaceRoot)),
|
|
37
|
-
]);
|
|
38
|
-
const targets = targetsCache[hash]
|
|
39
|
-
? targetsCache[hash]
|
|
40
|
-
: buildDetoxTargets(projectRoot, options, context);
|
|
41
|
-
calculatedTargets[hash] = targets;
|
|
42
|
-
return {
|
|
43
|
-
projects: {
|
|
44
|
-
[projectRoot]: {
|
|
45
|
-
targets,
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
};
|
|
49
|
-
},
|
|
50
|
-
];
|
|
51
|
-
function buildDetoxTargets(projectRoot, options, context) {
|
|
52
|
-
const namedInputs = (0, get_named_inputs_1.getNamedInputs)(projectRoot, context);
|
|
53
|
-
const targets = {
|
|
54
|
-
[options.buildTargetName]: {
|
|
55
|
-
command: `detox build`,
|
|
56
|
-
options: { cwd: projectRoot },
|
|
57
|
-
cache: true,
|
|
58
|
-
inputs: getInputs(namedInputs),
|
|
59
|
-
},
|
|
60
|
-
[options.startTargetName]: {
|
|
61
|
-
command: `detox start`,
|
|
62
|
-
options: { cwd: projectRoot },
|
|
63
|
-
},
|
|
64
|
-
[options.testTargetName]: {
|
|
65
|
-
command: `detox test`,
|
|
66
|
-
options: { cwd: projectRoot },
|
|
67
|
-
cache: true,
|
|
68
|
-
inputs: getInputs(namedInputs),
|
|
69
|
-
},
|
|
70
|
-
};
|
|
71
|
-
return targets;
|
|
72
|
-
}
|
|
73
|
-
function getInputs(namedInputs) {
|
|
74
|
-
return [
|
|
75
|
-
...('production' in namedInputs
|
|
76
|
-
? ['default', '^production']
|
|
77
|
-
: ['default', '^default']),
|
|
78
|
-
{
|
|
79
|
-
externalDependencies: ['detox'],
|
|
80
|
-
},
|
|
81
|
-
];
|
|
82
|
-
}
|
|
83
|
-
function normalizeOptions(options) {
|
|
84
|
-
options ??= {};
|
|
85
|
-
options.buildTargetName ??= 'build';
|
|
86
|
-
options.startTargetName ??= 'start';
|
|
87
|
-
options.testTargetName ??= 'test';
|
|
88
|
-
return options;
|
|
89
|
-
}
|