@nx/expo
Version:
36 lines (35 loc) • 1.4 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.normalizeOptions = normalizeOptions;
const devkit_1 = require("@nx/devkit");
const internal_1 = require("@nx/devkit/internal");
const internal_2 = require("@nx/js/internal");
async function normalizeOptions(host, options) {
const { artifactName: name, fileName, fileExtension, fileExtensionType, filePath, directory, project: projectName, } = await (0, internal_1.determineArtifactNameAndDirectoryOptions)(host, {
name: options.name,
path: options.path,
allowedFileExtensions: ['js', 'jsx', 'ts', 'tsx'],
fileExtension: 'tsx',
});
const { className } = (0, devkit_1.names)(name);
const project = (0, devkit_1.getProjects)(host).get(projectName);
const { root, sourceRoot: projectSourceRoot, projectType } = project;
if (options.export &&
(0, internal_2.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,
fileExtension,
fileExtensionType,
filePath,
projectSourceRoot,
projectName,
projectRoot: root,
};
}