@nx/detox 16.8.0-beta.0 → 16.8.0-beta.2

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/generators.json CHANGED
@@ -25,7 +25,7 @@
25
25
  "hidden": true
26
26
  },
27
27
  "application": {
28
- "factory": "./src/generators/application/application#detoxApplicationGenerator",
28
+ "factory": "./src/generators/application/application#detoxApplicationGeneratorInternal",
29
29
  "schema": "./src/generators/application/schema.json",
30
30
  "aliases": ["app"],
31
31
  "x-type": "application",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/detox",
3
- "version": "16.8.0-beta.0",
3
+ "version": "16.8.0-beta.2",
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.0",
29
- "@nx/devkit": "16.8.0-beta.0",
30
- "@nx/jest": "16.8.0-beta.0",
31
- "@nx/js": "16.8.0-beta.0",
32
- "@nx/linter": "16.8.0-beta.0",
33
- "@nx/react": "16.8.0-beta.0",
28
+ "@nrwl/detox": "16.8.0-beta.2",
29
+ "@nx/devkit": "16.8.0-beta.2",
30
+ "@nx/jest": "16.8.0-beta.2",
31
+ "@nx/js": "16.8.0-beta.2",
32
+ "@nx/linter": "16.8.0-beta.2",
33
+ "@nx/react": "16.8.0-beta.2",
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": "818352404283c1d34ab303d91b3bd16474f54916"
49
+ "gitHead": "9bcc04742f9e1516d8c1ddbfb1907770c347876f"
50
50
  }
@@ -1,5 +1,6 @@
1
1
  import { Tree } from '@nx/devkit';
2
2
  import { Schema } from './schema';
3
3
  export declare function detoxApplicationGenerator(host: Tree, schema: Schema): Promise<import("@nx/devkit").GeneratorCallback>;
4
+ export declare function detoxApplicationGeneratorInternal(host: Tree, schema: Schema): Promise<import("@nx/devkit").GeneratorCallback>;
4
5
  export default detoxApplicationGenerator;
5
6
  export declare const detoxApplicationSchematic: (generatorOptions: Schema) => (tree: any, context: any) => Promise<any>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.detoxApplicationSchematic = exports.detoxApplicationGenerator = void 0;
3
+ exports.detoxApplicationSchematic = exports.detoxApplicationGeneratorInternal = exports.detoxApplicationGenerator = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const devkit_1 = require("@nx/devkit");
6
6
  const init_1 = require("../init/init");
@@ -11,7 +11,13 @@ const create_files_1 = require("./lib/create-files");
11
11
  const normalize_options_1 = require("./lib/normalize-options");
12
12
  function detoxApplicationGenerator(host, schema) {
13
13
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
14
- const options = (0, normalize_options_1.normalizeOptions)(host, schema);
14
+ return yield detoxApplicationGeneratorInternal(host, Object.assign({ projectNameAndRootFormat: 'derived' }, schema));
15
+ });
16
+ }
17
+ exports.detoxApplicationGenerator = detoxApplicationGenerator;
18
+ function detoxApplicationGeneratorInternal(host, schema) {
19
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
20
+ const options = yield (0, normalize_options_1.normalizeOptions)(host, schema);
15
21
  const initTask = yield (0, init_1.default)(host, Object.assign(Object.assign({}, options), { skipFormat: true }));
16
22
  (0, create_files_1.createFiles)(host, options);
17
23
  (0, add_project_1.addProject)(host, options);
@@ -23,6 +29,6 @@ function detoxApplicationGenerator(host, schema) {
23
29
  return (0, devkit_1.runTasksInSerial)(initTask, lintingTask);
24
30
  });
25
31
  }
26
- exports.detoxApplicationGenerator = detoxApplicationGenerator;
32
+ exports.detoxApplicationGeneratorInternal = detoxApplicationGeneratorInternal;
27
33
  exports.default = detoxApplicationGenerator;
28
34
  exports.detoxApplicationSchematic = (0, devkit_1.convertNxGenerator)(detoxApplicationGenerator);
@@ -5,6 +5,7 @@ const tslib_1 = require("tslib");
5
5
  const linter_1 = require("@nx/linter");
6
6
  const devkit_1 = require("@nx/devkit");
7
7
  const react_1 = require("@nx/react");
8
+ const eslint_file_1 = require("@nx/linter/src/generators/utils/eslint-file");
8
9
  function addLinting(host, options) {
9
10
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
10
11
  if (options.linter === linter_1.Linter.None) {
@@ -19,7 +20,9 @@ function addLinting(host, options) {
19
20
  eslintFilePatterns: [`${options.e2eProjectRoot}/**/*.{ts,tsx,js,jsx}`],
20
21
  skipFormat: true,
21
22
  });
22
- (0, devkit_1.updateJson)(host, (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, '.eslintrc.json'), react_1.extendReactEslintJson);
23
+ if ((0, eslint_file_1.isEslintConfigSupported)(host)) {
24
+ (0, eslint_file_1.addExtendsToLintConfig)(host, options.e2eProjectRoot, 'plugin:@nx/react');
25
+ }
23
26
  const installTask = (0, devkit_1.addDependenciesToPackageJson)(host, react_1.extraEslintDependencies.dependencies, react_1.extraEslintDependencies.devDependencies);
24
27
  return (0, devkit_1.runTasksInSerial)(lintTask, installTask);
25
28
  });
@@ -20,13 +20,13 @@ function getTargets(options) {
20
20
  ? (0, get_targets_1.reactNativeBuildTarget)('ios.sim')
21
21
  : (0, get_targets_1.expoBuildTarget)('ios.sim')));
22
22
  targets['test-ios'] = Object.assign({ executor: '@nx/detox:test' }, (options.framework === 'react-native'
23
- ? (0, get_targets_1.reactNativeTestTarget)('ios.sim', options.e2eName)
24
- : (0, get_targets_1.expoTestTarget)('ios.sim', options.e2eName)));
23
+ ? (0, get_targets_1.reactNativeTestTarget)('ios.sim', options.e2eProjectName)
24
+ : (0, get_targets_1.expoTestTarget)('ios.sim', options.e2eProjectName)));
25
25
  targets['build-android'] = Object.assign({ executor: '@nx/detox:build' }, (options.framework === 'react-native'
26
26
  ? (0, get_targets_1.reactNativeBuildTarget)('android.emu')
27
27
  : (0, get_targets_1.expoBuildTarget)('android.emu')));
28
28
  targets['test-android'] = Object.assign({ executor: '@nx/detox:test' }, (options.framework === 'react-native'
29
- ? (0, get_targets_1.reactNativeTestTarget)('android.emu', options.e2eName)
30
- : (0, get_targets_1.expoTestTarget)('android.emu', options.e2eName)));
29
+ ? (0, get_targets_1.reactNativeTestTarget)('android.emu', options.e2eProjectName)
30
+ : (0, get_targets_1.expoTestTarget)('android.emu', options.e2eProjectName)));
31
31
  return targets;
32
32
  }
@@ -6,13 +6,6 @@ export interface NormalizedSchema extends Schema {
6
6
  appExpoName: string;
7
7
  appRoot: string;
8
8
  e2eProjectName: string;
9
- e2eProjectDirectory: string;
10
9
  e2eProjectRoot: string;
11
10
  }
12
- /**
13
- * if options.e2eName = 'my-app-e2e' with no options.directory
14
- * e2eProjectName = 'my-app', e2eProjectRoot = 'apps/my-app'
15
- * if options.e2eName = 'my-app' with options.e2eDirectory = 'my-dir'
16
- * e2eProjectName = 'my-dir-my-app', e2eProjectRoot = 'apps/my-dir/my-apps'
17
- */
18
- export declare function normalizeOptions(host: Tree, options: Schema): NormalizedSchema;
11
+ export declare function normalizeOptions(host: Tree, options: Schema): Promise<NormalizedSchema>;
@@ -1,33 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.normalizeOptions = void 0;
4
+ const tslib_1 = require("tslib");
4
5
  const devkit_1 = require("@nx/devkit");
5
- /**
6
- * if options.e2eName = 'my-app-e2e' with no options.directory
7
- * e2eProjectName = 'my-app', e2eProjectRoot = 'apps/my-app'
8
- * if options.e2eName = 'my-app' with options.e2eDirectory = 'my-dir'
9
- * e2eProjectName = 'my-dir-my-app', e2eProjectRoot = 'apps/my-dir/my-apps'
10
- */
6
+ const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
11
7
  function normalizeOptions(host, options) {
12
8
  var _a;
13
- const { appsDir } = (0, devkit_1.getWorkspaceLayout)(host);
14
- const e2eFileName = (0, devkit_1.names)(options.e2eName).fileName;
15
- const e2eDirectoryFileName = options.e2eDirectory
16
- ? (0, devkit_1.names)(options.e2eDirectory).fileName
17
- : '';
18
- const e2eProjectName = (e2eDirectoryFileName
19
- ? `${e2eDirectoryFileName}-${e2eFileName}`
20
- : e2eFileName).replace(/\//g, '-');
21
- const e2eProjectDirectory = e2eDirectoryFileName
22
- ? (0, devkit_1.joinPathFragments)(appsDir, e2eDirectoryFileName)
23
- : appsDir;
24
- const e2eProjectRoot = (0, devkit_1.joinPathFragments)(e2eProjectDirectory, e2eFileName);
25
- const { fileName: appFileName, className: appClassName } = (0, devkit_1.names)(options.appName || options.appProject);
26
- const project = (0, devkit_1.getProjects)(host).get(options.appProject);
27
- const appRoot = (project === null || project === void 0 ? void 0 : project.root) || (0, devkit_1.joinPathFragments)(e2eProjectDirectory, appFileName);
28
- return Object.assign(Object.assign({}, options), { appFileName,
29
- appClassName, appDisplayName: options.appDisplayName || appClassName, appExpoName: ((_a = options.appDisplayName) === null || _a === void 0 ? void 0 : _a.replace(/\s/g, '')) || appClassName, appRoot, e2eName: e2eFileName, e2eProjectName,
30
- e2eProjectDirectory,
31
- e2eProjectRoot });
9
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
10
+ const { projectName: e2eProjectName, projectRoot: e2eProjectRoot } = yield (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
11
+ name: options.e2eName,
12
+ projectType: 'application',
13
+ directory: options.e2eDirectory,
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 });
22
+ });
32
23
  }
33
24
  exports.normalizeOptions = normalizeOptions;
@@ -19,7 +19,8 @@
19
19
  "$source": "argv",
20
20
  "index": 0
21
21
  },
22
- "x-prompt": "What name would you like to use for the E2E project?"
22
+ "x-prompt": "What name would you like to use for the E2E project?",
23
+ "pattern": "^[a-zA-Z][^:]*$"
23
24
  },
24
25
  "appName": {
25
26
  "type": "string",
@@ -39,6 +40,11 @@
39
40
  "type": "string",
40
41
  "description": "A directory where the project is placed relative to apps directory."
41
42
  },
43
+ "projectNameAndRootFormat": {
44
+ "description": "Whether to generate the project name and root directory as provided (`as-provided`) or generate them composing their values and taking the configured layout into account (`derived`).",
45
+ "type": "string",
46
+ "enum": ["as-provided", "derived"]
47
+ },
42
48
  "linter": {
43
49
  "description": "The tool to use for running lint checks.",
44
50
  "type": "string",