@nx/detox 0.0.0-pr-22179-271588f

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.
Files changed (55) hide show
  1. package/.eslintrc.json +32 -0
  2. package/LICENSE +22 -0
  3. package/README.md +68 -0
  4. package/executors.json +14 -0
  5. package/generators.json +20 -0
  6. package/index.d.ts +2 -0
  7. package/index.js +7 -0
  8. package/migrations.json +130 -0
  9. package/package.json +49 -0
  10. package/plugin.d.ts +1 -0
  11. package/plugin.js +6 -0
  12. package/project.json +58 -0
  13. package/src/executors/build/build.impl.d.ts +7 -0
  14. package/src/executors/build/build.impl.js +56 -0
  15. package/src/executors/build/schema.json +23 -0
  16. package/src/executors/test/schema.json +170 -0
  17. package/src/executors/test/test.impl.d.ts +6 -0
  18. package/src/executors/test/test.impl.js +80 -0
  19. package/src/generators/application/application.d.ts +5 -0
  20. package/src/generators/application/application.js +37 -0
  21. package/src/generators/application/files/app/.babelrc.template +11 -0
  22. package/src/generators/application/files/app/.detoxrc.json.template +91 -0
  23. package/src/generators/application/files/app/jest.config.json.template +23 -0
  24. package/src/generators/application/files/app/src/app.spec.ts.template +11 -0
  25. package/src/generators/application/files/app/test-setup.ts.template +5 -0
  26. package/src/generators/application/files/app/tsconfig.e2e.json +10 -0
  27. package/src/generators/application/files/app/tsconfig.json +10 -0
  28. package/src/generators/application/lib/add-git-ignore-entry.d.ts +3 -0
  29. package/src/generators/application/lib/add-git-ignore-entry.js +15 -0
  30. package/src/generators/application/lib/add-linting.d.ts +3 -0
  31. package/src/generators/application/lib/add-linting.js +27 -0
  32. package/src/generators/application/lib/add-project.d.ts +3 -0
  33. package/src/generators/application/lib/add-project.js +48 -0
  34. package/src/generators/application/lib/create-files.d.ts +3 -0
  35. package/src/generators/application/lib/create-files.js +18 -0
  36. package/src/generators/application/lib/ensure-dependencies.d.ts +3 -0
  37. package/src/generators/application/lib/ensure-dependencies.js +18 -0
  38. package/src/generators/application/lib/get-targets.d.ts +51 -0
  39. package/src/generators/application/lib/get-targets.js +68 -0
  40. package/src/generators/application/lib/normalize-options.d.ts +11 -0
  41. package/src/generators/application/lib/normalize-options.js +32 -0
  42. package/src/generators/application/schema.json +72 -0
  43. package/src/generators/init/init.d.ts +6 -0
  44. package/src/generators/init/init.js +64 -0
  45. package/src/generators/init/schema.json +33 -0
  46. package/src/migrations/update-16-0-0/update-detoxrc-json.d.ts +10 -0
  47. package/src/migrations/update-16-0-0/update-detoxrc-json.js +66 -0
  48. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +2 -0
  49. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +9 -0
  50. package/src/migrations/update-16-1-4/update-detoxrc-json-expo.d.ts +8 -0
  51. package/src/migrations/update-16-1-4/update-detoxrc-json-expo.js +81 -0
  52. package/src/plugins/plugin.d.ts +8 -0
  53. package/src/plugins/plugin.js +89 -0
  54. package/src/utils/versions.d.ts +4 -0
  55. package/src/utils/versions.js +7 -0
package/.eslintrc.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "extends": "../../.eslintrc",
3
+ "rules": {},
4
+ "ignorePatterns": ["!**/*"],
5
+ "overrides": [
6
+ {
7
+ "files": [
8
+ "./package.json",
9
+ "./generators.json",
10
+ "./executors.json",
11
+ "./migrations.json"
12
+ ],
13
+ "parser": "jsonc-eslint-parser",
14
+ "rules": {
15
+ "@nx/nx-plugin-checks": "error"
16
+ }
17
+ },
18
+ {
19
+ "files": ["./package.json"],
20
+ "parser": "jsonc-eslint-parser",
21
+ "rules": {
22
+ "@nx/dependency-checks": [
23
+ "error",
24
+ {
25
+ "buildTargets": ["build-base"],
26
+ "ignoredDependencies": ["nx", "typescript", "detox"]
27
+ }
28
+ ]
29
+ }
30
+ }
31
+ ]
32
+ }
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ (The MIT License)
2
+
3
+ Copyright (c) 2017-2023 Narwhal Technologies Inc.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ 'Software'), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,68 @@
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>
7
+
8
+ <div style="text-align: center;">
9
+
10
+ [![CircleCI](https://circleci.com/gh/nrwl/nx.svg?style=svg)](https://circleci.com/gh/nrwl/nx)
11
+ [![License](https://img.shields.io/npm/l/@nx/workspace.svg?style=flat-square)]()
12
+ [![NPM Version](https://badge.fury.io/js/%40nrwl%2Fworkspace.svg)](https://www.npmjs.com/@nx/workspace)
13
+ [![Semantic Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=flat-square)]()
14
+ [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
15
+ [![Join the chat at https://gitter.im/nrwl-nx/community](https://badges.gitter.im/nrwl-nx/community.svg)](https://gitter.im/nrwl-nx/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
16
+ [![Join us on the Official Nx Discord Server](https://img.shields.io/discord/1143497901675401286?label=discord)](https://go.nx.dev/community)
17
+
18
+ </div>
19
+
20
+
21
+ <hr>
22
+
23
+ # Nx: Smart Monorepos · Fast CI
24
+
25
+ Nx is a build system with built-in tooling and advanced CI capabilities. It helps you maintain and scale monorepos, both locally and on CI.
26
+
27
+ This package is a [Detox plugin for Nx](https://nx.dev/detox/overview).
28
+
29
+ ## Getting Started
30
+
31
+ ### Creating an Nx Workspace
32
+
33
+ **Using `npx`**
34
+
35
+ ```bash
36
+ npx create-nx-workspace
37
+ ```
38
+
39
+ **Using `npm init`**
40
+
41
+ ```bash
42
+ npm init nx-workspace
43
+ ```
44
+
45
+ **Using `yarn create`**
46
+
47
+ ```bash
48
+ yarn create nx-workspace
49
+ ```
50
+
51
+ ### Adding Nx to an Existing Repository
52
+
53
+ Run:
54
+
55
+ ```bash
56
+ npx nx@latest init
57
+ ```
58
+
59
+ ## Documentation & Resources
60
+
61
+ - [Nx.Dev: Documentation, Guides, Tutorials](https://nx.dev)
62
+ - [Intro to Nx](https://nx.dev/getting-started/intro)
63
+ - [Official Nx YouTube Channel](https://www.youtube.com/@NxDevtools)
64
+ - [Blog Posts About Nx](https://blog.nrwl.io/nx/home)
65
+
66
+ <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 Monorepos · Fast CI"></a></p>
68
+
package/executors.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "executors": {
3
+ "build": {
4
+ "implementation": "./src/executors/build/build.impl",
5
+ "schema": "./src/executors/build/schema.json",
6
+ "description": "Run the command defined in build property of the specified configuration."
7
+ },
8
+ "test": {
9
+ "implementation": "./src/executors/test/test.impl",
10
+ "schema": "./src/executors/test/schema.json",
11
+ "description": "Initiating your detox test suite."
12
+ }
13
+ }
14
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "Nx Detox",
3
+ "version": "0.1",
4
+ "extends": ["@nx/workspace"],
5
+ "generators": {
6
+ "init": {
7
+ "factory": "./src/generators/init/init#detoxInitGeneratorInternal",
8
+ "schema": "./src/generators/init/schema.json",
9
+ "description": "Initialize the `@nrwl/detox` plugin.",
10
+ "hidden": true
11
+ },
12
+ "application": {
13
+ "factory": "./src/generators/application/application#detoxApplicationGeneratorInternal",
14
+ "schema": "./src/generators/application/schema.json",
15
+ "aliases": ["app"],
16
+ "x-type": "application",
17
+ "description": "Create a Detox application."
18
+ }
19
+ }
20
+ }
package/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export { detoxInitGenerator } from './src/generators/init/init';
2
+ export { detoxApplicationGenerator } from './src/generators/application/application';
package/index.js ADDED
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.detoxApplicationGenerator = exports.detoxInitGenerator = void 0;
4
+ var init_1 = require("./src/generators/init/init");
5
+ Object.defineProperty(exports, "detoxInitGenerator", { enumerable: true, get: function () { return init_1.detoxInitGenerator; } });
6
+ var application_1 = require("./src/generators/application/application");
7
+ Object.defineProperty(exports, "detoxApplicationGenerator", { enumerable: true, get: function () { return application_1.detoxApplicationGenerator; } });
@@ -0,0 +1,130 @@
1
+ {
2
+ "generators": {
3
+ "update-16-0-0-add-nx-packages": {
4
+ "cli": "nx",
5
+ "version": "16.0.0-beta.1",
6
+ "description": "Replace @nrwl/detox with @nx/detox",
7
+ "implementation": "./src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages"
8
+ },
9
+ "update-16-0-0-update-detoxrc": {
10
+ "cli": "nx",
11
+ "version": "16.0.0-beta.3",
12
+ "description": "Update .detoxrc.json and jest.config.json for detox 20",
13
+ "implementation": "./src/migrations/update-16-0-0/update-detoxrc-json"
14
+ },
15
+ "update-detoxrc-json-expo-16-1-4": {
16
+ "cli": "nx",
17
+ "version": "16.1.4-beta.0",
18
+ "description": "Update .detoxrc.json for expo",
19
+ "implementation": "./src/migrations/update-16-1-4/update-detoxrc-json-expo"
20
+ }
21
+ },
22
+ "packageJsonUpdates": {
23
+ "15.0.0": {
24
+ "version": "15.0.0-beta.0",
25
+ "packages": {
26
+ "detox": {
27
+ "version": "19.12.5",
28
+ "alwaysAddToPackageJson": false
29
+ }
30
+ }
31
+ },
32
+ "15.2.2": {
33
+ "version": "15.2.2-beta.0",
34
+ "packages": {
35
+ "detox": {
36
+ "version": "20.0.3",
37
+ "alwaysAddToPackageJson": false
38
+ }
39
+ }
40
+ },
41
+ "15.6.2": {
42
+ "version": "15.6.2-beta.0",
43
+ "packages": {
44
+ "detox": {
45
+ "version": "20.1.1",
46
+ "alwaysAddToPackageJson": false
47
+ }
48
+ }
49
+ },
50
+ "15.8.6": {
51
+ "version": "15.8.6-beta.0",
52
+ "packages": {
53
+ "detox": {
54
+ "version": "~20.5.0",
55
+ "alwaysAddToPackageJson": false
56
+ }
57
+ }
58
+ },
59
+ "16.0.0": {
60
+ "version": "16.0.0-beta.3",
61
+ "packages": {
62
+ "detox": {
63
+ "version": "~20.7.0",
64
+ "alwaysAddToPackageJson": false
65
+ }
66
+ }
67
+ },
68
+ "16.1.1": {
69
+ "version": "16.1.1-beta.0",
70
+ "packages": {
71
+ "detox": {
72
+ "version": "~20.8.0",
73
+ "alwaysAddToPackageJson": false
74
+ },
75
+ "@config-plugins/detox": {
76
+ "version": "~5.0.1",
77
+ "alwaysAddToPackageJson": false
78
+ }
79
+ }
80
+ },
81
+ "16.1.5": {
82
+ "version": "16.1.5-beta.0",
83
+ "packages": {
84
+ "detox": {
85
+ "version": "^20.9.0",
86
+ "alwaysAddToPackageJson": false
87
+ }
88
+ }
89
+ },
90
+ "16.6.0": {
91
+ "version": "16.6.0-beta.6",
92
+ "packages": {
93
+ "detox": {
94
+ "version": "^20.11.1",
95
+ "alwaysAddToPackageJson": false
96
+ },
97
+ "@config-plugins/detox": {
98
+ "version": "~6.0.0",
99
+ "alwaysAddToPackageJson": false
100
+ }
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
+ }
129
+ }
130
+ }
package/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "@nx/detox",
3
+ "version": "0.0.0-pr-22179-271588f",
4
+ "private": false,
5
+ "description": "The Nx Plugin for Detox contains executors and generators for allowing your workspace to use the powerful Detox integration testing capabilities.",
6
+ "keywords": [
7
+ "Monorepo",
8
+ "React",
9
+ "Web",
10
+ "Native",
11
+ "CLI",
12
+ "Detox"
13
+ ],
14
+ "homepage": "https://nx.dev",
15
+ "bugs": {
16
+ "url": "https://github.com/nrwl/nx/issues"
17
+ },
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "https://github.com/nrwl/nx.git",
21
+ "directory": "packages/detox"
22
+ },
23
+ "license": "MIT",
24
+ "author": "Victor Savkin",
25
+ "main": "./index.js",
26
+ "types": "index.d.ts",
27
+ "dependencies": {
28
+ "@nx/devkit": "0.0.0-pr-22179-271588f",
29
+ "@nx/jest": "0.0.0-pr-22179-271588f",
30
+ "@nx/js": "0.0.0-pr-22179-271588f",
31
+ "@nx/eslint": "0.0.0-pr-22179-271588f",
32
+ "@nx/react": "0.0.0-pr-22179-271588f",
33
+ "tslib": "^2.3.0",
34
+ "@nrwl/detox": "0.0.0-pr-22179-271588f"
35
+ },
36
+ "peerDependencies": {
37
+ "detox": "^20.9.0"
38
+ },
39
+ "executors": "./executors.json",
40
+ "ng-update": {
41
+ "requirements": {},
42
+ "migrations": "./migrations.json"
43
+ },
44
+ "generators": "./generators.json",
45
+ "publishConfig": {
46
+ "access": "public"
47
+ },
48
+ "type": "commonjs"
49
+ }
package/plugin.d.ts ADDED
@@ -0,0 +1 @@
1
+ export { createNodes, createDependencies, DetoxPluginOptions, } from './src/plugins/plugin';
package/plugin.js ADDED
@@ -0,0 +1,6 @@
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; } });
package/project.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "detox",
3
+ "$schema": "../../node_modules/nx/schemas/project-schema.json",
4
+ "sourceRoot": "packages/detox/src",
5
+ "projectType": "library",
6
+ "targets": {
7
+ "lint": {},
8
+ "test": {},
9
+ "build-base": {
10
+ "executor": "@nx/js:tsc",
11
+ "options": {
12
+ "assets": [
13
+ {
14
+ "input": "packages/detox",
15
+ "glob": "**/files/**",
16
+ "output": "/"
17
+ },
18
+ {
19
+ "input": "packages/detox",
20
+ "glob": "**/files/**/.gitkeep",
21
+ "output": "/"
22
+ },
23
+ {
24
+ "input": "packages/detox",
25
+ "glob": "**/files/**/.babelrc.template",
26
+ "output": "/"
27
+ },
28
+ {
29
+ "input": "packages/detox",
30
+ "glob": "**/files/**/.detoxrc.json.template",
31
+ "output": "/"
32
+ },
33
+ {
34
+ "input": "./packages/detox",
35
+ "glob": "**/*.json",
36
+ "ignore": ["**/tsconfig*.json"],
37
+ "output": "/"
38
+ },
39
+ {
40
+ "input": "",
41
+ "glob": "LICENSE",
42
+ "output": "/"
43
+ }
44
+ ]
45
+ }
46
+ },
47
+ "build": {
48
+ "executor": "nx:run-commands",
49
+ "outputs": ["{workspaceRoot}/build/packages/detox"],
50
+ "options": {
51
+ "command": "node ./scripts/copy-readme.js detox"
52
+ }
53
+ },
54
+ "add-extra-dependencies": {
55
+ "command": "node ./scripts/add-dependency-to-build.js detox @nrwl/detox"
56
+ }
57
+ }
58
+ }
@@ -0,0 +1,7 @@
1
+ import { ExecutorContext } from '@nx/devkit';
2
+ import { DetoxBuildOptions } from './schema';
3
+ export interface DetoxBuildOutput {
4
+ success: boolean;
5
+ }
6
+ export default function detoxBuildExecutor(options: DetoxBuildOptions, context: ExecutorContext): AsyncGenerator<DetoxBuildOutput>;
7
+ export declare function runCliBuild(workspaceRoot: string, projectRoot: string, options: DetoxBuildOptions): Promise<unknown>;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runCliBuild = void 0;
4
+ const path_1 = require("path");
5
+ const child_process_1 = require("child_process");
6
+ let childProcess;
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();
16
+ }
17
+ }
18
+ }
19
+ exports.default = detoxBuildExecutor;
20
+ function runCliBuild(workspaceRoot, projectRoot, options) {
21
+ return new Promise((resolve, reject) => {
22
+ childProcess = (0, child_process_1.fork)(require.resolve('detox/local-cli/cli.js'), ['build', ...createDetoxBuildOptions(options)], {
23
+ cwd: (0, path_1.resolve)(workspaceRoot, projectRoot),
24
+ env: process.env,
25
+ });
26
+ // Ensure the child process is killed when the parent exits
27
+ process.on('exit', () => childProcess.kill());
28
+ process.on('SIGTERM', () => childProcess.kill());
29
+ childProcess.on('error', (err) => {
30
+ reject(err);
31
+ });
32
+ childProcess.on('exit', (code) => {
33
+ if (code === 0) {
34
+ resolve(code);
35
+ }
36
+ else {
37
+ reject(code);
38
+ }
39
+ });
40
+ });
41
+ }
42
+ exports.runCliBuild = runCliBuild;
43
+ function createDetoxBuildOptions(options) {
44
+ return Object.keys(options).reduce((acc, k) => {
45
+ const v = options[k];
46
+ if (k === 'detoxConfiguration') {
47
+ acc.push('--configuration', v);
48
+ }
49
+ else if (k === 'configPath') {
50
+ acc.push('--config-path', v);
51
+ }
52
+ else
53
+ acc.push(`--${k}`, options[k]);
54
+ return acc;
55
+ }, []);
56
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "version": 2,
3
+ "outputCapture": "direct-nodejs",
4
+ "title": "Run detox build",
5
+ "description": "Run detox build options.",
6
+ "type": "object",
7
+ "cli": "nx",
8
+ "properties": {
9
+ "detoxConfiguration": {
10
+ "type": "string",
11
+ "description": "Select a device configuration from your defined configurations, if not supplied, and there's only one configuration, detox will default to it.",
12
+ "alias": "C"
13
+ },
14
+ "configPath": {
15
+ "type": "string",
16
+ "description": "Specify Detox config file path. If not supplied, detox searches for `.detoxrc[.js]` or `detox` section in `package.json`.",
17
+ "alias": "cp",
18
+ "x-completion-type": "file",
19
+ "x-completion-glob": ".detoxrc?(.js)"
20
+ }
21
+ },
22
+ "required": []
23
+ }