@remix-run/cli 0.3.3 → 0.4.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/README.md +105 -1
- package/dist/index.js +1 -1
- package/dist/lib/app-root.d.ts +11 -0
- package/dist/lib/app-root.d.ts.map +1 -0
- package/dist/lib/app-root.js +38 -0
- package/dist/lib/bootstrap-project.js +2 -2
- package/dist/lib/cli-context.d.ts +6 -0
- package/dist/lib/cli-context.d.ts.map +1 -1
- package/dist/lib/cli-context.js +12 -1
- package/dist/lib/cli.d.ts +3 -2
- package/dist/lib/cli.d.ts.map +1 -1
- package/dist/lib/cli.js +42 -14
- package/dist/lib/commands/completion.js +4 -4
- package/dist/lib/commands/db.d.ts +4 -0
- package/dist/lib/commands/db.d.ts.map +1 -0
- package/dist/lib/commands/db.js +283 -0
- package/dist/lib/commands/doctor.d.ts +5 -0
- package/dist/lib/commands/doctor.d.ts.map +1 -1
- package/dist/lib/commands/doctor.js +26 -251
- package/dist/lib/commands/help.d.ts.map +1 -1
- package/dist/lib/commands/help.js +17 -9
- package/dist/lib/commands/new.js +6 -6
- package/dist/lib/commands/routes.js +6 -6
- package/dist/lib/commands/test.d.ts +20 -1
- package/dist/lib/commands/test.d.ts.map +1 -1
- package/dist/lib/commands/test.js +353 -10
- package/dist/lib/commands/version.js +3 -3
- package/dist/lib/completion.d.ts +1 -1
- package/dist/lib/completion.d.ts.map +1 -1
- package/dist/lib/completion.js +229 -6
- package/dist/lib/controller-files.d.ts +0 -8
- package/dist/lib/controller-files.d.ts.map +1 -1
- package/dist/lib/controller-files.js +0 -23
- package/dist/lib/controller-ownership.d.ts +4 -12
- package/dist/lib/controller-ownership.d.ts.map +1 -1
- package/dist/lib/controller-ownership.js +31 -127
- package/dist/lib/database-command.d.ts +20 -0
- package/dist/lib/database-command.d.ts.map +1 -0
- package/dist/lib/database-command.js +7 -0
- package/dist/lib/doctor/controller-findings.d.ts +2 -2
- package/dist/lib/doctor/controller-findings.d.ts.map +1 -1
- package/dist/lib/doctor/controller-findings.js +23 -39
- package/dist/lib/doctor/controllers.d.ts +1 -2
- package/dist/lib/doctor/controllers.d.ts.map +1 -1
- package/dist/lib/doctor/controllers.js +4 -7
- package/dist/lib/doctor/environment.js +2 -2
- package/dist/lib/doctor/fixes.d.ts.map +1 -1
- package/dist/lib/doctor/fixes.js +46 -7
- package/dist/lib/doctor/project.d.ts.map +1 -1
- package/dist/lib/doctor/project.js +3 -212
- package/dist/lib/doctor/run.d.ts +9 -0
- package/dist/lib/doctor/run.d.ts.map +1 -0
- package/dist/lib/doctor/run.js +237 -0
- package/dist/lib/doctor/types.d.ts +2 -1
- package/dist/lib/doctor/types.d.ts.map +1 -1
- package/dist/lib/doctor/types.js +4 -1
- package/dist/lib/errors.d.ts +30 -0
- package/dist/lib/errors.d.ts.map +1 -1
- package/dist/lib/errors.js +55 -0
- package/dist/lib/help-text.js +1 -1
- package/dist/lib/parse-args.d.ts.map +1 -1
- package/dist/lib/parse-args.js +17 -4
- package/dist/lib/remix-config.d.ts +75 -0
- package/dist/lib/remix-config.d.ts.map +1 -0
- package/dist/lib/remix-config.js +411 -0
- package/dist/lib/reporter.js +1 -1
- package/dist/lib/route-map.js +13 -33
- package/package.json +12 -6
- package/schema/remix.json +242 -0
- package/src/lib/app-root.ts +46 -0
- package/src/lib/cli-context.ts +17 -0
- package/src/lib/cli.ts +41 -6
- package/src/lib/commands/db.ts +377 -0
- package/src/lib/commands/doctor.ts +27 -329
- package/src/lib/commands/help.ts +10 -1
- package/src/lib/commands/test.ts +453 -12
- package/src/lib/completion.ts +321 -6
- package/src/lib/controller-files.ts +0 -38
- package/src/lib/controller-ownership.ts +50 -203
- package/src/lib/database-command.ts +31 -0
- package/src/lib/doctor/controller-findings.ts +30 -47
- package/src/lib/doctor/controllers.ts +2 -6
- package/src/lib/doctor/fixes.ts +55 -6
- package/src/lib/doctor/project.ts +0 -236
- package/src/lib/doctor/run.ts +311 -0
- package/src/lib/doctor/types.ts +6 -5
- package/src/lib/errors.ts +65 -0
- package/src/lib/parse-args.ts +19 -3
- package/src/lib/remix-config.ts +639 -0
- package/src/lib/route-map.ts +11 -48
- package/template/.agents/skills/remix/SKILL.md +39 -28
- package/template/.agents/skills/remix/references/assets-and-browser-modules.md +53 -10
- package/template/.agents/skills/remix/references/auth-and-sessions.md +5 -5
- package/template/.agents/skills/remix/references/data-and-validation.md +15 -15
- package/template/.agents/skills/remix/references/hydration-frames-navigation.md +54 -8
- package/template/.agents/skills/remix/references/middleware-and-server.md +68 -6
- package/template/.agents/skills/remix/references/mixins-styling-events.md +2 -0
- package/template/.agents/skills/remix/references/routing-and-controllers.md +8 -8
- package/template/.agents/skills/remix/references/testing-patterns.md +19 -18
- package/template/AGENTS.md +6 -3
- package/template/README.md +6 -3
- package/template/app/actions/controller.tsx +1 -1
- package/template/app/{ui → actions}/document.tsx +7 -5
- package/template/app/{ui/scaffold-home-page.tsx → actions/home-page.tsx} +2 -3
- package/template/app/actions/public/entry.ts +48 -0
- package/template/app/{assets → actions/public}/prompt-button.tsx +29 -25
- package/template/app/assets.ts +19 -8
- package/template/app/middleware/render.tsx +29 -1
- package/template/hmr.ts +46 -0
- package/template/package.json +4 -3
- package/template/server.ts +8 -1
- package/template/tsconfig.json +1 -1
- package/dist/lib/doctor/controller-fix-plans.d.ts +0 -4
- package/dist/lib/doctor/controller-fix-plans.d.ts.map +0 -1
- package/dist/lib/doctor/controller-fix-plans.js +0 -119
- package/dist/lib/doctor/controller-placeholders.d.ts +0 -3
- package/dist/lib/doctor/controller-placeholders.d.ts.map +0 -1
- package/dist/lib/doctor/controller-placeholders.js +0 -52
- package/src/lib/doctor/controller-fix-plans.ts +0 -168
- package/src/lib/doctor/controller-placeholders.ts +0 -70
- package/template/app/assets/entry.ts +0 -8
package/src/lib/errors.ts
CHANGED
|
@@ -28,6 +28,16 @@ export const CLI_ERROR_DEFINITIONS = {
|
|
|
28
28
|
title: 'Could not determine an app name',
|
|
29
29
|
fix: 'Pass --app-name or choose a target directory name that can become an app name.',
|
|
30
30
|
},
|
|
31
|
+
dbConfigRequired: {
|
|
32
|
+
code: 'RMX_DB_CONFIG_REQUIRED',
|
|
33
|
+
title: 'Database configuration is required',
|
|
34
|
+
fix: 'Add a db configuration to remix.json.',
|
|
35
|
+
},
|
|
36
|
+
dbForceRequired: {
|
|
37
|
+
code: 'RMX_DB_FORCE_REQUIRED',
|
|
38
|
+
title: 'Destructive database command requires --force',
|
|
39
|
+
fix: 'Re-run with --force to confirm.',
|
|
40
|
+
},
|
|
31
41
|
remixVersionUnavailable: {
|
|
32
42
|
code: 'RMX_REMIX_VERSION_UNAVAILABLE',
|
|
33
43
|
title: 'Could not determine the Remix version',
|
|
@@ -55,6 +65,16 @@ export const CLI_ERROR_DEFINITIONS = {
|
|
|
55
65
|
title: 'Could not derive a valid package name',
|
|
56
66
|
fix: 'Choose an app name that can be normalized into a valid npm package name.',
|
|
57
67
|
},
|
|
68
|
+
invalidOptionValue: {
|
|
69
|
+
code: 'RMX_INVALID_OPTION_VALUE',
|
|
70
|
+
title: 'Invalid option value',
|
|
71
|
+
fix: 'Check the command help for the supported option syntax.',
|
|
72
|
+
},
|
|
73
|
+
invalidRemixConfig: {
|
|
74
|
+
code: 'RMX_INVALID_CONFIG',
|
|
75
|
+
title: 'Invalid Remix configuration',
|
|
76
|
+
fix: 'Correct the configuration file and try again.',
|
|
77
|
+
},
|
|
58
78
|
missingOptionValue: {
|
|
59
79
|
code: 'RMX_MISSING_OPTION_VALUE',
|
|
60
80
|
title: 'Missing option value',
|
|
@@ -70,6 +90,11 @@ export const CLI_ERROR_DEFINITIONS = {
|
|
|
70
90
|
title: 'Could not find a project root',
|
|
71
91
|
fix: 'Run this command inside a Remix project.',
|
|
72
92
|
},
|
|
93
|
+
remixConfigNotFound: {
|
|
94
|
+
code: 'RMX_CONFIG_NOT_FOUND',
|
|
95
|
+
title: 'Remix configuration not found',
|
|
96
|
+
fix: 'Check the --config path and try again.',
|
|
97
|
+
},
|
|
73
98
|
remoteSkillDataMissing: {
|
|
74
99
|
code: 'RMX_REMOTE_SKILL_DATA_MISSING',
|
|
75
100
|
title: 'Could not find remote Remix skill data',
|
|
@@ -169,6 +194,20 @@ export function appNameUnavailable(targetDir?: string): UsageError {
|
|
|
169
194
|
})
|
|
170
195
|
}
|
|
171
196
|
|
|
197
|
+
export function dbConfigRequired(filePath: string): CliError {
|
|
198
|
+
return createCliError(CLI_ERROR_DEFINITIONS.dbConfigRequired, {
|
|
199
|
+
context: { filePath },
|
|
200
|
+
message: `Database configuration is missing from ${filePath}.`,
|
|
201
|
+
})
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
export function dbForceRequired(command: string): UsageError {
|
|
205
|
+
return createUsageError(CLI_ERROR_DEFINITIONS.dbForceRequired, {
|
|
206
|
+
context: { command },
|
|
207
|
+
message: `\`remix db ${command}\` destroys data in the current app database.`,
|
|
208
|
+
})
|
|
209
|
+
}
|
|
210
|
+
|
|
172
211
|
export function remixVersionUnavailable(): CliError {
|
|
173
212
|
return createCliError(CLI_ERROR_DEFINITIONS.remixVersionUnavailable, {
|
|
174
213
|
message: 'Could not determine the current Remix version.',
|
|
@@ -201,6 +240,25 @@ export function invalidPackageName(input: string): UsageError {
|
|
|
201
240
|
})
|
|
202
241
|
}
|
|
203
242
|
|
|
243
|
+
export function invalidOptionValue(details: string): UsageError {
|
|
244
|
+
return createUsageError(CLI_ERROR_DEFINITIONS.invalidOptionValue, {
|
|
245
|
+
context: { details },
|
|
246
|
+
message: details,
|
|
247
|
+
})
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
export function invalidRemixConfig(
|
|
251
|
+
filePath: string,
|
|
252
|
+
details: string,
|
|
253
|
+
line: number,
|
|
254
|
+
column: number,
|
|
255
|
+
): CliError {
|
|
256
|
+
return createCliError(CLI_ERROR_DEFINITIONS.invalidRemixConfig, {
|
|
257
|
+
context: { column, filePath, line },
|
|
258
|
+
message: `${filePath}:${line}:${column}: ${details}`,
|
|
259
|
+
})
|
|
260
|
+
}
|
|
261
|
+
|
|
204
262
|
export function missingOptionValue(option: string): UsageError {
|
|
205
263
|
return createUsageError(CLI_ERROR_DEFINITIONS.missingOptionValue, {
|
|
206
264
|
context: { option },
|
|
@@ -221,6 +279,13 @@ export function projectRootNotFound(startDir?: string): CliError {
|
|
|
221
279
|
})
|
|
222
280
|
}
|
|
223
281
|
|
|
282
|
+
export function remixConfigNotFound(filePath: string): CliError {
|
|
283
|
+
return createCliError(CLI_ERROR_DEFINITIONS.remixConfigNotFound, {
|
|
284
|
+
context: { filePath },
|
|
285
|
+
message: `Could not find Remix configuration file: ${filePath}`,
|
|
286
|
+
})
|
|
287
|
+
}
|
|
288
|
+
|
|
224
289
|
export function remoteSkillDataMissing(name: string): CliError {
|
|
225
290
|
return createCliError(CLI_ERROR_DEFINITIONS.remoteSkillDataMissing, {
|
|
226
291
|
context: { name },
|
package/src/lib/parse-args.ts
CHANGED
|
@@ -49,17 +49,33 @@ export function parseArgs<const definitions extends ParseArgsOptionDefinitions>(
|
|
|
49
49
|
|
|
50
50
|
for (let index = 0; index < argv.length; index++) {
|
|
51
51
|
let arg = argv[index]!
|
|
52
|
-
let
|
|
52
|
+
let equalsIndex = arg.indexOf('=')
|
|
53
|
+
let flag = equalsIndex === -1 ? arg : arg.slice(0, equalsIndex)
|
|
54
|
+
let inlineValue = equalsIndex === -1 ? undefined : arg.slice(equalsIndex + 1)
|
|
55
|
+
let resolved = specsByFlag.get(flag)
|
|
53
56
|
|
|
54
57
|
if (resolved != null) {
|
|
55
58
|
if (resolved.spec.type === 'boolean') {
|
|
59
|
+
if (inlineValue !== undefined) {
|
|
60
|
+
throw unknownArgument(arg)
|
|
61
|
+
}
|
|
62
|
+
|
|
56
63
|
values[resolved.key] = true as ParsedArgsValues<definitions>[typeof resolved.key]
|
|
57
64
|
continue
|
|
58
65
|
}
|
|
59
66
|
|
|
67
|
+
if (inlineValue !== undefined) {
|
|
68
|
+
if (inlineValue.length === 0) {
|
|
69
|
+
throw missingOptionValue(flag)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
values[resolved.key] = inlineValue as ParsedArgsValues<definitions>[typeof resolved.key]
|
|
73
|
+
continue
|
|
74
|
+
}
|
|
75
|
+
|
|
60
76
|
let next = argv[index + 1]
|
|
61
|
-
if (next == null || next.startsWith('-')) {
|
|
62
|
-
throw missingOptionValue(
|
|
77
|
+
if (next == null || next.length === 0 || next.startsWith('-')) {
|
|
78
|
+
throw missingOptionValue(flag)
|
|
63
79
|
}
|
|
64
80
|
|
|
65
81
|
values[resolved.key] = next as ParsedArgsValues<definitions>[typeof resolved.key]
|