@nx/remix 20.4.0 → 20.4.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",
3
+ "version": "20.4.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",
33
- "@nx/js": "20.4.0",
34
- "@nx/react": "20.4.0",
32
+ "@nx/devkit": "20.4.2",
33
+ "@nx/js": "20.4.2",
34
+ "@nx/react": "20.4.2",
35
35
  "tslib": "^2.3.1",
36
36
  "@phenomnomnominal/tsquery": "~5.0.1"
37
37
  },
@@ -73,7 +73,7 @@ exports[`@nx/remix/plugin Remix Classic Compiler non-root project should create
73
73
  },
74
74
  "tsc": {
75
75
  "cache": true,
76
- "command": "tsc",
76
+ "command": "tsc --noEmit",
77
77
  "inputs": [
78
78
  "production",
79
79
  "^production",
@@ -83,6 +83,20 @@ exports[`@nx/remix/plugin Remix Classic Compiler non-root project should create
83
83
  ],
84
84
  },
85
85
  ],
86
+ "metadata": {
87
+ "description": "Runs type-checking for the project.",
88
+ "help": {
89
+ "command": "npx tsc --help",
90
+ "example": {
91
+ "options": {
92
+ "noEmit": true,
93
+ },
94
+ },
95
+ },
96
+ "technologies": [
97
+ "typescript",
98
+ ],
99
+ },
86
100
  "options": {
87
101
  "cwd": "my-app",
88
102
  },
@@ -174,7 +188,7 @@ exports[`@nx/remix/plugin Remix Classic Compiler non-root project should infer w
174
188
  },
175
189
  "tsc": {
176
190
  "cache": true,
177
- "command": "tsc",
191
+ "command": "tsc --noEmit",
178
192
  "inputs": [
179
193
  "production",
180
194
  "^production",
@@ -184,6 +198,20 @@ exports[`@nx/remix/plugin Remix Classic Compiler non-root project should infer w
184
198
  ],
185
199
  },
186
200
  ],
201
+ "metadata": {
202
+ "description": "Runs type-checking for the project.",
203
+ "help": {
204
+ "command": "npx tsc --help",
205
+ "example": {
206
+ "options": {
207
+ "noEmit": true,
208
+ },
209
+ },
210
+ },
211
+ "technologies": [
212
+ "typescript",
213
+ ],
214
+ },
187
215
  "options": {
188
216
  "cwd": "my-app",
189
217
  },
@@ -270,7 +298,7 @@ exports[`@nx/remix/plugin Remix Classic Compiler root project should create node
270
298
  },
271
299
  "typecheck": {
272
300
  "cache": true,
273
- "command": "tsc",
301
+ "command": "tsc --noEmit",
274
302
  "inputs": [
275
303
  "production",
276
304
  "^production",
@@ -280,6 +308,20 @@ exports[`@nx/remix/plugin Remix Classic Compiler root project should create node
280
308
  ],
281
309
  },
282
310
  ],
311
+ "metadata": {
312
+ "description": "Runs type-checking for the project.",
313
+ "help": {
314
+ "command": "npx tsc --help",
315
+ "example": {
316
+ "options": {
317
+ "noEmit": true,
318
+ },
319
+ },
320
+ },
321
+ "technologies": [
322
+ "typescript",
323
+ ],
324
+ },
283
325
  "options": {
284
326
  "cwd": ".",
285
327
  },
@@ -364,7 +406,7 @@ exports[`@nx/remix/plugin Remix Vite Compiler non-root project should create nod
364
406
  },
365
407
  "tsc": {
366
408
  "cache": true,
367
- "command": "tsc",
409
+ "command": "tsc --noEmit",
368
410
  "inputs": [
369
411
  "production",
370
412
  "^production",
@@ -374,6 +416,20 @@ exports[`@nx/remix/plugin Remix Vite Compiler non-root project should create nod
374
416
  ],
375
417
  },
376
418
  ],
419
+ "metadata": {
420
+ "description": "Runs type-checking for the project.",
421
+ "help": {
422
+ "command": "npx tsc --help",
423
+ "example": {
424
+ "options": {
425
+ "noEmit": true,
426
+ },
427
+ },
428
+ },
429
+ "technologies": [
430
+ "typescript",
431
+ ],
432
+ },
377
433
  "options": {
378
434
  "cwd": "my-app",
379
435
  },
@@ -459,7 +515,7 @@ exports[`@nx/remix/plugin Remix Vite Compiler root project should create nodes 1
459
515
  },
460
516
  "typecheck": {
461
517
  "cache": true,
462
- "command": "tsc",
518
+ "command": "tsc --noEmit",
463
519
  "inputs": [
464
520
  "production",
465
521
  "^production",
@@ -469,6 +525,20 @@ exports[`@nx/remix/plugin Remix Vite Compiler root project should create nodes 1
469
525
  ],
470
526
  },
471
527
  ],
528
+ "metadata": {
529
+ "description": "Runs type-checking for the project.",
530
+ "help": {
531
+ "command": "npx tsc --help",
532
+ "example": {
533
+ "options": {
534
+ "noEmit": true,
535
+ },
536
+ },
537
+ },
538
+ "technologies": [
539
+ "typescript",
540
+ ],
541
+ },
472
542
  "options": {
473
543
  "cwd": ".",
474
544
  },
@@ -12,6 +12,7 @@ const path_1 = require("path");
12
12
  const fs_1 = require("fs");
13
13
  const executor_utils_1 = require("../utils/executor-utils");
14
14
  const util_1 = require("@nx/js/src/plugins/typescript/util");
15
+ const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
15
16
  const pmc = (0, devkit_1.getPackageManagerCommand)();
16
17
  function readTargetsCache(cachePath) {
17
18
  return (0, fs_1.existsSync)(cachePath) ? (0, devkit_1.readJsonFile)(cachePath) : {};
@@ -34,7 +35,7 @@ exports.createNodesV2 = [
34
35
  const cachePath = (0, path_1.join)(cache_directory_1.workspaceDataDirectory, `remix-${optionsHash}.hash`);
35
36
  const targetsCache = readTargetsCache(cachePath);
36
37
  try {
37
- return await (0, devkit_1.createNodesFromFiles)((configFile, options, context) => createNodesInternal(configFile, options, context, targetsCache), configFilePaths, options, context);
38
+ return await (0, devkit_1.createNodesFromFiles)((configFile, options, context) => createNodesInternal(configFile, options, context, targetsCache, (0, ts_solution_setup_1.isUsingTsSolutionSetup)()), configFilePaths, options, context);
38
39
  }
39
40
  finally {
40
41
  writeTargetsToCache(cachePath, targetsCache);
@@ -45,10 +46,10 @@ exports.createNodes = [
45
46
  remixConfigGlob,
46
47
  async (configFilePath, options, context) => {
47
48
  devkit_1.logger.warn('`createNodes` is deprecated. Update your plugin to utilize createNodesV2 instead. In Nx 20, this will change to the createNodesV2 API.');
48
- return createNodesInternal(configFilePath, options, context, {});
49
+ return createNodesInternal(configFilePath, options, context, {}, (0, ts_solution_setup_1.isUsingTsSolutionSetup)());
49
50
  },
50
51
  ];
51
- async function createNodesInternal(configFilePath, options, context, targetsCache) {
52
+ async function createNodesInternal(configFilePath, options, context, targetsCache, isUsingTsSolutionSetup) {
52
53
  const projectRoot = (0, path_1.dirname)(configFilePath);
53
54
  const fullyQualifiedProjectRoot = (0, path_1.join)(context.workspaceRoot, projectRoot);
54
55
  // Do not create a project if package.json and project.json isn't there
@@ -62,10 +63,8 @@ async function createNodesInternal(configFilePath, options, context, targetsCach
62
63
  if (remixCompiler === RemixCompiler.IsNotRemix) {
63
64
  return {};
64
65
  }
65
- const hash = (await (0, calculate_hash_for_create_nodes_1.calculateHashForCreateNodes)(projectRoot, options, context, [
66
- (0, js_1.getLockFileName)((0, devkit_1.detectPackageManager)(context.workspaceRoot)),
67
- ])) + configFilePath;
68
- targetsCache[hash] ??= await buildRemixTargets(configFilePath, projectRoot, options, context, siblingFiles, remixCompiler);
66
+ const hash = (await (0, calculate_hash_for_create_nodes_1.calculateHashForCreateNodes)(projectRoot, { ...options, isUsingTsSolutionSetup }, context, [(0, js_1.getLockFileName)((0, devkit_1.detectPackageManager)(context.workspaceRoot))])) + configFilePath;
67
+ targetsCache[hash] ??= await buildRemixTargets(configFilePath, projectRoot, options, context, siblingFiles, remixCompiler, isUsingTsSolutionSetup);
69
68
  const { targets, metadata } = targetsCache[hash];
70
69
  const project = {
71
70
  root: projectRoot,
@@ -78,21 +77,21 @@ async function createNodesInternal(configFilePath, options, context, targetsCach
78
77
  },
79
78
  };
80
79
  }
81
- async function buildRemixTargets(configFilePath, projectRoot, options, context, siblingFiles, remixCompiler) {
80
+ async function buildRemixTargets(configFilePath, projectRoot, options, context, siblingFiles, remixCompiler, isUsingTsSolutionSetup) {
82
81
  const namedInputs = (0, get_named_inputs_1.getNamedInputs)(projectRoot, context);
83
82
  const { buildDirectory, assetsBuildDirectory, serverBuildPath } = await getBuildPaths(configFilePath, projectRoot, context.workspaceRoot, remixCompiler);
84
83
  const targets = {};
85
- targets[options.buildTargetName] = buildTarget(options.buildTargetName, projectRoot, buildDirectory, assetsBuildDirectory, namedInputs, remixCompiler);
86
- targets[options.devTargetName] = devTarget(serverBuildPath, projectRoot, remixCompiler);
87
- targets[options.startTargetName] = startTarget(projectRoot, serverBuildPath, options.buildTargetName, remixCompiler);
84
+ targets[options.buildTargetName] = buildTarget(options.buildTargetName, projectRoot, buildDirectory, assetsBuildDirectory, namedInputs, remixCompiler, isUsingTsSolutionSetup);
85
+ targets[options.devTargetName] = devTarget(serverBuildPath, projectRoot, remixCompiler, isUsingTsSolutionSetup);
86
+ targets[options.startTargetName] = startTarget(projectRoot, serverBuildPath, options.buildTargetName, remixCompiler, isUsingTsSolutionSetup);
88
87
  // TODO(colum): Remove for Nx 21
89
- targets[options.staticServeTargetName] = startTarget(projectRoot, serverBuildPath, options.buildTargetName, remixCompiler);
90
- targets[options.serveStaticTargetName] = startTarget(projectRoot, serverBuildPath, options.buildTargetName, remixCompiler);
91
- targets[options.typecheckTargetName] = typecheckTarget(projectRoot, namedInputs, siblingFiles);
88
+ targets[options.staticServeTargetName] = startTarget(projectRoot, serverBuildPath, options.buildTargetName, remixCompiler, isUsingTsSolutionSetup);
89
+ targets[options.serveStaticTargetName] = startTarget(projectRoot, serverBuildPath, options.buildTargetName, remixCompiler, isUsingTsSolutionSetup);
90
+ targets[options.typecheckTargetName] = typecheckTarget(options.typecheckTargetName, projectRoot, namedInputs, siblingFiles, isUsingTsSolutionSetup);
92
91
  (0, util_1.addBuildAndWatchDepsTargets)(context.workspaceRoot, projectRoot, targets, options, pmc);
93
92
  return { targets, metadata: {} };
94
93
  }
95
- function buildTarget(buildTargetName, projectRoot, buildDirectory, assetsBuildDirectory, namedInputs, remixCompiler) {
94
+ function buildTarget(buildTargetName, projectRoot, buildDirectory, assetsBuildDirectory, namedInputs, remixCompiler, isUsingTsSolutionSetup) {
96
95
  const serverBuildOutputPath = projectRoot === '.'
97
96
  ? (0, devkit_1.joinPathFragments)(`{workspaceRoot}`, buildDirectory)
98
97
  : (0, devkit_1.joinPathFragments)(`{workspaceRoot}`, projectRoot, buildDirectory);
@@ -106,7 +105,7 @@ function buildTarget(buildTargetName, projectRoot, buildDirectory, assetsBuildDi
106
105
  : (0, devkit_1.joinPathFragments)(`{workspaceRoot}`, projectRoot, buildDirectory),
107
106
  ]
108
107
  : [serverBuildOutputPath, assetsBuildOutputPath];
109
- return {
108
+ const buildTarget = {
110
109
  cache: true,
111
110
  dependsOn: [`^${buildTargetName}`],
112
111
  inputs: [
@@ -121,35 +120,45 @@ function buildTarget(buildTargetName, projectRoot, buildDirectory, assetsBuildDi
121
120
  : 'remix build',
122
121
  options: { cwd: projectRoot },
123
122
  };
123
+ if (isUsingTsSolutionSetup) {
124
+ buildTarget.syncGenerators = ['@nx/js:typescript-sync'];
125
+ }
126
+ return buildTarget;
124
127
  }
125
- function devTarget(serverBuildPath, projectRoot, remixCompiler) {
126
- return {
128
+ function devTarget(serverBuildPath, projectRoot, remixCompiler, isUsingTsSolutionSetup) {
129
+ const devTarget = {
127
130
  command: remixCompiler === RemixCompiler.IsVte
128
131
  ? 'remix vite:dev'
129
132
  : 'remix dev --manual',
130
133
  options: { cwd: projectRoot },
131
134
  };
135
+ if (isUsingTsSolutionSetup) {
136
+ devTarget.syncGenerators = ['@nx/js:typescript-sync'];
137
+ }
138
+ return devTarget;
132
139
  }
133
- function startTarget(projectRoot, serverBuildPath, buildTargetName, remixCompiler) {
140
+ function startTarget(projectRoot, serverBuildPath, buildTargetName, remixCompiler, isUsingTsSolutionSetup) {
134
141
  let serverPath = serverBuildPath;
135
142
  if (remixCompiler === RemixCompiler.IsVte) {
136
143
  if (serverBuildPath === 'build') {
137
144
  serverPath = `${serverBuildPath}/server/index.js`;
138
145
  }
139
146
  }
140
- return {
147
+ const startTarget = {
141
148
  dependsOn: [buildTargetName],
142
149
  command: `remix-serve ${serverPath}`,
143
150
  options: {
144
151
  cwd: projectRoot,
145
152
  },
146
153
  };
154
+ if (isUsingTsSolutionSetup) {
155
+ startTarget.syncGenerators = ['@nx/js:typescript-sync'];
156
+ }
157
+ return startTarget;
147
158
  }
148
- function typecheckTarget(projectRoot, namedInputs, siblingFiles) {
159
+ function typecheckTarget(typecheckTargetName, projectRoot, namedInputs, siblingFiles, isUsingTsSolutionSetup) {
149
160
  const hasTsConfigAppJson = siblingFiles.includes('tsconfig.app.json');
150
- const command = `tsc${hasTsConfigAppJson ? ` --project tsconfig.app.json` : ``}`;
151
- return {
152
- command,
161
+ const typecheckTarget = {
153
162
  cache: true,
154
163
  inputs: [
155
164
  ...('production' in namedInputs
@@ -157,10 +166,30 @@ function typecheckTarget(projectRoot, namedInputs, siblingFiles) {
157
166
  : ['default', '^default']),
158
167
  { externalDependencies: ['typescript'] },
159
168
  ],
169
+ command: isUsingTsSolutionSetup
170
+ ? `tsc --build --emitDeclarationOnly`
171
+ : `tsc${hasTsConfigAppJson ? ` -p tsconfig.app.json` : ``} --noEmit`,
160
172
  options: {
161
173
  cwd: projectRoot,
162
174
  },
175
+ metadata: {
176
+ description: `Runs type-checking for the project.`,
177
+ technologies: ['typescript'],
178
+ help: {
179
+ command: isUsingTsSolutionSetup
180
+ ? `${pmc.exec} tsc --build --help`
181
+ : `${pmc.exec} tsc${hasTsConfigAppJson ? ` -p tsconfig.app.json` : ``} --help`,
182
+ example: isUsingTsSolutionSetup
183
+ ? { args: ['--force'] }
184
+ : { options: { noEmit: true } },
185
+ },
186
+ },
163
187
  };
188
+ if (isUsingTsSolutionSetup) {
189
+ typecheckTarget.dependsOn = [`^${typecheckTargetName}`];
190
+ typecheckTarget.syncGenerators = ['@nx/js:typescript-sync'];
191
+ }
192
+ return typecheckTarget;
164
193
  }
165
194
  async function getBuildPaths(configFilePath, projectRoot, workspaceRoot, remixCompiler) {
166
195
  const configPath = (0, path_1.join)(workspaceRoot, configFilePath);