@nx/remix 24.0.0-beta.1 → 24.0.0-beta.3
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/dist/src/generators/convert-to-inferred/convert-to-inferred.js +0 -1
- package/dist/src/migrations/update-24-0-0/register-typescript-plugin-for-typecheck.d.ts +4 -0
- package/dist/src/migrations/update-24-0-0/register-typescript-plugin-for-typecheck.js +13 -0
- package/dist/src/migrations/update-24-0-0/register-typescript-plugin-for-typecheck.md +40 -0
- package/dist/src/plugins/plugin.d.ts +0 -1
- package/dist/src/plugins/plugin.js +5 -42
- package/migrations.json +6 -0
- package/package.json +6 -6
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = update;
|
|
4
|
+
const devkit_1 = require("@nx/devkit");
|
|
5
|
+
const internal_1 = require("@nx/js/internal");
|
|
6
|
+
async function update(tree) {
|
|
7
|
+
if (!(0, internal_1.registerTypescriptPluginForTypecheck)(tree, '@nx/remix/plugin', {
|
|
8
|
+
removeTypecheckTargetName: true,
|
|
9
|
+
})) {
|
|
10
|
+
return { skipAgentic: true };
|
|
11
|
+
}
|
|
12
|
+
await (0, devkit_1.formatFiles)(tree);
|
|
13
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#### Register `@nx/js/typescript` for typecheck targets
|
|
2
|
+
|
|
3
|
+
`@nx/remix/plugin` no longer infers a `typecheck` target in any setup, and `@nx/js/typescript` provides it instead. This migration registers `@nx/js/typescript` with only its typecheck target when the workspace uses `@nx/remix/plugin` and doesn't register `@nx/js/typescript` yet, so your projects keep a `typecheck` target.
|
|
4
|
+
|
|
5
|
+
The new registration is added before the framework plugin and reuses its `typecheckTargetName`, and the migration then removes that option from `@nx/remix/plugin`. Registrations with `typecheckTargetName: false` have the option removed without registering `@nx/js/typescript`.
|
|
6
|
+
|
|
7
|
+
#### Sample code changes
|
|
8
|
+
|
|
9
|
+
##### Before
|
|
10
|
+
|
|
11
|
+
```json title="nx.json"
|
|
12
|
+
{
|
|
13
|
+
"plugins": [
|
|
14
|
+
{
|
|
15
|
+
"plugin": "@nx/remix/plugin",
|
|
16
|
+
"options": {
|
|
17
|
+
"buildTargetName": "build",
|
|
18
|
+
"typecheckTargetName": "typecheck"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
##### After
|
|
26
|
+
|
|
27
|
+
```json title="nx.json"
|
|
28
|
+
{
|
|
29
|
+
"plugins": [
|
|
30
|
+
{
|
|
31
|
+
"plugin": "@nx/js/typescript",
|
|
32
|
+
"options": { "typecheck": { "targetName": "typecheck" } }
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"plugin": "@nx/remix/plugin",
|
|
36
|
+
"options": { "buildTargetName": "build" }
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
```
|
|
@@ -31,7 +31,7 @@ exports.createNodes = [
|
|
|
31
31
|
let results = [];
|
|
32
32
|
let nodeErrors = [];
|
|
33
33
|
try {
|
|
34
|
-
results = await (0, devkit_1.createNodesFromFiles)((configFile, _, ctx, idx) => createNodesInternal(configFile, normalizedOptions, ctx, targetsCache, isUsingTsSolutionSetup, pmc, entries[idx].
|
|
34
|
+
results = await (0, devkit_1.createNodesFromFiles)((configFile, _, ctx, idx) => createNodesInternal(configFile, normalizedOptions, ctx, targetsCache, isUsingTsSolutionSetup, pmc, entries[idx].remixCompiler, projectHashes[idx] + configFile), entries.map((e) => e.configFile), options, context);
|
|
35
35
|
}
|
|
36
36
|
catch (e) {
|
|
37
37
|
if (e instanceof devkit_1.AggregateCreateNodesError) {
|
|
@@ -57,10 +57,10 @@ exports.createNodes = [
|
|
|
57
57
|
* @deprecated Migrate to React Router with `@nx/react`. This will be removed in Nx 25.
|
|
58
58
|
*/
|
|
59
59
|
exports.createNodesV2 = exports.createNodes;
|
|
60
|
-
async function createNodesInternal(configFilePath, options, context, targetsCache, isUsingTsSolutionSetup, pmc,
|
|
60
|
+
async function createNodesInternal(configFilePath, options, context, targetsCache, isUsingTsSolutionSetup, pmc, remixCompiler, hash) {
|
|
61
61
|
const projectRoot = (0, path_1.dirname)(configFilePath);
|
|
62
62
|
if (!targetsCache.has(hash)) {
|
|
63
|
-
targetsCache.set(hash, await buildRemixTargets(configFilePath, projectRoot, options, context,
|
|
63
|
+
targetsCache.set(hash, await buildRemixTargets(configFilePath, projectRoot, options, context, remixCompiler, isUsingTsSolutionSetup, pmc));
|
|
64
64
|
}
|
|
65
65
|
const { targets, metadata } = targetsCache.get(hash);
|
|
66
66
|
const project = {
|
|
@@ -74,7 +74,7 @@ async function createNodesInternal(configFilePath, options, context, targetsCach
|
|
|
74
74
|
},
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
|
-
async function buildRemixTargets(configFilePath, projectRoot, options, context,
|
|
77
|
+
async function buildRemixTargets(configFilePath, projectRoot, options, context, remixCompiler, isUsingTsSolutionSetup, pmc) {
|
|
78
78
|
const namedInputs = (0, internal_1.getNamedInputs)(projectRoot, context);
|
|
79
79
|
const { buildDirectory, assetsBuildDirectory, serverBuildPath } = await getBuildPaths(configFilePath, projectRoot, context.workspaceRoot, remixCompiler);
|
|
80
80
|
const targets = {};
|
|
@@ -82,7 +82,6 @@ async function buildRemixTargets(configFilePath, projectRoot, options, context,
|
|
|
82
82
|
targets[options.devTargetName] = devTarget(serverBuildPath, projectRoot, remixCompiler, namedInputs, isUsingTsSolutionSetup);
|
|
83
83
|
targets[options.startTargetName] = startTarget(projectRoot, serverBuildPath, options.buildTargetName, remixCompiler, namedInputs, isUsingTsSolutionSetup);
|
|
84
84
|
targets[options.serveStaticTargetName] = startTarget(projectRoot, serverBuildPath, options.buildTargetName, remixCompiler, namedInputs, isUsingTsSolutionSetup);
|
|
85
|
-
targets[options.typecheckTargetName] = typecheckTarget(options.typecheckTargetName, projectRoot, namedInputs, siblingFiles, isUsingTsSolutionSetup, pmc);
|
|
86
85
|
(0, internal_2.addBuildAndWatchDepsTargets)(context.workspaceRoot, projectRoot, targets, options, pmc);
|
|
87
86
|
return { targets, metadata: {} };
|
|
88
87
|
}
|
|
@@ -158,41 +157,6 @@ function startTarget(projectRoot, serverBuildPath, buildTargetName, remixCompile
|
|
|
158
157
|
}
|
|
159
158
|
return startTarget;
|
|
160
159
|
}
|
|
161
|
-
function typecheckTarget(typecheckTargetName, projectRoot, namedInputs, siblingFiles, isUsingTsSolutionSetup, pmc) {
|
|
162
|
-
const hasTsConfigAppJson = siblingFiles.includes('tsconfig.app.json');
|
|
163
|
-
const typecheckTarget = {
|
|
164
|
-
cache: true,
|
|
165
|
-
inputs: [
|
|
166
|
-
...('production' in namedInputs
|
|
167
|
-
? ['production', '^production']
|
|
168
|
-
: ['default', '^default']),
|
|
169
|
-
{ externalDependencies: ['typescript'] },
|
|
170
|
-
],
|
|
171
|
-
command: isUsingTsSolutionSetup
|
|
172
|
-
? `tsc --build --emitDeclarationOnly`
|
|
173
|
-
: `tsc${hasTsConfigAppJson ? ` -p tsconfig.app.json` : ``} --noEmit`,
|
|
174
|
-
options: {
|
|
175
|
-
cwd: projectRoot,
|
|
176
|
-
},
|
|
177
|
-
metadata: {
|
|
178
|
-
description: `Runs type-checking for the project.`,
|
|
179
|
-
technologies: ['typescript'],
|
|
180
|
-
help: {
|
|
181
|
-
command: isUsingTsSolutionSetup
|
|
182
|
-
? `${pmc.exec} tsc --build --help`
|
|
183
|
-
: `${pmc.exec} tsc${hasTsConfigAppJson ? ` -p tsconfig.app.json` : ``} --help`,
|
|
184
|
-
example: isUsingTsSolutionSetup
|
|
185
|
-
? { args: ['--force'] }
|
|
186
|
-
: { options: { noEmit: true } },
|
|
187
|
-
},
|
|
188
|
-
},
|
|
189
|
-
};
|
|
190
|
-
if (isUsingTsSolutionSetup) {
|
|
191
|
-
typecheckTarget.dependsOn = [`^${typecheckTargetName}`];
|
|
192
|
-
typecheckTarget.syncGenerators = ['@nx/js:typescript-sync'];
|
|
193
|
-
}
|
|
194
|
-
return typecheckTarget;
|
|
195
|
-
}
|
|
196
160
|
async function getBuildPaths(configFilePath, projectRoot, workspaceRoot, remixCompiler) {
|
|
197
161
|
const configPath = (0, path_1.join)(workspaceRoot, configFilePath);
|
|
198
162
|
if (remixCompiler === RemixCompiler.IsClassic) {
|
|
@@ -232,7 +196,6 @@ function normalizeOptions(options) {
|
|
|
232
196
|
options.buildTargetName ??= 'build';
|
|
233
197
|
options.devTargetName ??= 'dev';
|
|
234
198
|
options.startTargetName ??= 'start';
|
|
235
|
-
options.typecheckTargetName ??= 'typecheck';
|
|
236
199
|
options.serveStaticTargetName ??= 'serve-static';
|
|
237
200
|
return options;
|
|
238
201
|
}
|
|
@@ -272,7 +235,7 @@ async function filterRemixConfigs(configFilePaths, context) {
|
|
|
272
235
|
if (remixCompiler === RemixCompiler.IsNotRemix) {
|
|
273
236
|
return null;
|
|
274
237
|
}
|
|
275
|
-
return { configFile, projectRoot,
|
|
238
|
+
return { configFile, projectRoot, remixCompiler };
|
|
276
239
|
}
|
|
277
240
|
catch (e) {
|
|
278
241
|
preErrors.push([configFile, e]);
|
package/migrations.json
CHANGED
|
@@ -20,6 +20,12 @@
|
|
|
20
20
|
"version": "24.0.0-beta.0",
|
|
21
21
|
"description": "Migrate Remix v2 applications to React Router v7 with @nx/react, including Nx configuration and validation.",
|
|
22
22
|
"prompt": "./dist/src/migrations/update-24-0-0/migrate-to-react-router.md"
|
|
23
|
+
},
|
|
24
|
+
"update-24-0-0-register-typescript-plugin-for-typecheck": {
|
|
25
|
+
"version": "24.0.0-beta.3",
|
|
26
|
+
"description": "Register @nx/js/typescript with its typecheck target in workspaces that use @nx/remix/plugin without it, and remove the typecheckTargetName option from @nx/remix/plugin, since @nx/remix/plugin no longer infers typecheck targets.",
|
|
27
|
+
"implementation": "./dist/src/migrations/update-24-0-0/register-typescript-plugin-for-typecheck",
|
|
28
|
+
"documentation": "./dist/src/migrations/update-24-0-0/register-typescript-plugin-for-typecheck.md"
|
|
23
29
|
}
|
|
24
30
|
},
|
|
25
31
|
"packageJsonUpdates": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/remix",
|
|
3
|
-
"version": "24.0.0-beta.
|
|
3
|
+
"version": "24.0.0-beta.3",
|
|
4
4
|
"description": "Deprecated Remix v2 task inference for Nx. Generators and executors were removed in Nx 24, except convert-to-inferred. The remaining plugin will be removed in Nx 25. Migrate to React Router with @nx/react.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -52,16 +52,16 @@
|
|
|
52
52
|
"supportsOptionalMigrations": true
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@nx/devkit": "24.0.0-beta.
|
|
56
|
-
"@nx/js": "24.0.0-beta.
|
|
55
|
+
"@nx/devkit": "24.0.0-beta.3",
|
|
56
|
+
"@nx/js": "24.0.0-beta.3",
|
|
57
57
|
"tslib": "^2.3.0"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
|
-
"@nx/eslint": "24.0.0-beta.
|
|
61
|
-
"nx": "24.0.0-beta.
|
|
60
|
+
"@nx/eslint": "24.0.0-beta.3",
|
|
61
|
+
"nx": "24.0.0-beta.3"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
|
-
"@nx/cypress": "24.0.0-beta.
|
|
64
|
+
"@nx/cypress": "24.0.0-beta.3",
|
|
65
65
|
"@remix-run/dev": "^2.0.0"
|
|
66
66
|
},
|
|
67
67
|
"peerDependenciesMeta": {
|