Skip to content

Commit 4e0e119

Browse files
committed
making command public and returning a hash of target query paths
1 parent f881522 commit 4e0e119

File tree

8 files changed

+222
-12
lines changed

8 files changed

+222
-12
lines changed

.changeset/hungry-ravens-sip.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
'@shopify/app': patch
2+
'@shopify/app': minor
33
---
44

55
Added shopify app function info command to display function run arguments.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// This is an autogenerated file. Don't edit this file manually.
2+
import {ReferenceEntityTemplateSchema} from '@shopify/generate-docs'
3+
4+
const data: ReferenceEntityTemplateSchema = {
5+
name: 'app function info',
6+
description: `Returns information about the function.`,
7+
overviewPreviewDescription: `Get information about the function.`,
8+
type: 'command',
9+
isVisualComponent: false,
10+
defaultExample: {
11+
codeblock: {
12+
tabs: [
13+
{
14+
title: 'app function info',
15+
code: './examples/app-function-info.example.sh',
16+
language: 'bash',
17+
},
18+
],
19+
title: 'app function info',
20+
},
21+
},
22+
definitions: [
23+
{
24+
title: 'Flags',
25+
description: 'The following flags are available for the `app function info` command:',
26+
type: 'appfunctioninfo',
27+
},
28+
],
29+
category: 'app',
30+
related: [
31+
],
32+
}
33+
34+
export default data
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
shopify app function info [flags]
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// This is an autogenerated file. Don't edit this file manually.
2+
export interface appfunctioninfo {
3+
/**
4+
* The Client ID of your app.
5+
* @environment SHOPIFY_FLAG_CLIENT_ID
6+
*/
7+
'--client-id <value>'?: string
8+
9+
/**
10+
* The name of the app configuration.
11+
* @environment SHOPIFY_FLAG_APP_CONFIG
12+
*/
13+
'-c, --config <value>'?: string
14+
15+
/**
16+
* Output the result as JSON.
17+
* @environment SHOPIFY_FLAG_JSON
18+
*/
19+
'-j, --json'?: ''
20+
21+
/**
22+
* Disable color output.
23+
* @environment SHOPIFY_FLAG_NO_COLOR
24+
*/
25+
'--no-color'?: ''
26+
27+
/**
28+
* The path to your function directory.
29+
* @environment SHOPIFY_FLAG_PATH
30+
*/
31+
'--path <value>'?: string
32+
33+
/**
34+
* Reset all your settings.
35+
* @environment SHOPIFY_FLAG_RESET
36+
*/
37+
'--reset'?: ''
38+
39+
/**
40+
* Increase the verbosity of the output.
41+
* @environment SHOPIFY_FLAG_VERBOSE
42+
*/
43+
'--verbose'?: ''
44+
}

docs-shopify.dev/generated/generated_docs_data.json

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -998,6 +998,107 @@
998998
"category": "app",
999999
"related": []
10001000
},
1001+
{
1002+
"name": "app function info",
1003+
"description": "Returns information about the function.",
1004+
"overviewPreviewDescription": "Get information about the function.",
1005+
"type": "command",
1006+
"isVisualComponent": false,
1007+
"defaultExample": {
1008+
"codeblock": {
1009+
"tabs": [
1010+
{
1011+
"title": "app function info",
1012+
"code": "shopify app function info [flags]",
1013+
"language": "bash"
1014+
}
1015+
],
1016+
"title": "app function info"
1017+
}
1018+
},
1019+
"definitions": [
1020+
{
1021+
"title": "Flags",
1022+
"description": "The following flags are available for the `app function info` command:",
1023+
"type": "appfunctioninfo",
1024+
"typeDefinitions": {
1025+
"appfunctioninfo": {
1026+
"filePath": "docs-shopify.dev/commands/interfaces/app-function-info.interface.ts",
1027+
"name": "appfunctioninfo",
1028+
"description": "",
1029+
"members": [
1030+
{
1031+
"filePath": "docs-shopify.dev/commands/interfaces/app-function-info.interface.ts",
1032+
"syntaxKind": "PropertySignature",
1033+
"name": "--client-id <value>",
1034+
"value": "string",
1035+
"description": "The Client ID of your app.",
1036+
"isOptional": true,
1037+
"environmentValue": "SHOPIFY_FLAG_CLIENT_ID"
1038+
},
1039+
{
1040+
"filePath": "docs-shopify.dev/commands/interfaces/app-function-info.interface.ts",
1041+
"syntaxKind": "PropertySignature",
1042+
"name": "--no-color",
1043+
"value": "\"\"",
1044+
"description": "Disable color output.",
1045+
"isOptional": true,
1046+
"environmentValue": "SHOPIFY_FLAG_NO_COLOR"
1047+
},
1048+
{
1049+
"filePath": "docs-shopify.dev/commands/interfaces/app-function-info.interface.ts",
1050+
"syntaxKind": "PropertySignature",
1051+
"name": "--path <value>",
1052+
"value": "string",
1053+
"description": "The path to your function directory.",
1054+
"isOptional": true,
1055+
"environmentValue": "SHOPIFY_FLAG_PATH"
1056+
},
1057+
{
1058+
"filePath": "docs-shopify.dev/commands/interfaces/app-function-info.interface.ts",
1059+
"syntaxKind": "PropertySignature",
1060+
"name": "--reset",
1061+
"value": "\"\"",
1062+
"description": "Reset all your settings.",
1063+
"isOptional": true,
1064+
"environmentValue": "SHOPIFY_FLAG_RESET"
1065+
},
1066+
{
1067+
"filePath": "docs-shopify.dev/commands/interfaces/app-function-info.interface.ts",
1068+
"syntaxKind": "PropertySignature",
1069+
"name": "--verbose",
1070+
"value": "\"\"",
1071+
"description": "Increase the verbosity of the output.",
1072+
"isOptional": true,
1073+
"environmentValue": "SHOPIFY_FLAG_VERBOSE"
1074+
},
1075+
{
1076+
"filePath": "docs-shopify.dev/commands/interfaces/app-function-info.interface.ts",
1077+
"syntaxKind": "PropertySignature",
1078+
"name": "-c, --config <value>",
1079+
"value": "string",
1080+
"description": "The name of the app configuration.",
1081+
"isOptional": true,
1082+
"environmentValue": "SHOPIFY_FLAG_APP_CONFIG"
1083+
},
1084+
{
1085+
"filePath": "docs-shopify.dev/commands/interfaces/app-function-info.interface.ts",
1086+
"syntaxKind": "PropertySignature",
1087+
"name": "-j, --json",
1088+
"value": "\"\"",
1089+
"description": "Output the result as JSON.",
1090+
"isOptional": true,
1091+
"environmentValue": "SHOPIFY_FLAG_JSON"
1092+
}
1093+
],
1094+
"value": "export interface appfunctioninfo {\n /**\n * The Client ID of your app.\n * @environment SHOPIFY_FLAG_CLIENT_ID\n */\n '--client-id <value>'?: string\n\n /**\n * The name of the app configuration.\n * @environment SHOPIFY_FLAG_APP_CONFIG\n */\n '-c, --config <value>'?: string\n\n /**\n * Output the result as JSON.\n * @environment SHOPIFY_FLAG_JSON\n */\n '-j, --json'?: ''\n\n /**\n * Disable color output.\n * @environment SHOPIFY_FLAG_NO_COLOR\n */\n '--no-color'?: ''\n\n /**\n * The path to your function directory.\n * @environment SHOPIFY_FLAG_PATH\n */\n '--path <value>'?: string\n\n /**\n * Reset all your settings.\n * @environment SHOPIFY_FLAG_RESET\n */\n '--reset'?: ''\n\n /**\n * Increase the verbosity of the output.\n * @environment SHOPIFY_FLAG_VERBOSE\n */\n '--verbose'?: ''\n}"
1095+
}
1096+
}
1097+
}
1098+
],
1099+
"category": "app",
1100+
"related": []
1101+
},
10011102
{
10021103
"name": "app function replay",
10031104
"description": "Runs the function from your current directory for [testing purposes](/docs/apps/functions/testing-and-debugging). To learn how you can monitor and debug functions when errors occur, refer to [Shopify Functions error handling](/docs/api/functions/errors).",

packages/app/src/cli/commands/app/function/info.ts

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ export default class FunctionInfo extends AppUnlinkedCommand {
1111

1212
static description = 'Returns information about the function.'
1313

14-
static hidden = true
15-
1614
static flags = {
1715
...globalFlags,
1816
...appFlags,
@@ -32,8 +30,16 @@ export default class FunctionInfo extends AppUnlinkedCommand {
3230
const functionRunner = functionRunnerBinary()
3331
await downloadBinary(functionRunner)
3432

35-
const inputQueryPath = ourFunction?.configuration.targeting?.[0]?.input_query
36-
const queryPath = inputQueryPath && `${ourFunction?.directory}/${inputQueryPath}`
33+
const targeting: {[key: string]: {input_query?: string; export?: string}} = {}
34+
ourFunction?.configuration.targeting?.forEach((target) => {
35+
if (target.target) {
36+
targeting[target.target] = {
37+
...(target.input_query && {inputQueryPath: `${ourFunction.directory}/${target.input_query}`}),
38+
...(target.export && {export: target.export}),
39+
}
40+
}
41+
})
42+
3743
const schemaPath = await getOrGenerateSchemaPath(
3844
ourFunction,
3945
flags.path,
@@ -46,16 +52,16 @@ export default class FunctionInfo extends AppUnlinkedCommand {
4652
outputResult(
4753
JSON.stringify({
4854
functionRunnerPath: functionRunner.path,
49-
functionInputQueryPath: queryPath,
50-
functionSchemaPath: schemaPath,
51-
functionWasmPath: ourFunction.outputPath,
55+
targeting,
56+
schemaPath,
57+
wasmPath: ourFunction.outputPath,
5258
}),
5359
)
5460
} else {
5561
outputResult(`functionRunnerPath: ${functionRunner.path}`)
56-
outputResult(`functionInputQueryPath: ${queryPath}`)
57-
outputResult(`functionSchemaPath: ${schemaPath}`)
58-
outputResult(`functionWasmPath: ${ourFunction.outputPath}`)
62+
outputResult(`targeting: ${JSON.stringify(targeting, null, 2)}`)
63+
outputResult(`schemaPath: ${schemaPath}`)
64+
outputResult(`wasmPath: ${ourFunction.outputPath}`)
5965
}
6066

6167
return {app}

packages/cli/README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* [`shopify app env pull`](#shopify-app-env-pull)
1010
* [`shopify app env show`](#shopify-app-env-show)
1111
* [`shopify app function build`](#shopify-app-function-build)
12+
* [`shopify app function info`](#shopify-app-function-info)
1213
* [`shopify app function replay`](#shopify-app-function-replay)
1314
* [`shopify app function run`](#shopify-app-function-run)
1415
* [`shopify app function schema`](#shopify-app-function-schema)
@@ -346,6 +347,30 @@ DESCRIPTION
346347
Compiles the function in your current directory to WebAssembly (Wasm) for testing purposes.
347348
```
348349

350+
## `shopify app function info`
351+
352+
Get information about the function.
353+
354+
```
355+
USAGE
356+
$ shopify app function info [--client-id <value> | -c <value>] [-j] [--no-color] [--path <value>] [--reset | ]
357+
[--verbose]
358+
359+
FLAGS
360+
-c, --config=<value> The name of the app configuration.
361+
-j, --json Output the result as JSON.
362+
--client-id=<value> The Client ID of your app.
363+
--no-color Disable color output.
364+
--path=<value> The path to your function directory.
365+
--reset Reset all your settings.
366+
--verbose Increase the verbosity of the output.
367+
368+
DESCRIPTION
369+
Get information about the function.
370+
371+
Returns information about the function.
372+
```
373+
349374
## `shopify app function replay`
350375

351376
Replays a function run from an app log.

packages/cli/oclif.manifest.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -965,7 +965,6 @@
965965
}
966966
},
967967
"hasDynamicHelp": false,
968-
"hidden": true,
969968
"hiddenAliases": [
970969
],
971970
"id": "app:function:info",

0 commit comments

Comments
 (0)