@nx/remix 20.4.0-beta.1 → 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.1",
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.1",
33
- "@nx/js": "20.4.0-beta.1",
34
- "@nx/react": "20.4.0-beta.1",
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
  },
@@ -37,8 +37,12 @@ async function remixApplicationGeneratorInternal(tree, _options) {
37
37
  if (!options.addPlugin) {
38
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.`);
39
39
  }
40
- const isUsingTsSolution = (0, ts_solution_setup_1.isUsingTsSolutionSetup)(tree);
41
- 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) {
42
46
  (0, devkit_1.addProjectConfiguration)(tree, options.projectName, {
43
47
  root: options.projectRoot,
44
48
  sourceRoot: `${options.projectRoot}`,
@@ -65,7 +69,6 @@ async function remixApplicationGeneratorInternal(tree, _options) {
65
69
  eslintVersion: versions_1.eslintVersion,
66
70
  typescriptVersion: versions_1.typescriptVersion,
67
71
  viteVersion: versions_1.viteVersion,
68
- isUsingTsSolution,
69
72
  };
70
73
  (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files/common'), options.projectRoot, vars);
71
74
  (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, './files/nx-welcome', onBoardingStatus), options.projectRoot, { ...vars, connectCloudUrl });
@@ -76,7 +79,7 @@ async function remixApplicationGeneratorInternal(tree, _options) {
76
79
  else {
77
80
  (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files/non-root'), options.projectRoot, vars);
78
81
  }
79
- if (isUsingTsSolution) {
82
+ if (options.isUsingTsSolutionConfig) {
80
83
  (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files/ts-solution'), options.projectRoot, vars);
81
84
  }
82
85
  if (options.unitTestRunner !== 'none') {
@@ -197,11 +200,6 @@ export default {...nxPreset};
197
200
  }, options.linter === 'eslint'
198
201
  ? ['eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs']
199
202
  : undefined, '.');
200
- // If we are using the new TS solution
201
- // We need to update the workspace file (package.json or pnpm-workspaces.yaml) to include the new project
202
- if (options.useTsSolution) {
203
- (0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(tree, options.projectRoot);
204
- }
205
203
  (0, sort_fields_1.sortPackageJsonFields)(tree, options.projectRoot);
206
204
  if (!options.skipFormat) {
207
205
  await (0, devkit_1.formatFiles)(tree);
@@ -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
  }
@@ -14,6 +14,9 @@ async function remixLibraryGenerator(tree, schema) {
14
14
  async function remixLibraryGeneratorInternal(tree, schema) {
15
15
  const tasks = [];
16
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
+ }
17
20
  const jsInitTask = await (0, js_1.initGenerator)(tree, {
18
21
  js: options.js,
19
22
  skipFormat: true,
@@ -50,9 +53,6 @@ async function remixLibraryGeneratorInternal(tree, schema) {
50
53
  }, options.linter === 'eslint'
51
54
  ? ['eslint.config.js', 'eslint.config.cjs', 'eslint.config.mjs']
52
55
  : undefined);
53
- if (options.isUsingTsSolutionConfig) {
54
- (0, ts_solution_setup_1.addProjectToTsSolutionWorkspace)(tree, options.projectRoot);
55
- }
56
56
  (0, sort_fields_1.sortPackageJsonFields)(tree, options.projectRoot);
57
57
  if (!options.skipFormat) {
58
58
  await (0, devkit_1.formatFiles)(tree);