@nx/react 16.4.0-beta.1 → 16.4.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/migrations.json CHANGED
@@ -890,6 +890,49 @@
890
890
  "alwaysAddToPackageJson": false
891
891
  }
892
892
  }
893
+ },
894
+ "16.4.0-beta.4": {
895
+ "version": "16.4.0-beta.4",
896
+ "packages": {
897
+ "stylus": {
898
+ "version": "^0.59.0",
899
+ "alwaysAddToPackageJson": false
900
+ }
901
+ }
902
+ },
903
+ "16.4.0-beta.7": {
904
+ "version": "16.4.0-beta.7",
905
+ "packages": {
906
+ "@types/react": {
907
+ "version": "18.2.12",
908
+ "alwaysAddToPackageJson": false
909
+ },
910
+ "@types/react-dom": {
911
+ "version": "18.2.5",
912
+ "alwaysAddToPackageJson": false
913
+ },
914
+ "@types/react-is": {
915
+ "version": "18.2.0",
916
+ "alwaysAddToPackageJson": false
917
+ }
918
+ }
919
+ },
920
+ "16.4.0-beta.8": {
921
+ "version": "16.4.0-beta.8",
922
+ "packages": {
923
+ "@emotion/styled": {
924
+ "version": "11.11.0",
925
+ "alwaysAddToPackageJson": false
926
+ },
927
+ "@emotion/react": {
928
+ "version": "11.11.1",
929
+ "alwaysAddToPackageJson": false
930
+ },
931
+ "@emotion/babel-plugin": {
932
+ "version": "11.11.0",
933
+ "alwaysAddToPackageJson": false
934
+ }
935
+ }
893
936
  }
894
937
  }
895
938
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/react",
3
- "version": "16.4.0-beta.1",
3
+ "version": "16.4.0-beta.10",
4
4
  "private": false,
5
5
  "description": "The React plugin for Nx contains executors and generators for managing React applications and libraries within an Nx workspace. It provides:\n\n\n- Integration with libraries such as Jest, Cypress, and Storybook.\n\n- Generators for applications, libraries, components, hooks, and more.\n\n- Library build support for publishing packages to npm or other registries.\n\n- Utilities for automatic workspace refactoring.",
6
6
  "repository": {
@@ -31,11 +31,11 @@
31
31
  "migrations": "./migrations.json"
32
32
  },
33
33
  "dependencies": {
34
- "@nrwl/react": "16.4.0-beta.1",
35
- "@nx/devkit": "16.4.0-beta.1",
36
- "@nx/js": "16.4.0-beta.1",
37
- "@nx/linter": "16.4.0-beta.1",
38
- "@nx/web": "16.4.0-beta.1",
34
+ "@nrwl/react": "16.4.0-beta.10",
35
+ "@nx/devkit": "16.4.0-beta.10",
36
+ "@nx/js": "16.4.0-beta.10",
37
+ "@nx/linter": "16.4.0-beta.10",
38
+ "@nx/web": "16.4.0-beta.10",
39
39
  "@phenomnomnominal/tsquery": "~5.0.1",
40
40
  "@svgr/webpack": "^8.0.1",
41
41
  "chalk": "^4.1.0",
@@ -46,5 +46,5 @@
46
46
  "access": "public"
47
47
  },
48
48
  "types": "./index.d.ts",
49
- "gitHead": "1c4fb934b607f0d93bb23bff2cf0f39b31a8fa43"
49
+ "gitHead": "d2bde0605c692a023bc9c28686f3a3037bbd56d3"
50
50
  }
@@ -8,6 +8,7 @@ const path_1 = require("path");
8
8
  const webpack_1 = require("webpack");
9
9
  const merge_plugins_1 = require("./merge-plugins");
10
10
  const with_react_1 = require("../with-react");
11
+ const fs_1 = require("fs");
11
12
  // This is shamelessly taken from CRA and modified for NX use
12
13
  // https://github.com/facebook/create-react-app/blob/4784997f0682e75eb32a897b4ffe34d735912e6c/packages/react-scripts/config/env.js#L71
13
14
  function getClientEnvironment(mode) {
@@ -44,6 +45,67 @@ function getClientEnvironment(mode) {
44
45
  }
45
46
  const core = (prev, options) => (Object.assign(Object.assign({}, prev), { disableWebpackDefaults: true }));
46
47
  exports.core = core;
48
+ const getProjectData = (storybookOptions) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
49
+ const fallbackData = {
50
+ workspaceRoot: storybookOptions.configDir,
51
+ projectRoot: '',
52
+ sourceRoot: '',
53
+ };
54
+ // Edge-case: not running from Nx
55
+ if (!process.env.NX_WORKSPACE_ROOT)
56
+ return fallbackData;
57
+ const projectGraph = yield (0, devkit_1.createProjectGraphAsync)();
58
+ const projectNode = projectGraph.nodes[process.env.NX_TASK_TARGET_PROJECT];
59
+ return projectNode
60
+ ? {
61
+ workspaceRoot: process.env.NX_WORKSPACE_ROOT,
62
+ projectRoot: projectNode.data.root,
63
+ sourceRoot: projectNode.data.sourceRoot,
64
+ projectNode,
65
+ }
66
+ : // Edge-case: missing project node
67
+ fallbackData;
68
+ });
69
+ const fixBabelConfigurationIfNeeded = (webpackConfig, projectData) => {
70
+ if (!projectData.projectNode)
71
+ return;
72
+ const isUsingBabelUpwardRootMode = Object.keys(projectData.projectNode.data.targets).find((k) => {
73
+ var _a;
74
+ const targetConfig = projectData.projectNode.data.targets[k];
75
+ return ((targetConfig.executor === '@nx/webpack:webpack' ||
76
+ targetConfig.executor === '@nrwl/webpack:webpack') &&
77
+ ((_a = targetConfig.options) === null || _a === void 0 ? void 0 : _a.babelUpwardRootMode));
78
+ });
79
+ if (isUsingBabelUpwardRootMode)
80
+ return;
81
+ let babelrcPath;
82
+ for (const ext of ['', '.json', '.js', '.cjs', '.mjs', '.cts']) {
83
+ const candidate = (0, path_1.join)(projectData.workspaceRoot, projectData.projectRoot, `.babelrc${ext}`);
84
+ if ((0, fs_1.existsSync)(candidate)) {
85
+ babelrcPath = candidate;
86
+ break;
87
+ }
88
+ }
89
+ // Unexpected setup, skip.
90
+ if (!babelrcPath)
91
+ return;
92
+ let babelRuleItem;
93
+ for (const rule of webpackConfig.module.rules) {
94
+ if (typeof rule === 'string')
95
+ continue;
96
+ if (!Array.isArray(rule.use))
97
+ continue;
98
+ for (const item of rule.use) {
99
+ if (typeof item !== 'string' && item['loader'].includes('babel-loader')) {
100
+ babelRuleItem = item;
101
+ break;
102
+ }
103
+ }
104
+ }
105
+ if (babelRuleItem) {
106
+ babelRuleItem.options.configFile = babelrcPath;
107
+ }
108
+ };
47
109
  const webpack = (storybookWebpackConfig = {}, options) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
48
110
  var _a, _b, _c, _d, _e, _f;
49
111
  devkit_1.logger.info('=> Loading Nx React Storybook Addon from "@nx/react/plugins/storybook"');
@@ -57,9 +119,9 @@ const webpack = (storybookWebpackConfig = {}, options) => tslib_1.__awaiter(void
57
119
  }
58
120
  const { withNx, withWeb } = require('@nx/webpack');
59
121
  const tsconfigPath = (0, path_1.join)(options.configDir, 'tsconfig.json');
60
- const builderOptions = Object.assign(Object.assign({}, options), { root: options.configDir,
61
- // These are blank because root is the absolute path to .storybook folder
62
- projectRoot: '', sourceRoot: '', fileReplacements: [], sourceMap: true, styles: (_a = options.styles) !== null && _a !== void 0 ? _a : [], optimization: {}, tsConfig: tsconfigPath, extractCss: storybookWebpackConfig.mode === 'production', target: 'web' });
122
+ const projectData = yield getProjectData(options);
123
+ fixBabelConfigurationIfNeeded(storybookWebpackConfig, projectData);
124
+ const builderOptions = Object.assign(Object.assign({}, options), { root: projectData.workspaceRoot, projectRoot: projectData.projectRoot, sourceRoot: projectData.sourceRoot, fileReplacements: [], sourceMap: true, styles: (_a = options.styles) !== null && _a !== void 0 ? _a : [], optimization: {}, tsConfig: tsconfigPath, extractCss: storybookWebpackConfig.mode === 'production', target: 'web' });
63
125
  // ESM build for modern browsers.
64
126
  let baseWebpackConfig = {};
65
127
  const configure = (0, config_1.composePluginsSync)(withNx({ skipTypeChecking: true }), withWeb(), (0, with_react_1.withReact)());
@@ -21,6 +21,7 @@ const install_common_dependencies_1 = require("./lib/install-common-dependencies
21
21
  const create_ts_config_1 = require("../../utils/create-ts-config");
22
22
  const add_swc_dependencies_1 = require("@nx/js/src/utils/swc/add-swc-dependencies");
23
23
  const chalk = require("chalk");
24
+ const show_possible_warnings_1 = require("./lib/show-possible-warnings");
24
25
  function addLinting(host, options) {
25
26
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
26
27
  const tasks = [];
@@ -42,9 +43,7 @@ function addLinting(host, options) {
42
43
  tasks.push(lintTask);
43
44
  (0, devkit_1.updateJson)(host, (0, devkit_1.joinPathFragments)(options.appProjectRoot, '.eslintrc.json'), lint_1.extendReactEslintJson);
44
45
  if (!options.skipPackageJson) {
45
- const installTask = yield (0, devkit_1.addDependenciesToPackageJson)(host, lint_1.extraEslintDependencies.dependencies, Object.assign(Object.assign({}, lint_1.extraEslintDependencies.devDependencies), (options.compiler === 'swc'
46
- ? { 'swc-loader': versions_1.swcLoaderVersion }
47
- : {})));
46
+ const installTask = yield (0, devkit_1.addDependenciesToPackageJson)(host, lint_1.extraEslintDependencies.dependencies, lint_1.extraEslintDependencies.devDependencies);
48
47
  const addSwcTask = (0, add_swc_dependencies_1.addSwcDependencies)(host);
49
48
  tasks.push(installTask, addSwcTask);
50
49
  }
@@ -56,7 +55,8 @@ function applicationGenerator(host, schema) {
56
55
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
57
56
  const tasks = [];
58
57
  const options = (0, normalize_options_1.normalizeOptions)(host, schema);
59
- const initTask = yield (0, init_1.default)(host, Object.assign(Object.assign({}, options), { skipFormat: true, skipBabelConfig: options.bundler === 'vite', skipHelperLibs: options.bundler === 'vite' }));
58
+ (0, show_possible_warnings_1.showPossibleWarnings)(host, options);
59
+ const initTask = yield (0, init_1.default)(host, Object.assign(Object.assign({}, options), { skipFormat: true, skipHelperLibs: options.bundler === 'vite' }));
60
60
  tasks.push(initTask);
61
61
  if (!options.rootProject) {
62
62
  (0, create_ts_config_1.extractTsConfigBase)(host);
@@ -4,25 +4,32 @@ exports.installCommonDependencies = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const versions_1 = require("../../../utils/versions");
6
6
  function installCommonDependencies(host, options) {
7
- let devDependencies = null;
7
+ const devDependencies = {};
8
8
  // Vite requires style preprocessors to be installed manually.
9
9
  // `@nx/webpack` installs them automatically for now.
10
- // TODO(jack): Once we clean up webpack we can remove this check
11
10
  if (options.bundler === 'vite' || options.unitTestRunner === 'vitest') {
12
11
  switch (options.style) {
13
12
  case 'scss':
14
- devDependencies = { sass: versions_1.sassVersion };
13
+ devDependencies['sass'] = versions_1.sassVersion;
15
14
  break;
16
15
  case 'less':
17
- devDependencies = { less: versions_1.lessVersion };
16
+ devDependencies['less'] = versions_1.lessVersion;
18
17
  break;
19
18
  case 'styl': // @TODO(17): deprecated, going to be removed in Nx 17
20
- devDependencies = { stylus: versions_1.stylusVersion };
19
+ devDependencies['stylus'] = versions_1.stylusVersion;
21
20
  break;
22
21
  }
23
22
  }
24
- return devDependencies
25
- ? (0, devkit_1.addDependenciesToPackageJson)(host, {}, devDependencies)
26
- : function noop() { };
23
+ if (options.bundler === 'webpack') {
24
+ if (options.compiler === 'swc') {
25
+ devDependencies['swc-loader'] = versions_1.swcLoaderVersion;
26
+ }
27
+ else if (options.compiler === 'babel') {
28
+ // babel-loader is currently included in @nx/webpack
29
+ // TODO(jack): Install babel-loader and other babel packages only as needed
30
+ devDependencies['@babel/preset-react'] = versions_1.babelPresetReactVersion;
31
+ }
32
+ }
33
+ return (0, devkit_1.addDependenciesToPackageJson)(host, {}, devDependencies);
27
34
  }
28
35
  exports.installCommonDependencies = installCommonDependencies;
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.setDefaults = void 0;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  function setDefaults(host, options) {
6
- if (options.skipWorkspaceJson) {
6
+ if (options.skipNxJson) {
7
7
  return;
8
8
  }
9
9
  const nxJson = (0, devkit_1.readNxJson)(host);
@@ -0,0 +1,3 @@
1
+ import { Tree } from '@nx/devkit';
2
+ import { NormalizedSchema, Schema } from '../schema';
3
+ export declare function showPossibleWarnings(tree: Tree, options: NormalizedSchema<Schema>): void;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.showPossibleWarnings = void 0;
4
+ const chalk = require("chalk");
5
+ const devkit_1 = require("@nx/devkit");
6
+ function showPossibleWarnings(tree, options) {
7
+ if (options.style === 'styled-jsx' && options.compiler === 'swc') {
8
+ devkit_1.logger.warn(`styled-jsx may not work with SWC. Try using ${chalk.bold('nx g @nx/react:app --compiler=babel')} instead.`);
9
+ }
10
+ }
11
+ exports.showPossibleWarnings = showPossibleWarnings;
@@ -14,7 +14,7 @@ export interface Schema {
14
14
  pascalCaseFiles?: boolean;
15
15
  classComponent?: boolean;
16
16
  routing?: boolean;
17
- skipWorkspaceJson?: boolean;
17
+ skipNxJson?: boolean;
18
18
  js?: boolean;
19
19
  globalCss?: boolean;
20
20
  strict?: boolean;
@@ -98,8 +98,8 @@
98
98
  "default": false,
99
99
  "x-priority": "internal"
100
100
  },
101
- "skipWorkspaceJson": {
102
- "description": "Skip updating `workspace.json` with default options based on values provided to this app (e.g. babel, style).",
101
+ "skipNxJson": {
102
+ "description": "Skip updating `nx.json` with default options based on values provided to this app.",
103
103
  "type": "boolean",
104
104
  "default": false,
105
105
  "x-priority": "internal"
@@ -1,4 +1,4 @@
1
1
  import { ProjectConfiguration, Tree } from '@nx/devkit';
2
2
  import type { CypressComponentConfigurationSchema } from '../schema';
3
- import { FoundTarget } from '../../../utils/ct-utils';
3
+ import { FoundTarget } from '@nx/cypress/src/utils/find-target-options';
4
4
  export declare function addFiles(tree: Tree, projectConfig: ProjectConfiguration, options: CypressComponentConfigurationSchema, found: FoundTarget): Promise<void>;
@@ -12,7 +12,10 @@ function addFiles(tree, projectConfig, options, found) {
12
12
  // must dyanmicaly import to prevent packages not using cypress from erroring out
13
13
  // when importing react
14
14
  const { addMountDefinition, addDefaultCTConfig } = yield Promise.resolve().then(() => require('@nx/cypress/src/utils/config'));
15
- const actualBundler = yield (0, ct_utils_1.getBundlerFromTarget)(found, tree);
15
+ // Specifically undefined to allow Remix workaround of passing an empty string
16
+ const actualBundler = options.buildTarget !== undefined && options.bundler
17
+ ? options.bundler
18
+ : yield (0, ct_utils_1.getBundlerFromTarget)(found, tree);
16
19
  if (options.bundler && options.bundler !== actualBundler) {
17
20
  devkit_1.logger.warn(`You have specified ${options.bundler} as the bundler but this project is configured to use ${actualBundler}.
18
21
  This may cause errors. If you are seeing errors, try removing the --bundler option.`);
@@ -15,7 +15,7 @@ export interface Schema {
15
15
  remotes?: string[];
16
16
  setParserOptionsProject?: boolean;
17
17
  skipFormat?: boolean;
18
- skipWorkspaceJson?: boolean;
18
+ skipNxJson?: boolean;
19
19
  ssr?: boolean;
20
20
  strict?: boolean;
21
21
  style: SupportedStyles;
@@ -79,7 +79,7 @@
79
79
  "default": false,
80
80
  "x-priority": "internal"
81
81
  },
82
- "skipWorkspaceJson": {
82
+ "skipNxJson": {
83
83
  "description": "Skip updating workspace.json with default options based on values provided to this app (e.g. babel, style).",
84
84
  "type": "boolean",
85
85
  "default": false,
@@ -29,22 +29,6 @@ function updateDependencies(host, schema) {
29
29
  '@testing-library/react': versions_1.testingLibraryReactVersion,
30
30
  });
31
31
  }
32
- function initRootBabelConfig(tree, schema) {
33
- var _a;
34
- if (tree.exists('/babel.config.json') || tree.exists('/babel.config.js')) {
35
- return;
36
- }
37
- if (!schema.skipBabelConfig) {
38
- (0, devkit_1.writeJson)(tree, '/babel.config.json', {
39
- babelrcRoots: ['*'], // Make sure .babelrc files other than root can be loaded in a monorepo
40
- });
41
- }
42
- const nxJson = (0, devkit_1.readNxJson)(tree);
43
- if ((_a = nxJson.namedInputs) === null || _a === void 0 ? void 0 : _a.sharedGlobals) {
44
- nxJson.namedInputs.sharedGlobals.push('{workspaceRoot}/babel.config.json');
45
- }
46
- (0, devkit_1.updateNxJson)(tree, nxJson);
47
- }
48
32
  function reactInitGenerator(host, schema) {
49
33
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
50
34
  const tasks = [];
@@ -57,15 +41,6 @@ function reactInitGenerator(host, schema) {
57
41
  const cypressTask = yield cypressInitGenerator(host, {});
58
42
  tasks.push(cypressTask);
59
43
  }
60
- if (!schema.skipPackageJson && !schema.skipBabelConfig) {
61
- const installBabelTask = (0, devkit_1.addDependenciesToPackageJson)(host, {}, {
62
- '@babel/preset-react': versions_1.babelPresetReactVersion,
63
- });
64
- tasks.push(installBabelTask);
65
- }
66
- if (!schema.skipBabelConfig) {
67
- initRootBabelConfig(host, schema);
68
- }
69
44
  if (!schema.skipPackageJson) {
70
45
  const installTask = updateDependencies(host, schema);
71
46
  tasks.push(installTask);
@@ -1,7 +1,6 @@
1
1
  export interface InitSchema {
2
2
  unitTestRunner?: 'jest' | 'vitest' | 'none';
3
3
  e2eTestRunner?: 'cypress' | 'none';
4
- skipBabelConfig?: boolean;
5
4
  skipFormat?: boolean;
6
5
  skipPackageJson?: boolean;
7
6
  skipHelperLibs?: boolean;
@@ -28,11 +28,6 @@
28
28
  "type": "boolean",
29
29
  "default": false
30
30
  },
31
- "skipBabelConfig": {
32
- "description": "Do not generate a root babel.config.json (if babel is not needed).",
33
- "type": "boolean",
34
- "default": false
35
- },
36
31
  "skipHelperLibs": {
37
32
  "description": "Do not install tslib.",
38
33
  "type": "boolean",
@@ -10,9 +10,31 @@ function createFiles(host, options) {
10
10
  (0, devkit_1.generateFiles)(host, (0, devkit_1.joinPathFragments)(__dirname, '../files/common'), options.projectRoot, substitutions);
11
11
  if (options.bundler === 'vite' || options.unitTestRunner === 'vitest') {
12
12
  (0, devkit_1.generateFiles)(host, (0, devkit_1.joinPathFragments)(__dirname, '../files/vite'), options.projectRoot, substitutions);
13
- if (host.exists((0, devkit_1.joinPathFragments)(options.projectRoot, '.babelrc'))) {
14
- host.delete((0, devkit_1.joinPathFragments)(options.projectRoot, '.babelrc'));
15
- }
13
+ }
14
+ if (options.compiler === 'babel') {
15
+ (0, devkit_1.writeJson)(host, (0, devkit_1.joinPathFragments)(options.projectRoot, '.babelrc'), {
16
+ presets: [
17
+ [
18
+ '@nx/react/babel',
19
+ {
20
+ runtime: 'automatic',
21
+ useBuiltIns: 'usage',
22
+ importSource: options.style === '@emotion/styled'
23
+ ? '@emotion/react'
24
+ : undefined,
25
+ },
26
+ ],
27
+ ],
28
+ plugins: [
29
+ options.style === 'styled-components'
30
+ ? ['styled-components', { pure: true, ssr: true }]
31
+ : undefined,
32
+ options.style === 'styled-jsx' ? 'styled-jsx/babel' : undefined,
33
+ options.style === '@emotion/styled'
34
+ ? '@emotion/babel-plugin'
35
+ : undefined,
36
+ ].filter(Boolean),
37
+ });
16
38
  }
17
39
  if (!options.publishable && !options.buildable) {
18
40
  host.delete(`${options.projectRoot}/package.json`);
@@ -31,6 +31,9 @@ function installCommonDependencies(host, options) {
31
31
  if (options.compiler === 'swc') {
32
32
  tasks.push((0, add_swc_dependencies_1.addSwcDependencies)(host));
33
33
  }
34
+ else if (options.compiler === 'babel') {
35
+ tasks.push((0, devkit_1.addDependenciesToPackageJson)(host, {}, { '@babel/preset-react': versions_1.babelPresetReactVersion }));
36
+ }
34
37
  return (0, devkit_1.runTasksInSerial)(...tasks);
35
38
  }
36
39
  exports.installCommonDependencies = installCommonDependencies;
@@ -26,7 +26,7 @@ function libraryGenerator(host, schema) {
26
26
  if (!options.component) {
27
27
  options.style = 'none';
28
28
  }
29
- const initTask = yield (0, init_1.default)(host, Object.assign(Object.assign({}, options), { e2eTestRunner: 'none', skipFormat: true, skipBabelConfig: options.bundler === 'vite' || options.compiler === 'swc', skipHelperLibs: options.bundler === 'vite' }));
29
+ const initTask = yield (0, init_1.default)(host, Object.assign(Object.assign({}, options), { e2eTestRunner: 'none', skipFormat: true, skipHelperLibs: options.bundler === 'vite' }));
30
30
  tasks.push(initTask);
31
31
  (0, devkit_1.addProjectConfiguration)(host, options.name, {
32
32
  root: options.projectRoot,
@@ -50,6 +50,7 @@ function libraryGenerator(host, schema) {
50
50
  includeVitest: options.unitTestRunner === 'vitest',
51
51
  compiler: options.compiler,
52
52
  skipFormat: true,
53
+ testEnvironment: 'jsdom',
53
54
  });
54
55
  tasks.push(viteTask);
55
56
  }
@@ -78,6 +79,7 @@ function libraryGenerator(host, schema) {
78
79
  coverageProvider: 'c8',
79
80
  inSourceTests: options.inSourceTests,
80
81
  skipFormat: true,
82
+ testEnvironment: 'jsdom',
81
83
  });
82
84
  tasks.push(vitestTask);
83
85
  }
@@ -17,7 +17,7 @@ export interface Schema {
17
17
  routing?: boolean;
18
18
  setParserOptionsProject?: boolean;
19
19
  skipFormat: boolean;
20
- skipWorkspaceJson?: boolean;
20
+ skipNxJson?: boolean;
21
21
  ssr?: boolean;
22
22
  strict?: boolean;
23
23
  style: SupportedStyles;
@@ -84,7 +84,7 @@
84
84
  "default": false,
85
85
  "x-priority": "internal"
86
86
  },
87
- "skipWorkspaceJson": {
87
+ "skipNxJson": {
88
88
  "description": "Skip updating workspace.json with default options based on values provided to this app (e.g. babel, style).",
89
89
  "type": "boolean",
90
90
  "default": false,
@@ -1,8 +1,5 @@
1
- import { TargetConfiguration, Tree } from '@nx/devkit';
2
- export interface FoundTarget {
3
- config?: TargetConfiguration;
4
- target: string;
5
- }
1
+ import { Tree } from '@nx/devkit';
2
+ import { type FoundTarget } from '@nx/cypress/src/utils/find-target-options';
6
3
  export declare function addCTTargetWithBuildTarget(tree: Tree, options: {
7
4
  project: string;
8
5
  buildTarget: string;
@@ -6,17 +6,21 @@ const devkit_1 = require("@nx/devkit");
6
6
  const ensure_typescript_1 = require("@nx/js/src/utils/typescript/ensure-typescript");
7
7
  const ast_utils_1 = require("./ast-utils");
8
8
  let tsModule;
9
- const allowedFileExt = new RegExp(/\.[jt]sx?/g);
10
- const isSpecFile = new RegExp(/(spec|test)\./g);
9
+ const allowedFileExt = new RegExp(/\.[jt]sx?/);
10
+ const isSpecFile = new RegExp(/(spec|test)\./);
11
11
  function addCTTargetWithBuildTarget(tree, options) {
12
12
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
13
- const { findBuildConfig } = yield Promise.resolve().then(() => require('@nx/cypress/src/utils/find-target-options'));
14
- const found = yield findBuildConfig(tree, {
15
- project: options.project,
16
- buildTarget: options.buildTarget,
17
- validExecutorNames: options.validExecutorNames,
18
- });
19
- assertValidConfig(found === null || found === void 0 ? void 0 : found.config);
13
+ let found = { target: options.buildTarget, config: undefined };
14
+ // Specifically undefined as a workaround for Remix to pass an empty string as the buildTarget
15
+ if (options.buildTarget === undefined) {
16
+ const { findBuildConfig } = yield Promise.resolve().then(() => require('@nx/cypress/src/utils/find-target-options'));
17
+ found = yield findBuildConfig(tree, {
18
+ project: options.project,
19
+ buildTarget: options.buildTarget,
20
+ validExecutorNames: options.validExecutorNames,
21
+ });
22
+ assertValidConfig(found === null || found === void 0 ? void 0 : found.config);
23
+ }
20
24
  const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
21
25
  projectConfig.targets['component-test'].options = Object.assign(Object.assign({}, projectConfig.targets['component-test'].options), { devServerTarget: found.target, skipServe: true });
22
26
  (0, devkit_1.updateProjectConfiguration)(tree, options.project, projectConfig);
@@ -5,16 +5,16 @@ export declare const reactDomVersion = "18.2.0";
5
5
  export declare const reactIsVersion = "18.2.0";
6
6
  export declare const swcLoaderVersion = "0.1.15";
7
7
  export declare const babelLoaderVersion = "^9.1.2";
8
- export declare const typesReactVersion = "18.0.28";
9
- export declare const typesReactDomVersion = "18.0.11";
10
- export declare const typesReactIsVersion = "17.0.3";
8
+ export declare const typesReactVersion = "18.2.12";
9
+ export declare const typesReactDomVersion = "18.2.5";
10
+ export declare const typesReactIsVersion = "18.2.0";
11
11
  export declare const typesNodeVersion = "18.14.2";
12
12
  export declare const babelPresetReactVersion = "^7.14.5";
13
13
  export declare const styledComponentsVersion = "5.3.6";
14
14
  export declare const typesStyledComponentsVersion = "5.1.26";
15
- export declare const emotionStyledVersion = "11.10.6";
16
- export declare const emotionReactVersion = "11.10.6";
17
- export declare const emotionBabelPlugin = "11.10.6";
15
+ export declare const emotionStyledVersion = "11.11.0";
16
+ export declare const emotionReactVersion = "11.11.1";
17
+ export declare const emotionBabelPlugin = "11.11.0";
18
18
  export declare const styledJsxVersion = "5.1.2";
19
19
  export declare const reactRouterDomVersion = "6.11.2";
20
20
  export declare const testingLibraryReactVersion = "14.0.0";
@@ -38,7 +38,7 @@ export declare const typesCorsVersion = "~2.8.12";
38
38
  export declare const moduleFederationNodeVersion = "~0.9.9";
39
39
  export declare const lessVersion = "3.12.2";
40
40
  export declare const sassVersion = "^1.55.0";
41
- export declare const stylusVersion = "^0.55.0";
41
+ export declare const stylusVersion = "^0.59.0";
42
42
  export declare const rollupPluginUrlVersion = "^7.0.0";
43
43
  export declare const svgrRollupVersion = "^8.0.1";
44
44
  export declare const swcPluginStyledJsxVersion = "^1.5.67";
@@ -9,16 +9,16 @@ exports.reactDomVersion = '18.2.0';
9
9
  exports.reactIsVersion = '18.2.0';
10
10
  exports.swcLoaderVersion = '0.1.15';
11
11
  exports.babelLoaderVersion = '^9.1.2';
12
- exports.typesReactVersion = '18.0.28';
13
- exports.typesReactDomVersion = '18.0.11';
14
- exports.typesReactIsVersion = '17.0.3';
12
+ exports.typesReactVersion = '18.2.12';
13
+ exports.typesReactDomVersion = '18.2.5';
14
+ exports.typesReactIsVersion = '18.2.0';
15
15
  exports.typesNodeVersion = '18.14.2';
16
16
  exports.babelPresetReactVersion = '^7.14.5';
17
17
  exports.styledComponentsVersion = '5.3.6';
18
18
  exports.typesStyledComponentsVersion = '5.1.26';
19
- exports.emotionStyledVersion = '11.10.6';
20
- exports.emotionReactVersion = '11.10.6';
21
- exports.emotionBabelPlugin = '11.10.6';
19
+ exports.emotionStyledVersion = '11.11.0';
20
+ exports.emotionReactVersion = '11.11.1';
21
+ exports.emotionBabelPlugin = '11.11.0';
22
22
  // WARNING: This needs to be in sync with Next.js' dependency or else there might be issues.
23
23
  exports.styledJsxVersion = '5.1.2';
24
24
  exports.reactRouterDomVersion = '6.11.2';
@@ -45,7 +45,7 @@ exports.moduleFederationNodeVersion = '~0.9.9';
45
45
  // style preprocessors
46
46
  exports.lessVersion = '3.12.2';
47
47
  exports.sassVersion = '^1.55.0';
48
- exports.stylusVersion = '^0.55.0';
48
+ exports.stylusVersion = '^0.59.0';
49
49
  // rollup plugins (if needed)
50
50
  exports.rollupPluginUrlVersion = '^7.0.0';
51
51
  exports.svgrRollupVersion = '^8.0.1';
@@ -1,16 +0,0 @@
1
- {
2
- "presets": [
3
- [
4
- "@nx/react/babel", {
5
- "runtime": "automatic",
6
- "useBuiltIns": "usage"
7
- <% if (style === '@emotion/styled') { %>,"importSource": "@emotion/react"<% } %>
8
- }
9
- ]
10
- ],
11
- "plugins": [
12
- <% if (style === 'styled-components') { %>["styled-components", { "pure": true, "ssr": true }]<% } %>
13
- <% if (style === 'styled-jsx') { %>"styled-jsx/babel"<% } %>
14
- <% if (style === '@emotion/styled') { %>"@emotion/babel-plugin"<% } %>
15
- ]
16
- }