UNPKG

@nx/react

Version:

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

43 lines (42 loc) 1.24 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.setDefaults = setDefaults; const devkit_1 = require("@nx/devkit"); function setDefaults(host, options) { if (options.skipNxJson) { return; } const nxJson = (0, devkit_1.readNxJson)(host); if (options.rootProject) { nxJson.defaultProject = options.projectName; } nxJson.generators = nxJson.generators || {}; nxJson.generators['@nx/react'] = nxJson.generators['@nx/react'] || {}; const prev = { ...nxJson.generators['@nx/react'] }; const appDefaults = { babel: true, style: options.style, linter: options.linter, bundler: options.bundler, ...prev.application, }; const componentDefaults = { style: options.style, ...prev.component, }; const libDefaults = { style: options.style, linter: options.linter, ...prev.library, }; nxJson.generators = { ...nxJson.generators, '@nx/react': { ...prev, application: appDefaults, component: componentDefaults, library: libDefaults, }, }; (0, devkit_1.updateNxJson)(host, nxJson); }