@nx/detox 20.3.2 → 20.4.0-beta.1
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 +6 -6
- package/src/generators/application/application.js +15 -0
- package/src/generators/application/lib/create-files.js +24 -2
- package/src/generators/application/lib/normalize-options.d.ts +1 -0
- package/src/generators/application/lib/normalize-options.js +2 -0
- package/src/generators/init/init.js +10 -0
- package/src/plugins/plugin.d.ts +2 -0
- package/src/plugins/plugin.js +3 -0
- /package/src/generators/application/files/{app/tsconfig.e2e.json → non-ts-solution/tsconfig.e2e.json.template} +0 -0
- /package/src/generators/application/files/{app/tsconfig.json → non-ts-solution/tsconfig.json.template} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/detox",
|
|
3
|
-
"version": "20.
|
|
3
|
+
"version": "20.4.0-beta.1",
|
|
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": [
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
"main": "./index",
|
|
28
28
|
"types": "index.d.ts",
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@nx/devkit": "20.
|
|
31
|
-
"@nx/jest": "20.
|
|
32
|
-
"@nx/js": "20.
|
|
33
|
-
"@nx/eslint": "20.
|
|
34
|
-
"@nx/react": "20.
|
|
30
|
+
"@nx/devkit": "20.4.0-beta.1",
|
|
31
|
+
"@nx/jest": "20.4.0-beta.1",
|
|
32
|
+
"@nx/js": "20.4.0-beta.1",
|
|
33
|
+
"@nx/eslint": "20.4.0-beta.1",
|
|
34
|
+
"@nx/react": "20.4.0-beta.1",
|
|
35
35
|
"tslib": "^2.3.0"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
@@ -11,6 +11,8 @@ const add_project_1 = require("./lib/add-project");
|
|
|
11
11
|
const create_files_1 = require("./lib/create-files");
|
|
12
12
|
const normalize_options_1 = require("./lib/normalize-options");
|
|
13
13
|
const ensure_dependencies_1 = require("./lib/ensure-dependencies");
|
|
14
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
15
|
+
const sort_fields_1 = require("@nx/js/src/utils/package-json/sort-fields");
|
|
14
16
|
async function detoxApplicationGenerator(host, schema) {
|
|
15
17
|
return await detoxApplicationGeneratorInternal(host, {
|
|
16
18
|
addPlugin: false,
|
|
@@ -31,6 +33,19 @@ async function detoxApplicationGeneratorInternal(host, schema) {
|
|
|
31
33
|
(0, add_git_ignore_entry_1.addGitIgnoreEntry)(host, options);
|
|
32
34
|
const lintingTask = await (0, add_linting_1.addLinting)(host, options);
|
|
33
35
|
const depsTask = (0, ensure_dependencies_1.ensureDependencies)(host, options);
|
|
36
|
+
(0, ts_solution_setup_1.updateTsconfigFiles)(host, options.e2eProjectRoot, 'tsconfig.json', {
|
|
37
|
+
module: 'esnext',
|
|
38
|
+
moduleResolution: 'bundler',
|
|
39
|
+
outDir: 'out-tsc/detox',
|
|
40
|
+
allowJs: true,
|
|
41
|
+
types: ['node', 'jest', 'detox'],
|
|
42
|
+
}, options.linter === 'eslint'
|
|
43
|
+
? ['eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs']
|
|
44
|
+
: undefined);
|
|
45
|
+
if (options.isUsingTsSolutionConfig) {
|
|
46
|
+
(0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(host, options.e2eProjectRoot);
|
|
47
|
+
}
|
|
48
|
+
(0, sort_fields_1.sortPackageJsonFields)(host, options.e2eProjectRoot);
|
|
34
49
|
if (!options.skipFormat) {
|
|
35
50
|
await (0, devkit_1.formatFiles)(host);
|
|
36
51
|
}
|
|
@@ -5,12 +5,34 @@ 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
|
+
const offsetFromRoot = (0, devkit_1.offsetFromRoot)(options.e2eProjectRoot);
|
|
9
|
+
const rootTsConfigPath = (0, js_1.getRelativePathToRootTsConfig)(host, options.e2eProjectRoot);
|
|
8
10
|
(0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, '../files/app'), options.e2eProjectRoot, {
|
|
9
11
|
...options,
|
|
10
12
|
exec: (0, devkit_1.getPackageManagerCommand)((0, devkit_1.detectPackageManager)(host.root)).exec,
|
|
11
|
-
offsetFromRoot
|
|
12
|
-
rootTsConfigPath
|
|
13
|
+
offsetFromRoot,
|
|
14
|
+
rootTsConfigPath,
|
|
13
15
|
});
|
|
16
|
+
if (options.isUsingTsSolutionConfig) {
|
|
17
|
+
(0, devkit_1.writeJson)(host, (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'tsconfig.json'), {
|
|
18
|
+
extends: `${offsetFromRoot}tsconfig.base.json`,
|
|
19
|
+
compilerOptions: {
|
|
20
|
+
sourceMap: false,
|
|
21
|
+
outDir: 'out-tsc/detox',
|
|
22
|
+
allowJs: true,
|
|
23
|
+
types: ['node', 'jest', 'detox'],
|
|
24
|
+
},
|
|
25
|
+
include: ['src/**/*.ts', 'src/**/*.js'],
|
|
26
|
+
exclude: ['out-tsc', 'test-output'],
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
(0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, '../files/non-ts-solution'), options.e2eProjectRoot, {
|
|
31
|
+
...options,
|
|
32
|
+
offsetFromRoot,
|
|
33
|
+
rootTsConfigPath,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
14
36
|
if (options.js) {
|
|
15
37
|
(0, devkit_1.toJS)(host);
|
|
16
38
|
}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.normalizeOptions = normalizeOptions;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
|
|
6
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
6
7
|
async function normalizeOptions(host, options) {
|
|
7
8
|
const { projectName: e2eProjectName, projectRoot: e2eProjectRoot } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
|
|
8
9
|
name: options.e2eName,
|
|
@@ -25,5 +26,6 @@ async function normalizeOptions(host, options) {
|
|
|
25
26
|
e2eName: e2eProjectName,
|
|
26
27
|
e2eProjectName,
|
|
27
28
|
e2eProjectRoot,
|
|
29
|
+
isUsingTsSolutionConfig: (0, ts_solution_setup_1.isUsingTsSolutionSetup)(host),
|
|
28
30
|
};
|
|
29
31
|
}
|
|
@@ -25,6 +25,16 @@ async function detoxInitGeneratorInternal(host, schema) {
|
|
|
25
25
|
buildTargetName: ['build', 'detox:build', 'detox-build'],
|
|
26
26
|
startTargetName: ['start', 'detox:start', 'detox-start'],
|
|
27
27
|
testTargetName: ['test', 'detox:test', 'detox-test'],
|
|
28
|
+
buildDepsTargetName: [
|
|
29
|
+
'build-deps',
|
|
30
|
+
'detox:build-deps',
|
|
31
|
+
'detox-build-deps',
|
|
32
|
+
],
|
|
33
|
+
watchDepsTargetName: [
|
|
34
|
+
'watch-deps',
|
|
35
|
+
'detox:watch-deps',
|
|
36
|
+
'detox-watch-deps',
|
|
37
|
+
],
|
|
28
38
|
}, schema.updatePackageScripts);
|
|
29
39
|
}
|
|
30
40
|
if (!schema.skipFormat) {
|
package/src/plugins/plugin.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ export interface DetoxPluginOptions {
|
|
|
3
3
|
buildTargetName?: string;
|
|
4
4
|
startTargetName?: string;
|
|
5
5
|
testTargetName?: string;
|
|
6
|
+
buildDepsTargetName?: string;
|
|
7
|
+
watchDepsTargetName?: string;
|
|
6
8
|
}
|
|
7
9
|
export declare const createNodesV2: CreateNodesV2<DetoxPluginOptions>;
|
|
8
10
|
export declare const createNodes: CreateNodes<DetoxPluginOptions>;
|
package/src/plugins/plugin.js
CHANGED
|
@@ -9,6 +9,8 @@ const fs_1 = require("fs");
|
|
|
9
9
|
const calculate_hash_for_create_nodes_1 = require("@nx/devkit/src/utils/calculate-hash-for-create-nodes");
|
|
10
10
|
const cache_directory_1 = require("nx/src/utils/cache-directory");
|
|
11
11
|
const devkit_internals_1 = require("nx/src/devkit-internals");
|
|
12
|
+
const util_1 = require("@nx/js/src/plugins/typescript/util");
|
|
13
|
+
const pmc = (0, devkit_1.getPackageManagerCommand)();
|
|
12
14
|
function readTargetsCache(cachePath) {
|
|
13
15
|
return (0, fs_1.existsSync)(cachePath) ? (0, devkit_1.readJsonFile)(cachePath) : {};
|
|
14
16
|
}
|
|
@@ -77,6 +79,7 @@ function buildDetoxTargets(projectRoot, options, context) {
|
|
|
77
79
|
inputs: getInputs(namedInputs),
|
|
78
80
|
},
|
|
79
81
|
};
|
|
82
|
+
(0, util_1.addBuildAndWatchDepsTargets)(context.workspaceRoot, projectRoot, targets, options, pmc);
|
|
80
83
|
return targets;
|
|
81
84
|
}
|
|
82
85
|
function getInputs(namedInputs) {
|
|
File without changes
|
|
File without changes
|