UNPKG

@nx/expo

Version:

The Expo Plugin for Nx contains executors and generators for managing and developing an expo application within your workspace. For example, you can directly build for different target platforms as well as generate projects and publish your code.

47 lines (46 loc) 2.15 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) { await (0, project_name_and_root_utils_1.ensureRootProjectName)(options, 'application'); const { projectName, names: projectNames, projectRoot: appProjectRoot, importPath, } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, { name: options.name, projectType: 'application', directory: options.directory, }); const nxJson = (0, devkit_1.readNxJson)(host); const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' && nxJson.useInferencePlugins !== false; options.addPlugin ??= addPluginDefault; const { className } = (0, devkit_1.names)(projectName); const parsedTags = options.tags ? options.tags.split(',').map((s) => s.trim()) : []; const rootProject = appProjectRoot === '.'; const isTsSolutionSetup = (0, ts_solution_setup_1.isUsingTsSolutionSetup)(host); const appProjectName = !isTsSolutionSetup || options.name ? projectName : importPath; const useProjectJson = options.useProjectJson ?? !isTsSolutionSetup; const e2eProjectName = rootProject ? 'e2e' : `${appProjectName}-e2e`; const e2eProjectRoot = rootProject ? 'e2e' : `${appProjectRoot}-e2e`; return { ...options, unitTestRunner: options.unitTestRunner || 'jest', e2eTestRunner: options.e2eTestRunner || 'none', simpleName: projectNames.projectSimpleName, className, lowerCaseName: className.toLowerCase(), displayName: options.displayName || className, projectName: appProjectName, appProjectRoot, importPath, parsedTags, rootProject, e2eProjectName, e2eProjectRoot, isTsSolutionSetup, useProjectJson, }; }