@nx/remix 20.5.0-rc.3 → 20.5.0-rc.4

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-rc.3",
3
+ "version": "20.5.0-rc.4",
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-rc.3",
33
- "@nx/js": "20.5.0-rc.3",
34
- "@nx/react": "20.5.0-rc.3",
32
+ "@nx/devkit": "20.5.0-rc.4",
33
+ "@nx/js": "20.5.0-rc.4",
34
+ "@nx/react": "20.5.0-rc.4",
35
35
  "tslib": "^2.3.1",
36
36
  "@phenomnomnominal/tsquery": "~5.0.1"
37
37
  },
@@ -81,6 +81,16 @@ async function remixApplicationGeneratorInternal(tree, _options) {
81
81
  }
82
82
  if (options.isUsingTsSolutionConfig) {
83
83
  (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, 'files/ts-solution'), options.projectRoot, vars);
84
+ (0, devkit_1.updateJson)(tree, (0, devkit_1.joinPathFragments)(options.projectRoot, 'package.json'), (json) => {
85
+ if (options.projectName !== options.importPath) {
86
+ json.nx = { name: options.projectName };
87
+ }
88
+ if (options.parsedTags?.length) {
89
+ json.nx ??= {};
90
+ json.nx.tags = options.parsedTags;
91
+ }
92
+ return json;
93
+ });
84
94
  }
85
95
  if (options.unitTestRunner !== 'none') {
86
96
  if (options.unitTestRunner === 'vitest') {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "private": true,
3
- "name": "<%= projectName %>",
3
+ "name": "<%= importPath %>",
4
4
  "scripts": {},
5
5
  "type": "module",
6
6
  "dependencies": {
@@ -19,8 +19,5 @@
19
19
  "engines": {
20
20
  "node": ">=20"
21
21
  },
22
- "sideEffects": false<% if (isUsingTsSolutionConfig && parsedTags?.length) { %>,
23
- "nx": {
24
- "tags": <%- JSON.stringify(parsedTags) %>
25
- }<% } %>
22
+ "sideEffects": false
26
23
  }
@@ -20,8 +20,6 @@ async function addE2E(tree, options) {
20
20
  version: '0.0.1',
21
21
  private: true,
22
22
  nx: {
23
- projectType: 'application',
24
- sourceRoot: (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'src'),
25
23
  implicitDependencies: [options.projectName],
26
24
  },
27
25
  });
@@ -77,8 +75,6 @@ async function addE2E(tree, options) {
77
75
  version: '0.0.1',
78
76
  private: true,
79
77
  nx: {
80
- projectType: 'application',
81
- sourceRoot: (0, devkit_1.joinPathFragments)(options.e2eProjectRoot, 'src'),
82
78
  implicitDependencies: [options.projectName],
83
79
  },
84
80
  });
@@ -3,6 +3,7 @@ import { type NxRemixGeneratorSchema } from '../schema';
3
3
  export interface NormalizedSchema extends NxRemixGeneratorSchema {
4
4
  projectName: string;
5
5
  projectRoot: string;
6
+ importPath: string;
6
7
  e2eProjectName: string;
7
8
  e2eProjectRoot: string;
8
9
  parsedTags: string[];
@@ -5,10 +5,9 @@ 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
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");
9
8
  async function normalizeOptions(tree, options) {
10
- await (0, project_name_and_root_utils_1.ensureProjectName)(tree, options, 'application');
11
- const { projectName, projectRoot } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(tree, {
9
+ await (0, project_name_and_root_utils_1.ensureRootProjectName)(options, 'application');
10
+ const { projectName, projectRoot, importPath } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(tree, {
12
11
  name: options.name,
13
12
  projectType: 'application',
14
13
  directory: options.directory,
@@ -19,23 +18,23 @@ async function normalizeOptions(tree, options) {
19
18
  const addPluginDefault = process.env.NX_ADD_PLUGINS !== 'false' &&
20
19
  nxJson.useInferencePlugins !== false;
21
20
  options.addPlugin ??= addPluginDefault;
22
- const e2eProjectName = options.rootProject ? 'e2e' : `${projectName}-e2e`;
21
+ const isUsingTsSolutionConfig = (0, ts_solution_setup_1.isUsingTsSolutionSetup)(tree);
22
+ const appProjectName = !isUsingTsSolutionConfig || options.name ? projectName : importPath;
23
+ const e2eProjectName = options.rootProject ? 'e2e' : `${appProjectName}-e2e`;
23
24
  const e2eProjectRoot = options.rootProject ? 'e2e' : `${projectRoot}-e2e`;
24
25
  const parsedTags = options.tags
25
26
  ? options.tags.split(',').map((s) => s.trim())
26
27
  : [];
27
- const isUsingTsSolutionConfig = (0, ts_solution_setup_1.isUsingTsSolutionSetup)(tree);
28
28
  return {
29
29
  ...options,
30
30
  linter: options.linter ?? eslint_1.Linter.EsLint,
31
- projectName: isUsingTsSolutionConfig
32
- ? (0, get_import_path_1.getImportPath)(tree, projectName)
33
- : projectName,
31
+ projectName: appProjectName,
34
32
  projectRoot,
33
+ importPath,
35
34
  e2eProjectName,
36
35
  e2eProjectRoot,
37
36
  parsedTags,
38
- useTsSolution: options.useTsSolution ?? isUsingTsSolutionConfig,
37
+ useTsSolution: isUsingTsSolutionConfig,
39
38
  isUsingTsSolutionConfig,
40
39
  };
41
40
  }
@@ -3,19 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.addTsconfigEntryPoints = addTsconfigEntryPoints;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const js_1 = require("@nx/js");
6
- const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
6
+ const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
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 ? [sourceRoot] : [projectRoot, 'src']), 'server.ts');
9
+ const projectSourceRoot = (0, ts_solution_setup_1.getProjectSourceRoot)(tree, sourceRoot, projectRoot);
10
+ const serverFilePath = (0, devkit_1.joinPathFragments)(projectSourceRoot, 'server.ts');
10
11
  tree.write(serverFilePath, `// This file should be used to export ONLY server-code from the library.`);
11
12
  const baseTsConfig = (0, js_1.getRootTsConfigPathInTree)(tree);
12
- // Use same logic as `determineProjectNameAndRootOptions` to get the import path
13
- const importPath = (0, project_name_and_root_utils_1.resolveImportPath)(tree, options.name, projectRoot);
14
13
  (0, devkit_1.updateJson)(tree, baseTsConfig, (json) => {
15
- if (json.compilerOptions.paths && json.compilerOptions.paths[importPath]) {
16
- json.compilerOptions.paths[(0, devkit_1.joinPathFragments)(importPath, 'server')] = [
17
- serverFilePath,
18
- ];
14
+ if (json.compilerOptions.paths &&
15
+ json.compilerOptions.paths[options.importPath]) {
16
+ json.compilerOptions.paths[(0, devkit_1.joinPathFragments)(options.importPath, 'server')] = [serverFilePath];
19
17
  }
20
18
  return json;
21
19
  });
@@ -4,10 +4,9 @@ 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");
8
7
  async function normalizeOptions(tree, options) {
9
- await (0, project_name_and_root_utils_1.ensureProjectName)(tree, options, 'application');
10
- const { projectName, projectRoot } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(tree, {
8
+ await (0, project_name_and_root_utils_1.ensureRootProjectName)(options, 'application');
9
+ const { projectName, projectRoot, importPath } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(tree, {
11
10
  name: options.name,
12
11
  projectType: 'library',
13
12
  directory: options.directory,
@@ -20,10 +19,9 @@ async function normalizeOptions(tree, options) {
20
19
  return {
21
20
  ...options,
22
21
  unitTestRunner: options.unitTestRunner ?? 'vitest',
23
- projectName: isUsingTsSolutionConfig
24
- ? (0, get_import_path_1.getImportPath)(tree, projectName)
25
- : projectName,
22
+ projectName: isUsingTsSolutionConfig && !options.name ? importPath : projectName,
26
23
  projectRoot,
24
+ importPath,
27
25
  isUsingTsSolutionConfig,
28
26
  };
29
27
  }
@@ -13,7 +13,7 @@ function updateBuildableConfig(tree, options) {
13
13
  format: ['cjs'],
14
14
  outputPath: (0, devkit_1.joinPathFragments)(project.root, 'dist'),
15
15
  };
16
- (0, devkit_1.updateProjectConfiguration)(tree, options.name, project);
16
+ (0, devkit_1.updateProjectConfiguration)(tree, options.projectName, project);
17
17
  // Point to nested dist for yarn/npm/pnpm workspaces
18
18
  (0, devkit_1.updateJson)(tree, (0, devkit_1.joinPathFragments)(project.root, 'package.json'), (json) => {
19
19
  json.main = './dist/index.cjs.js';