UNPKG

@nx/react-native

Version:

The Nx Plugin for React Native contains generators for managing React Native applications and libraries within an Nx workspace. It provides: -Integration with libraries such as Jest, Detox, and Storybook. -Scaffolding for creating buildable libraries th

37 lines (36 loc) 1.58 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.normalizeOptions = normalizeOptions; const devkit_1 = require("@nx/devkit"); const artifact_name_and_directory_utils_1 = require("@nx/devkit/src/generators/artifact-name-and-directory-utils"); const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup"); async function normalizeOptions(host, options) { const { artifactName: name, directory, fileName, filePath, fileExtension, fileExtensionType, project: projectName, } = await (0, artifact_name_and_directory_utils_1.determineArtifactNameAndDirectoryOptions)(host, { path: options.path, name: options.name, allowedFileExtensions: ['js', 'jsx', 'ts', 'tsx'], fileExtension: options.js ? 'js' : 'tsx', js: options.js, }); const project = (0, devkit_1.getProjects)(host).get(projectName); const { className } = (0, devkit_1.names)(name); const { root, sourceRoot: projectSourceRoot, projectType } = project; if (options.export && (0, ts_solution_setup_1.getProjectType)(host, root, projectType) === 'application') { devkit_1.logger.warn(`The "--export" option should not be used with applications and will do nothing.`); } options.classComponent = options.classComponent ?? false; return { ...options, name, directory, className, fileName, filePath, fileExtension, fileExtensionType, projectSourceRoot, projectName, projectRoot: root, }; }