@nx/remix 20.5.0 → 20.6.0-beta.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/remix",
3
- "version": "20.5.0",
3
+ "version": "20.6.0-beta.1",
4
4
  "description": "The Remix plugin for Nx contains executors and generators for managing Remix applications and libraries within an Nx workspace. It provides:\n\n\n- Integration with libraries such as Vitest, Jest, Playwright, Cypress, and Storybook.\n\n- Generators for applications, libraries, routes, loaders, and more.\n\n- Library build support for publishing packages to npm or other registries.\n\n- Utilities for automatic workspace refactoring.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -29,9 +29,9 @@
29
29
  "migrations": "./migrations.json"
30
30
  },
31
31
  "dependencies": {
32
- "@nx/devkit": "20.5.0",
33
- "@nx/js": "20.5.0",
34
- "@nx/react": "20.5.0",
32
+ "@nx/devkit": "20.6.0-beta.1",
33
+ "@nx/js": "20.6.0-beta.1",
34
+ "@nx/react": "20.6.0-beta.1",
35
35
  "tslib": "^2.3.1",
36
36
  "@phenomnomnominal/tsquery": "~5.0.1"
37
37
  },
@@ -17,6 +17,7 @@ const sort_fields_1 = require("@nx/js/src/utils/package-json/sort-fields");
17
17
  function remixApplicationGenerator(tree, options) {
18
18
  return remixApplicationGeneratorInternal(tree, {
19
19
  addPlugin: true,
20
+ useProjectJson: true,
20
21
  ...options,
21
22
  });
22
23
  }
@@ -40,9 +41,9 @@ async function remixApplicationGeneratorInternal(tree, _options) {
40
41
  // If we are using the new TS solution
41
42
  // We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
42
43
  if (options.isUsingTsSolutionConfig) {
43
- (0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(tree, options.projectRoot);
44
+ await (0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(tree, options.projectRoot);
44
45
  }
45
- if (!options.isUsingTsSolutionConfig) {
46
+ if (options.useProjectJson) {
46
47
  (0, devkit_1.addProjectConfiguration)(tree, options.projectName, {
47
48
  root: options.projectRoot,
48
49
  sourceRoot: `${options.projectRoot}`,
@@ -81,6 +82,8 @@ async function remixApplicationGeneratorInternal(tree, _options) {
81
82
  }
82
83
  if (options.isUsingTsSolutionConfig) {
83
84
  (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files/ts-solution'), options.projectRoot, vars);
85
+ }
86
+ if (!options.useProjectJson) {
84
87
  (0, devkit_1.updateJson)(tree, (0, devkit_1.joinPathFragments)(options.projectRoot, 'package.json'), (json) => {
85
88
  if (options.projectName !== options.importPath) {
86
89
  json.nx = { name: options.projectName };
@@ -6,7 +6,6 @@ const versions_1 = require("../../../utils/versions");
6
6
  const find_plugin_for_config_file_1 = require("@nx/devkit/src/utils/find-plugin-for-config-file");
7
7
  const target_defaults_utils_1 = require("@nx/devkit/src/generators/target-defaults-utils");
8
8
  const e2e_web_server_info_utils_1 = require("@nx/devkit/src/generators/e2e-web-server-info-utils");
9
- const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
10
9
  async function addE2E(tree, options) {
11
10
  const hasRemixPlugin = (0, devkit_1.readNxJson)(tree).plugins?.find((p) => typeof p === 'string'
12
11
  ? p === '@nx/remix/plugin'
@@ -14,15 +13,15 @@ async function addE2E(tree, options) {
14
13
  let e2eWebsServerInfo = await getRemixE2EWebServerInfo(tree, options.projectName, (0, devkit_1.joinPathFragments)(options.projectRoot, 'remix.config.js'), options.addPlugin ?? Boolean(hasRemixPlugin));
15
14
  if (options.e2eTestRunner === 'cypress') {
16
15
  const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/cypress', (0, versions_1.getPackageVersion)(tree, 'nx'));
17
- if ((0, ts_solution_setup_1.isUsingTsSolutionSetup)(tree)) {
18
- (0, devkit_1.writeJson)(tree, (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'package.json'), {
19
- name: options.e2eProjectName,
20
- version: '0.0.1',
21
- private: true,
22
- nx: {
23
- implicitDependencies: [options.projectName],
24
- },
25
- });
16
+ const packageJson = {
17
+ name: options.e2eProjectName,
18
+ version: '0.0.1',
19
+ private: true,
20
+ };
21
+ if (!options.useProjectJson) {
22
+ packageJson.nx = {
23
+ implicitDependencies: [options.projectName],
24
+ };
26
25
  }
27
26
  else {
28
27
  (0, devkit_1.addProjectConfiguration)(tree, options.e2eProjectName, {
@@ -34,6 +33,9 @@ async function addE2E(tree, options) {
34
33
  implicitDependencies: [options.projectName],
35
34
  });
36
35
  }
36
+ if (!options.useProjectJson || options.isUsingTsSolutionConfig) {
37
+ (0, devkit_1.writeJson)(tree, (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'package.json'), packageJson);
38
+ }
37
39
  const e2eTask = await configurationGenerator(tree, {
38
40
  project: options.e2eProjectName,
39
41
  directory: 'src',
@@ -69,15 +71,15 @@ async function addE2E(tree, options) {
69
71
  }
70
72
  else if (options.e2eTestRunner === 'playwright') {
71
73
  const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/playwright', (0, versions_1.getPackageVersion)(tree, 'nx'));
72
- if ((0, ts_solution_setup_1.isUsingTsSolutionSetup)(tree)) {
73
- (0, devkit_1.writeJson)(tree, (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'package.json'), {
74
- name: options.e2eProjectName,
75
- version: '0.0.1',
76
- private: true,
77
- nx: {
78
- implicitDependencies: [options.projectName],
79
- },
80
- });
74
+ const packageJson = {
75
+ name: options.e2eProjectName,
76
+ version: '0.0.1',
77
+ private: true,
78
+ };
79
+ if (!options.useProjectJson) {
80
+ packageJson.nx = {
81
+ implicitDependencies: [options.projectName],
82
+ };
81
83
  }
82
84
  else {
83
85
  (0, devkit_1.addProjectConfiguration)(tree, options.e2eProjectName, {
@@ -89,6 +91,9 @@ async function addE2E(tree, options) {
89
91
  implicitDependencies: [options.projectName],
90
92
  });
91
93
  }
94
+ if (!options.useProjectJson || options.isUsingTsSolutionConfig) {
95
+ (0, devkit_1.writeJson)(tree, (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'package.json'), packageJson);
96
+ }
92
97
  const e2eTask = await configurationGenerator(tree, {
93
98
  project: options.e2eProjectName,
94
99
  skipFormat: true,
@@ -36,5 +36,6 @@ async function normalizeOptions(tree, options) {
36
36
  parsedTags,
37
37
  useTsSolution: isUsingTsSolutionConfig,
38
38
  isUsingTsSolutionConfig,
39
+ useProjectJson: options.useProjectJson ?? !isUsingTsSolutionConfig,
39
40
  };
40
41
  }
@@ -14,4 +14,5 @@ export interface NxRemixGeneratorSchema {
14
14
  nxCloudToken?: string;
15
15
  useTsSolution?: boolean;
16
16
  formatter?: 'prettier' | 'none';
17
+ useProjectJson?: boolean;
17
18
  }
@@ -57,6 +57,10 @@
57
57
  "type": "boolean",
58
58
  "x-priority": "internal",
59
59
  "default": false
60
+ },
61
+ "useProjectJson": {
62
+ "type": "boolean",
63
+ "description": "Use a `project.json` configuration file instead of inlining the Nx configuration in the `package.json` file."
60
64
  }
61
65
  },
62
66
  "required": ["directory"]
@@ -23,5 +23,6 @@ async function normalizeOptions(tree, options) {
23
23
  projectRoot,
24
24
  importPath,
25
25
  isUsingTsSolutionConfig,
26
+ useProjectJson: options.useProjectJson ?? !isUsingTsSolutionConfig,
26
27
  };
27
28
  }
@@ -9,13 +9,17 @@ const lib_1 = require("./lib");
9
9
  const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
10
10
  const sort_fields_1 = require("@nx/js/src/utils/package-json/sort-fields");
11
11
  async function remixLibraryGenerator(tree, schema) {
12
- return remixLibraryGeneratorInternal(tree, { addPlugin: false, ...schema });
12
+ return remixLibraryGeneratorInternal(tree, {
13
+ addPlugin: false,
14
+ useProjectJson: true,
15
+ ...schema,
16
+ });
13
17
  }
14
18
  async function remixLibraryGeneratorInternal(tree, schema) {
15
19
  const tasks = [];
16
20
  const options = await (0, lib_1.normalizeOptions)(tree, schema);
17
21
  if (options.isUsingTsSolutionConfig) {
18
- (0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(tree, options.projectRoot);
22
+ await (0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(tree, options.projectRoot);
19
23
  }
20
24
  const jsInitTask = await (0, js_1.initGenerator)(tree, {
21
25
  js: options.js,
@@ -36,6 +40,7 @@ async function remixLibraryGeneratorInternal(tree, schema) {
36
40
  buildable: options.buildable,
37
41
  bundler: options.bundler,
38
42
  addPlugin: options.addPlugin,
43
+ useProjectJson: options.useProjectJson,
39
44
  });
40
45
  tasks.push(libGenTask);
41
46
  if (options.unitTestRunner && options.unitTestRunner !== 'none') {
@@ -14,4 +14,5 @@ export interface NxRemixGeneratorSchema {
14
14
  js?: boolean;
15
15
  skipFormat?: boolean;
16
16
  addPlugin?: boolean;
17
+ useProjectJson?: boolean;
17
18
  }
@@ -81,6 +81,10 @@
81
81
  "default": false,
82
82
  "description": "Generate a buildable library that uses rollup to bundle.",
83
83
  "x-deprecated": "Use the `bundler` option for greater control (none, vite, rollup)."
84
+ },
85
+ "useProjectJson": {
86
+ "type": "boolean",
87
+ "description": "Use a `project.json` configuration file instead of inlining the Nx configuration in the `package.json` file."
84
88
  }
85
89
  },
86
90
  "required": ["directory"]