Skip to content

Commit 7d99d72

Browse files
jordanhunt22Convex, Inc.
authored and
Convex, Inc.
committed
[Function Metadata] Finalize the function-spec CLI command (#28819)
Cleans up the instructions for the command, includes the instance url (so we can pipe this into a convex-helpers CLI command), and unhides this command so it will show up in the next `npm` release. GitOrigin-RevId: 6d40f6f109ad22a4d1446cbb7bba1cde51f49752
1 parent 6d5c544 commit 7d99d72

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

npm-packages/convex/src/cli/functionSpec.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const functionSpec = new Command("function-spec")
1414
"List argument and return values to your Convex functions.\n\n" +
1515
"By default, this inspects your dev deployment.",
1616
)
17-
.addOption(new Option("--path", "Output as JSON to this file path."))
17+
.addOption(new Option("--file", "Output as JSON to a file."))
1818
.addDeploymentSelectionOptions(
1919
actionDescription("Read function metadata from"),
2020
)
@@ -37,9 +37,13 @@ export const functionSpec = new Command("function-spec")
3737
{},
3838
)) as any[];
3939

40-
const output = JSON.stringify(functions, null, 2);
40+
const output = JSON.stringify(
41+
{ url: deploymentUrl, functions: functions },
42+
null,
43+
2,
44+
);
4145

42-
if (options.path) {
46+
if (options.file) {
4347
const fileName = `function_spec_${Date.now().valueOf()}.json`;
4448
ctx.fs.writeUtf8File(fileName, output);
4549
logOutput(ctx, chalk.green(`Wrote function spec to ${fileName}`));

npm-packages/convex/src/cli/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ async function main() {
121121
.addCommand(update)
122122
.addCommand(logout)
123123
.addCommand(networkTest, { hidden: true })
124-
.addCommand(functionSpec, { hidden: true })
124+
.addCommand(functionSpec)
125125
.addHelpCommand("help <command>", "Show help for given <command>")
126126
.version(version)
127127
// Hide version and help so they don't clutter

0 commit comments

Comments
 (0)