UNPKG

@nx/detox

Version:

The Nx Plugin for Detox contains executors and generators for allowing your workspace to use the powerful Detox integration testing capabilities.

38 lines (37 loc) 1.85 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.normalizeOptions = normalizeOptions; const devkit_1 = require("@nx/devkit"); const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils"); const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup"); async function normalizeOptions(host, options) { const { projectName, projectRoot: e2eProjectRoot, importPath, } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, { name: options.e2eName, projectType: 'application', directory: options.e2eDirectory, }); const nxJson = (0, devkit_1.readNxJson)(host); const addPlugin = process.env.NX_ADD_PLUGINS !== 'false' && nxJson.useInferencePlugins !== false; options.addPlugin ??= addPlugin; const { fileName: appFileName, className: appClassName } = (0, devkit_1.names)(options.appName || options.appProject); const { root: appRoot } = (0, devkit_1.readProjectConfiguration)(host, options.appProject); const isUsingTsSolutionConfig = (0, ts_solution_setup_1.isUsingTsSolutionSetup)(host); const e2eProjectName = !isUsingTsSolutionConfig || options.e2eName ? projectName : importPath; // We default to generate a project.json file if the new setup is not being used const useProjectJson = options.useProjectJson ?? !isUsingTsSolutionConfig; return { ...options, appFileName, appClassName, appDisplayName: options.appDisplayName || appClassName, appExpoName: options.appDisplayName?.replace(/\s/g, '') || appClassName, appRoot, e2eProjectName, e2eProjectRoot, importPath, isUsingTsSolutionConfig, js: options.js ?? false, useProjectJson, }; }