@nx/remix 20.4.0-beta.0 → 20.4.0-beta.2

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.4.0-beta.0",
3
+ "version": "20.4.0-beta.2",
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.4.0-beta.0",
33
- "@nx/js": "20.4.0-beta.0",
34
- "@nx/react": "20.4.0-beta.0",
32
+ "@nx/devkit": "20.4.0-beta.2",
33
+ "@nx/js": "20.4.0-beta.2",
34
+ "@nx/react": "20.4.0-beta.2",
35
35
  "tslib": "^2.3.1",
36
36
  "@phenomnomnominal/tsquery": "~5.0.1"
37
37
  },
@@ -156,7 +156,6 @@ export default defineConfig({
156
156
  exports[`Remix Application Integrated Repo --e2eTestRunner should generate a playwright e2e application for the app 1`] = `
157
157
  "import { defineConfig, devices } from '@playwright/test';
158
158
  import { nxE2EPreset } from '@nx/playwright/preset';
159
-
160
159
  import { workspaceRoot } from '@nx/devkit';
161
160
 
162
161
  // For CI, you may want to set BASE_URL to the deployed application.
@@ -678,7 +677,6 @@ exports[`Remix Application Standalone Project Repo should create the application
678
677
  exports[`Remix Application Standalone Project Repo should generate a playwright e2e application for the app 1`] = `
679
678
  "import { defineConfig, devices } from '@playwright/test';
680
679
  import { nxE2EPreset } from '@nx/playwright/preset';
681
-
682
680
  import { workspaceRoot } from '@nx/devkit';
683
681
 
684
682
  // For CI, you may want to set BASE_URL to the deployed application.
@@ -13,6 +13,7 @@ const init_1 = require("../init/init");
13
13
  const update_dependencies_1 = require("../utils/update-dependencies");
14
14
  const lib_1 = require("./lib");
15
15
  const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
16
+ const sort_fields_1 = require("@nx/js/src/utils/package-json/sort-fields");
16
17
  function remixApplicationGenerator(tree, options) {
17
18
  return remixApplicationGeneratorInternal(tree, {
18
19
  addPlugin: true,
@@ -29,14 +30,19 @@ async function remixApplicationGeneratorInternal(tree, _options) {
29
30
  skipFormat: true,
30
31
  addTsPlugin: _options.useTsSolution,
31
32
  formatter: _options.formatter,
33
+ platform: 'web',
32
34
  }),
33
35
  ];
34
36
  const options = await (0, lib_1.normalizeOptions)(tree, _options);
35
37
  if (!options.addPlugin) {
36
38
  throw new Error(`To generate a new Remix Vite application, you must use Inference Plugins. Check you do not have NX_ADD_PLUGINS=false or useInferencePlugins: false in your nx.json.`);
37
39
  }
38
- const isUsingTsSolution = (0, ts_solution_setup_1.isUsingTsSolutionSetup)(tree);
39
- if (!isUsingTsSolution) {
40
+ // If we are using the new TS solution
41
+ // We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
42
+ if (options.isUsingTsSolutionConfig) {
43
+ (0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(tree, options.projectRoot);
44
+ }
45
+ if (!options.isUsingTsSolutionConfig) {
40
46
  (0, devkit_1.addProjectConfiguration)(tree, options.projectName, {
41
47
  root: options.projectRoot,
42
48
  sourceRoot: `${options.projectRoot}`,
@@ -63,7 +69,6 @@ async function remixApplicationGeneratorInternal(tree, _options) {
63
69
  eslintVersion: versions_1.eslintVersion,
64
70
  typescriptVersion: versions_1.typescriptVersion,
65
71
  viteVersion: versions_1.viteVersion,
66
- isUsingTsSolution,
67
72
  };
68
73
  (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files/common'), options.projectRoot, vars);
69
74
  (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, './files/nx-welcome', onBoardingStatus), options.projectRoot, { ...vars, connectCloudUrl });
@@ -74,7 +79,7 @@ async function remixApplicationGeneratorInternal(tree, _options) {
74
79
  else {
75
80
  (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files/non-root'), options.projectRoot, vars);
76
81
  }
77
- if (isUsingTsSolution) {
82
+ if (options.isUsingTsSolutionConfig) {
78
83
  (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files/ts-solution'), options.projectRoot, vars);
79
84
  }
80
85
  if (options.unitTestRunner !== 'none') {
@@ -195,11 +200,7 @@ export default {...nxPreset};
195
200
  }, options.linter === 'eslint'
196
201
  ? ['eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs']
197
202
  : undefined, '.');
198
- // If we are using the new TS solution
199
- // We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
200
- if (options.useTsSolution) {
201
- (0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(tree, options.projectRoot);
202
- }
203
+ (0, sort_fields_1.sortPackageJsonFields)(tree, options.projectRoot);
203
204
  if (!options.skipFormat) {
204
205
  await (0, devkit_1.formatFiles)(tree);
205
206
  }
@@ -19,13 +19,8 @@
19
19
  "engines": {
20
20
  "node": ">=20"
21
21
  },
22
- "sideEffects": false<% if (isUsingTsSolution) { %>,
22
+ "sideEffects": false<% if (isUsingTsSolutionConfig && parsedTags?.length) { %>,
23
23
  "nx": {
24
- <%_ if (name !== projectName) { _%>
25
- "name": "<%= name %>",<%_ } _%>
26
- "projectType": "application",
27
- "sourceRoot": "<%- projectRoot %>"<%_ if (parsedTags?.length) { _%>,
28
24
  "tags": <%- JSON.stringify(parsedTags) %>
29
- <%_ } _%>
30
25
  }<% } %>
31
26
  }
@@ -6,5 +6,6 @@ export interface NormalizedSchema extends NxRemixGeneratorSchema {
6
6
  e2eProjectName: string;
7
7
  e2eProjectRoot: string;
8
8
  parsedTags: string[];
9
+ isUsingTsSolutionConfig: boolean;
9
10
  }
10
11
  export declare function normalizeOptions(tree: Tree, options: NxRemixGeneratorSchema): Promise<NormalizedSchema>;
@@ -4,6 +4,8 @@ exports.normalizeOptions = normalizeOptions;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
6
6
  const eslint_1 = require("@nx/eslint");
7
+ const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
8
+ const get_import_path_1 = require("@nx/js/src/utils/get-import-path");
7
9
  async function normalizeOptions(tree, options) {
8
10
  await (0, project_name_and_root_utils_1.ensureProjectName)(tree, options, 'application');
9
11
  const { projectName, projectRoot } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(tree, {
@@ -22,13 +24,18 @@ async function normalizeOptions(tree, options) {
22
24
  const parsedTags = options.tags
23
25
  ? options.tags.split(',').map((s) => s.trim())
24
26
  : [];
27
+ const isUsingTsSolutionConfig = (0, ts_solution_setup_1.isUsingTsSolutionSetup)(tree);
25
28
  return {
26
29
  ...options,
27
30
  linter: options.linter ?? eslint_1.Linter.EsLint,
28
- projectName,
31
+ projectName: isUsingTsSolutionConfig
32
+ ? (0, get_import_path_1.getImportPath)(tree, projectName)
33
+ : projectName,
29
34
  projectRoot,
30
35
  e2eProjectName,
31
36
  e2eProjectRoot,
32
37
  parsedTags,
38
+ useTsSolution: options.useTsSolution ?? isUsingTsSolutionConfig,
39
+ isUsingTsSolutionConfig,
33
40
  };
34
41
  }
@@ -6,7 +6,7 @@ const js_1 = require("@nx/js");
6
6
  const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
7
7
  function addTsconfigEntryPoints(tree, options) {
8
8
  const { root: projectRoot, sourceRoot } = (0, devkit_1.readProjectConfiguration)(tree, options.projectName);
9
- const serverFilePath = (0, devkit_1.joinPathFragments)(sourceRoot, 'server.ts');
9
+ const serverFilePath = (0, devkit_1.joinPathFragments)(sourceRoot ?? 'src', 'server.ts');
10
10
  tree.write(serverFilePath, `// This file should be used to export ONLY server-code from the library.`);
11
11
  const baseTsConfig = (0, js_1.getRootTsConfigPathInTree)(tree);
12
12
  // Use same logic as `determineProjectNameAndRootOptions` to get the import path
@@ -4,6 +4,7 @@ exports.normalizeOptions = normalizeOptions;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
6
6
  const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
7
+ const get_import_path_1 = require("@nx/js/src/utils/get-import-path");
7
8
  async function normalizeOptions(tree, options) {
8
9
  await (0, project_name_and_root_utils_1.ensureProjectName)(tree, options, 'application');
9
10
  const { projectName, projectRoot } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(tree, {
@@ -15,11 +16,14 @@ async function normalizeOptions(tree, options) {
15
16
  const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
16
17
  nxJson.useInferencePlugins !== false;
17
18
  options.addPlugin ??= addPluginDefault;
19
+ const isUsingTsSolutionConfig = (0, ts_solution_setup_1.isUsingTsSolutionSetup)(tree);
18
20
  return {
19
21
  ...options,
20
22
  unitTestRunner: options.unitTestRunner ?? 'vitest',
21
- projectName,
23
+ projectName: isUsingTsSolutionConfig
24
+ ? (0, get_import_path_1.getImportPath)(tree, projectName)
25
+ : projectName,
22
26
  projectRoot,
23
- isUsingTsSolutionConfig: (0, ts_solution_setup_1.isUsingTsSolutionSetup)(tree),
27
+ isUsingTsSolutionConfig,
24
28
  };
25
29
  }
@@ -7,12 +7,16 @@ const js_1 = require("@nx/js");
7
7
  const react_1 = require("@nx/react");
8
8
  const lib_1 = require("./lib");
9
9
  const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
10
+ const sort_fields_1 = require("@nx/js/src/utils/package-json/sort-fields");
10
11
  async function remixLibraryGenerator(tree, schema) {
11
12
  return remixLibraryGeneratorInternal(tree, { addPlugin: false, ...schema });
12
13
  }
13
14
  async function remixLibraryGeneratorInternal(tree, schema) {
14
15
  const tasks = [];
15
16
  const options = await (0, lib_1.normalizeOptions)(tree, schema);
17
+ if (options.isUsingTsSolutionConfig) {
18
+ (0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(tree, options.projectRoot);
19
+ }
16
20
  const jsInitTask = await (0, js_1.initGenerator)(tree, {
17
21
  js: options.js,
18
22
  skipFormat: true,
@@ -49,9 +53,7 @@ async function remixLibraryGeneratorInternal(tree, schema) {
49
53
  }, options.linter === 'eslint'
50
54
  ? ['eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs']
51
55
  : undefined);
52
- if (options.isUsingTsSolutionConfig) {
53
- (0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(tree, options.projectRoot);
54
- }
56
+ (0, sort_fields_1.sortPackageJsonFields)(tree, options.projectRoot);
55
57
  if (!options.skipFormat) {
56
58
  await (0, devkit_1.formatFiles)(tree);
57
59
  }
@@ -7,7 +7,7 @@ export declare const reactDomVersion = "^18.2.0";
7
7
  export declare const typesReactVersion = "^18.2.0";
8
8
  export declare const typesReactDomVersion = "^18.2.0";
9
9
  export declare const eslintVersion = "^8.56.0";
10
- export declare const typescriptVersion = "~5.6.2";
10
+ export declare const typescriptVersion = "~5.7.2";
11
11
  export declare const tailwindVersion = "^3.3.0";
12
12
  export declare const postcssVersion = "^8.4.38";
13
13
  export declare const autoprefixerVersion = "^10.4.19";
@@ -12,7 +12,7 @@ exports.reactDomVersion = '^18.2.0';
12
12
  exports.typesReactVersion = '^18.2.0';
13
13
  exports.typesReactDomVersion = '^18.2.0';
14
14
  exports.eslintVersion = '^8.56.0';
15
- exports.typescriptVersion = '~5.6.2';
15
+ exports.typescriptVersion = '~5.7.2';
16
16
  exports.tailwindVersion = '^3.3.0';
17
17
  exports.postcssVersion = '^8.4.38';
18
18
  exports.autoprefixerVersion = '^10.4.19';