UNPKG

@nx/remix

Version:

The Remix plugin for Nx contains executors and generators for managing Remix applications and libraries within an Nx workspace. It provides: - Integration with libraries such as Vitest, Jest, Playwright, Cypress, and Storybook. - Generators for applica

68 lines (67 loc) 2.67 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.remixLibraryGenerator = remixLibraryGenerator; exports.remixLibraryGeneratorInternal = remixLibraryGeneratorInternal; const devkit_1 = require("@nx/devkit"); const js_1 = require("@nx/js"); const react_1 = require("@nx/react"); const lib_1 = require("./lib"); const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup"); const sort_fields_1 = require("@nx/js/src/utils/package-json/sort-fields"); async function remixLibraryGenerator(tree, schema) { return remixLibraryGeneratorInternal(tree, { addPlugin: false, useProjectJson: true, ...schema, }); } async function remixLibraryGeneratorInternal(tree, schema) { const tasks = []; const options = await (0, lib_1.normalizeOptions)(tree, schema); if (options.isUsingTsSolutionConfig) { await (0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(tree, options.projectRoot); } const jsInitTask = await (0, js_1.initGenerator)(tree, { js: options.js, skipFormat: true, }); tasks.push(jsInitTask); const libGenTask = await (0, react_1.libraryGenerator)(tree, { directory: options.directory, name: options.name, style: options.style, unitTestRunner: options.unitTestRunner, tags: options.tags, importPath: options.importPath, skipFormat: true, skipTsConfig: false, linter: options.linter, component: true, buildable: options.buildable, bundler: options.bundler, addPlugin: options.addPlugin, useProjectJson: options.useProjectJson, }); tasks.push(libGenTask); if (options.unitTestRunner && options.unitTestRunner !== 'none') { const pkgInstallTask = (0, lib_1.addUnitTestingSetup)(tree, options); tasks.push(pkgInstallTask); } (0, lib_1.addTsconfigEntryPoints)(tree, options); if (options.bundler === 'rollup' || options.buildable) { (0, lib_1.updateBuildableConfig)(tree, options); } (0, ts_solution_setup_1.updateTsconfigFiles)(tree, options.projectRoot, 'tsconfig.lib.json', { jsx: 'react-jsx', module: 'esnext', moduleResolution: 'bundler', }, options.linter === 'eslint' ? ['eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs'] : undefined); (0, sort_fields_1.sortPackageJsonFields)(tree, options.projectRoot); if (!options.skipFormat) { await (0, devkit_1.formatFiles)(tree); } return (0, devkit_1.runTasksInSerial)(...tasks); } exports.default = remixLibraryGenerator;