@nx/remix 20.4.3 → 20.5.0-beta.0
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.
|
|
3
|
+
"version": "20.5.0-beta.0",
|
|
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.
|
|
33
|
-
"@nx/js": "20.
|
|
34
|
-
"@nx/react": "20.
|
|
32
|
+
"@nx/devkit": "20.5.0-beta.0",
|
|
33
|
+
"@nx/js": "20.5.0-beta.0",
|
|
34
|
+
"@nx/react": "20.5.0-beta.0",
|
|
35
35
|
"tslib": "^2.3.1",
|
|
36
36
|
"@phenomnomnominal/tsquery": "~5.0.1"
|
|
37
37
|
},
|
|
@@ -115,6 +115,7 @@ async function remixApplicationGeneratorInternal(tree, _options) {
|
|
|
115
115
|
skipPackageJson: false,
|
|
116
116
|
skipFormat: true,
|
|
117
117
|
addPlugin: true,
|
|
118
|
+
compiler: options.useTsSolution ? 'swc' : undefined,
|
|
118
119
|
});
|
|
119
120
|
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.projectName);
|
|
120
121
|
if (projectConfig.targets?.['test']?.options) {
|
|
@@ -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",
|
|
77
77
|
"inputs": [
|
|
78
78
|
"production",
|
|
79
79
|
"^production",
|
|
@@ -83,20 +83,6 @@ 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
|
-
},
|
|
100
86
|
"options": {
|
|
101
87
|
"cwd": "my-app",
|
|
102
88
|
},
|
|
@@ -188,7 +174,7 @@ exports[`@nx/remix/plugin Remix Classic Compiler non-root project should infer w
|
|
|
188
174
|
},
|
|
189
175
|
"tsc": {
|
|
190
176
|
"cache": true,
|
|
191
|
-
"command": "tsc
|
|
177
|
+
"command": "tsc",
|
|
192
178
|
"inputs": [
|
|
193
179
|
"production",
|
|
194
180
|
"^production",
|
|
@@ -198,20 +184,6 @@ exports[`@nx/remix/plugin Remix Classic Compiler non-root project should infer w
|
|
|
198
184
|
],
|
|
199
185
|
},
|
|
200
186
|
],
|
|
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
|
-
},
|
|
215
187
|
"options": {
|
|
216
188
|
"cwd": "my-app",
|
|
217
189
|
},
|
|
@@ -298,7 +270,7 @@ exports[`@nx/remix/plugin Remix Classic Compiler root project should create node
|
|
|
298
270
|
},
|
|
299
271
|
"typecheck": {
|
|
300
272
|
"cache": true,
|
|
301
|
-
"command": "tsc
|
|
273
|
+
"command": "tsc",
|
|
302
274
|
"inputs": [
|
|
303
275
|
"production",
|
|
304
276
|
"^production",
|
|
@@ -308,20 +280,6 @@ exports[`@nx/remix/plugin Remix Classic Compiler root project should create node
|
|
|
308
280
|
],
|
|
309
281
|
},
|
|
310
282
|
],
|
|
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
|
-
},
|
|
325
283
|
"options": {
|
|
326
284
|
"cwd": ".",
|
|
327
285
|
},
|
|
@@ -406,7 +364,7 @@ exports[`@nx/remix/plugin Remix Vite Compiler non-root project should create nod
|
|
|
406
364
|
},
|
|
407
365
|
"tsc": {
|
|
408
366
|
"cache": true,
|
|
409
|
-
"command": "tsc
|
|
367
|
+
"command": "tsc",
|
|
410
368
|
"inputs": [
|
|
411
369
|
"production",
|
|
412
370
|
"^production",
|
|
@@ -416,20 +374,6 @@ exports[`@nx/remix/plugin Remix Vite Compiler non-root project should create nod
|
|
|
416
374
|
],
|
|
417
375
|
},
|
|
418
376
|
],
|
|
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
|
-
},
|
|
433
377
|
"options": {
|
|
434
378
|
"cwd": "my-app",
|
|
435
379
|
},
|
|
@@ -515,7 +459,7 @@ exports[`@nx/remix/plugin Remix Vite Compiler root project should create nodes 1
|
|
|
515
459
|
},
|
|
516
460
|
"typecheck": {
|
|
517
461
|
"cache": true,
|
|
518
|
-
"command": "tsc
|
|
462
|
+
"command": "tsc",
|
|
519
463
|
"inputs": [
|
|
520
464
|
"production",
|
|
521
465
|
"^production",
|
|
@@ -525,20 +469,6 @@ exports[`@nx/remix/plugin Remix Vite Compiler root project should create nodes 1
|
|
|
525
469
|
],
|
|
526
470
|
},
|
|
527
471
|
],
|
|
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
|
-
},
|
|
542
472
|
"options": {
|
|
543
473
|
"cwd": ".",
|
|
544
474
|
},
|
package/src/plugins/plugin.js
CHANGED
|
@@ -12,7 +12,6 @@ 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");
|
|
16
15
|
const pmc = (0, devkit_1.getPackageManagerCommand)();
|
|
17
16
|
function readTargetsCache(cachePath) {
|
|
18
17
|
return (0, fs_1.existsSync)(cachePath) ? (0, devkit_1.readJsonFile)(cachePath) : {};
|
|
@@ -35,7 +34,7 @@ exports.createNodesV2 = [
|
|
|
35
34
|
const cachePath = (0, path_1.join)(cache_directory_1.workspaceDataDirectory, `remix-${optionsHash}.hash`);
|
|
36
35
|
const targetsCache = readTargetsCache(cachePath);
|
|
37
36
|
try {
|
|
38
|
-
return await (0, devkit_1.createNodesFromFiles)((configFile, options, context) => createNodesInternal(configFile, options, context, targetsCache
|
|
37
|
+
return await (0, devkit_1.createNodesFromFiles)((configFile, options, context) => createNodesInternal(configFile, options, context, targetsCache), configFilePaths, options, context);
|
|
39
38
|
}
|
|
40
39
|
finally {
|
|
41
40
|
writeTargetsToCache(cachePath, targetsCache);
|
|
@@ -46,10 +45,10 @@ exports.createNodes = [
|
|
|
46
45
|
remixConfigGlob,
|
|
47
46
|
async (configFilePath, options, context) => {
|
|
48
47
|
devkit_1.logger.warn('`createNodes` is deprecated. Update your plugin to utilize createNodesV2 instead. In Nx 20, this will change to the createNodesV2 API.');
|
|
49
|
-
return createNodesInternal(configFilePath, options, context, {}
|
|
48
|
+
return createNodesInternal(configFilePath, options, context, {});
|
|
50
49
|
},
|
|
51
50
|
];
|
|
52
|
-
async function createNodesInternal(configFilePath, options, context, targetsCache
|
|
51
|
+
async function createNodesInternal(configFilePath, options, context, targetsCache) {
|
|
53
52
|
const projectRoot = (0, path_1.dirname)(configFilePath);
|
|
54
53
|
const fullyQualifiedProjectRoot = (0, path_1.join)(context.workspaceRoot, projectRoot);
|
|
55
54
|
// Do not create a project if package.json and project.json isn't there
|
|
@@ -63,8 +62,10 @@ async function createNodesInternal(configFilePath, options, context, targetsCach
|
|
|
63
62
|
if (remixCompiler === RemixCompiler.IsNotRemix) {
|
|
64
63
|
return {};
|
|
65
64
|
}
|
|
66
|
-
const hash = (await (0, calculate_hash_for_create_nodes_1.calculateHashForCreateNodes)(projectRoot,
|
|
67
|
-
|
|
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);
|
|
68
69
|
const { targets, metadata } = targetsCache[hash];
|
|
69
70
|
const project = {
|
|
70
71
|
root: projectRoot,
|
|
@@ -77,21 +78,21 @@ async function createNodesInternal(configFilePath, options, context, targetsCach
|
|
|
77
78
|
},
|
|
78
79
|
};
|
|
79
80
|
}
|
|
80
|
-
async function buildRemixTargets(configFilePath, projectRoot, options, context, siblingFiles, remixCompiler
|
|
81
|
+
async function buildRemixTargets(configFilePath, projectRoot, options, context, siblingFiles, remixCompiler) {
|
|
81
82
|
const namedInputs = (0, get_named_inputs_1.getNamedInputs)(projectRoot, context);
|
|
82
83
|
const { buildDirectory, assetsBuildDirectory, serverBuildPath } = await getBuildPaths(configFilePath, projectRoot, context.workspaceRoot, remixCompiler);
|
|
83
84
|
const targets = {};
|
|
84
|
-
targets[options.buildTargetName] = buildTarget(options.buildTargetName, projectRoot, buildDirectory, assetsBuildDirectory, namedInputs, remixCompiler
|
|
85
|
-
targets[options.devTargetName] = devTarget(serverBuildPath, projectRoot, remixCompiler
|
|
86
|
-
targets[options.startTargetName] = startTarget(projectRoot, serverBuildPath, options.buildTargetName, remixCompiler
|
|
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);
|
|
87
88
|
// TODO(colum): Remove for Nx 21
|
|
88
|
-
targets[options.staticServeTargetName] = startTarget(projectRoot, serverBuildPath, options.buildTargetName, remixCompiler
|
|
89
|
-
targets[options.serveStaticTargetName] = startTarget(projectRoot, serverBuildPath, options.buildTargetName, remixCompiler
|
|
90
|
-
targets[options.typecheckTargetName] = typecheckTarget(
|
|
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);
|
|
91
92
|
(0, util_1.addBuildAndWatchDepsTargets)(context.workspaceRoot, projectRoot, targets, options, pmc);
|
|
92
93
|
return { targets, metadata: {} };
|
|
93
94
|
}
|
|
94
|
-
function buildTarget(buildTargetName, projectRoot, buildDirectory, assetsBuildDirectory, namedInputs, remixCompiler
|
|
95
|
+
function buildTarget(buildTargetName, projectRoot, buildDirectory, assetsBuildDirectory, namedInputs, remixCompiler) {
|
|
95
96
|
const serverBuildOutputPath = projectRoot === '.'
|
|
96
97
|
? (0, devkit_1.joinPathFragments)(`{workspaceRoot}`, buildDirectory)
|
|
97
98
|
: (0, devkit_1.joinPathFragments)(`{workspaceRoot}`, projectRoot, buildDirectory);
|
|
@@ -105,7 +106,7 @@ function buildTarget(buildTargetName, projectRoot, buildDirectory, assetsBuildDi
|
|
|
105
106
|
: (0, devkit_1.joinPathFragments)(`{workspaceRoot}`, projectRoot, buildDirectory),
|
|
106
107
|
]
|
|
107
108
|
: [serverBuildOutputPath, assetsBuildOutputPath];
|
|
108
|
-
|
|
109
|
+
return {
|
|
109
110
|
cache: true,
|
|
110
111
|
dependsOn: [`^${buildTargetName}`],
|
|
111
112
|
inputs: [
|
|
@@ -120,45 +121,35 @@ function buildTarget(buildTargetName, projectRoot, buildDirectory, assetsBuildDi
|
|
|
120
121
|
: 'remix build',
|
|
121
122
|
options: { cwd: projectRoot },
|
|
122
123
|
};
|
|
123
|
-
if (isUsingTsSolutionSetup) {
|
|
124
|
-
buildTarget.syncGenerators = ['@nx/js:typescript-sync'];
|
|
125
|
-
}
|
|
126
|
-
return buildTarget;
|
|
127
124
|
}
|
|
128
|
-
function devTarget(serverBuildPath, projectRoot, remixCompiler
|
|
129
|
-
|
|
125
|
+
function devTarget(serverBuildPath, projectRoot, remixCompiler) {
|
|
126
|
+
return {
|
|
130
127
|
command: remixCompiler === RemixCompiler.IsVte
|
|
131
128
|
? 'remix vite:dev'
|
|
132
129
|
: 'remix dev --manual',
|
|
133
130
|
options: { cwd: projectRoot },
|
|
134
131
|
};
|
|
135
|
-
if (isUsingTsSolutionSetup) {
|
|
136
|
-
devTarget.syncGenerators = ['@nx/js:typescript-sync'];
|
|
137
|
-
}
|
|
138
|
-
return devTarget;
|
|
139
132
|
}
|
|
140
|
-
function startTarget(projectRoot, serverBuildPath, buildTargetName, remixCompiler
|
|
133
|
+
function startTarget(projectRoot, serverBuildPath, buildTargetName, remixCompiler) {
|
|
141
134
|
let serverPath = serverBuildPath;
|
|
142
135
|
if (remixCompiler === RemixCompiler.IsVte) {
|
|
143
136
|
if (serverBuildPath === 'build') {
|
|
144
137
|
serverPath = `${serverBuildPath}/server/index.js`;
|
|
145
138
|
}
|
|
146
139
|
}
|
|
147
|
-
|
|
140
|
+
return {
|
|
148
141
|
dependsOn: [buildTargetName],
|
|
149
142
|
command: `remix-serve ${serverPath}`,
|
|
150
143
|
options: {
|
|
151
144
|
cwd: projectRoot,
|
|
152
145
|
},
|
|
153
146
|
};
|
|
154
|
-
if (isUsingTsSolutionSetup) {
|
|
155
|
-
startTarget.syncGenerators = ['@nx/js:typescript-sync'];
|
|
156
|
-
}
|
|
157
|
-
return startTarget;
|
|
158
147
|
}
|
|
159
|
-
function typecheckTarget(
|
|
148
|
+
function typecheckTarget(projectRoot, namedInputs, siblingFiles) {
|
|
160
149
|
const hasTsConfigAppJson = siblingFiles.includes('tsconfig.app.json');
|
|
161
|
-
const
|
|
150
|
+
const command = `tsc${hasTsConfigAppJson ? ` --project tsconfig.app.json` : ``}`;
|
|
151
|
+
return {
|
|
152
|
+
command,
|
|
162
153
|
cache: true,
|
|
163
154
|
inputs: [
|
|
164
155
|
...('production' in namedInputs
|
|
@@ -166,30 +157,10 @@ function typecheckTarget(typecheckTargetName, projectRoot, namedInputs, siblingF
|
|
|
166
157
|
: ['default', '^default']),
|
|
167
158
|
{ externalDependencies: ['typescript'] },
|
|
168
159
|
],
|
|
169
|
-
command: isUsingTsSolutionSetup
|
|
170
|
-
? `tsc --build --emitDeclarationOnly`
|
|
171
|
-
: `tsc${hasTsConfigAppJson ? ` -p tsconfig.app.json` : ``} --noEmit`,
|
|
172
160
|
options: {
|
|
173
161
|
cwd: projectRoot,
|
|
174
162
|
},
|
|
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
|
-
},
|
|
187
163
|
};
|
|
188
|
-
if (isUsingTsSolutionSetup) {
|
|
189
|
-
typecheckTarget.dependsOn = [`^${typecheckTargetName}`];
|
|
190
|
-
typecheckTarget.syncGenerators = ['@nx/js:typescript-sync'];
|
|
191
|
-
}
|
|
192
|
-
return typecheckTarget;
|
|
193
164
|
}
|
|
194
165
|
async function getBuildPaths(configFilePath, projectRoot, workspaceRoot, remixCompiler) {
|
|
195
166
|
const configPath = (0, path_1.join)(workspaceRoot, configFilePath);
|