@gpc-cli/cli 0.1.2 → 0.1.4
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 +96 -0
- package/dist/{apps-BBYNHB2H.js → apps-TZG5GEDW.js} +9 -7
- package/dist/apps-TZG5GEDW.js.map +1 -0
- package/dist/{auth-T7IDSMVX.js → auth-CIITFC3C.js} +4 -2
- package/dist/auth-CIITFC3C.js.map +1 -0
- package/dist/bin.js +1 -1
- package/dist/bin.js.map +1 -1
- package/dist/{chunk-IVVT73IP.js → chunk-22DW4R5W.js} +31 -26
- package/dist/chunk-22DW4R5W.js.map +1 -0
- package/dist/{chunk-4QV4WD3F.js → chunk-Q7KVGI46.js} +9 -7
- package/dist/chunk-Q7KVGI46.js.map +1 -0
- package/dist/{chunk-QMKZYXDJ.js → chunk-Y3QZDAKS.js} +2 -2
- package/dist/chunk-Y3QZDAKS.js.map +1 -0
- package/dist/{completion-U44CGHRH.js → completion-IHVLP7OK.js} +1 -1
- package/dist/completion-IHVLP7OK.js.map +1 -0
- package/dist/{config-K7UJKIXT.js → config-7QKUVNZZ.js} +8 -4
- package/dist/config-7QKUVNZZ.js.map +1 -0
- package/dist/{doctor-VDDUPTIM.js → doctor-KVP7PGZU.js} +5 -3
- package/dist/doctor-KVP7PGZU.js.map +1 -0
- package/dist/{iap-QIV4CXKZ.js → iap-Z365AMDD.js} +37 -25
- package/dist/iap-Z365AMDD.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/{listings-PF5FDXKQ.js → listings-U3T6NFVH.js} +128 -68
- package/dist/listings-U3T6NFVH.js.map +1 -0
- package/dist/{pricing-S4SB5FXJ.js → pricing-LXIRB4R7.js} +21 -15
- package/dist/pricing-LXIRB4R7.js.map +1 -0
- package/dist/{prompt-VP5LURRP.js → prompt-ASDQX6LZ.js} +2 -2
- package/dist/{publish-3BAIN4NQ.js → publish-HKOJVZ23.js} +27 -16
- package/dist/publish-HKOJVZ23.js.map +1 -0
- package/dist/{purchases-E6A2T5WQ.js → purchases-ZQ7FXEZQ.js} +84 -49
- package/dist/purchases-ZQ7FXEZQ.js.map +1 -0
- package/dist/{releases-464IMEEF.js → releases-IZJJYTNZ.js} +103 -51
- package/dist/releases-IZJJYTNZ.js.map +1 -0
- package/dist/{reports-3YAD4U4F.js → reports-43OVCCU3.js} +83 -29
- package/dist/reports-43OVCCU3.js.map +1 -0
- package/dist/{reviews-2CLM53E3.js → reviews-T3SRAZLW.js} +25 -16
- package/dist/reviews-T3SRAZLW.js.map +1 -0
- package/dist/{status-M7U3YNMU.js → status-TBPVS7YR.js} +5 -3
- package/dist/status-TBPVS7YR.js.map +1 -0
- package/dist/{subscriptions-PUHH4FBB.js → subscriptions-UJUX3ELS.js} +201 -130
- package/dist/subscriptions-UJUX3ELS.js.map +1 -0
- package/dist/{testers-WWZMLB7J.js → testers-YNOGFHUR.js} +81 -44
- package/dist/testers-YNOGFHUR.js.map +1 -0
- package/dist/{tracks-427E34S3.js → tracks-HMJ3F55N.js} +5 -3
- package/dist/tracks-HMJ3F55N.js.map +1 -0
- package/dist/{users-E5Y5HI6K.js → users-GRQTY6HY.js} +48 -28
- package/dist/users-GRQTY6HY.js.map +1 -0
- package/dist/{vitals-YMZMUPNA.js → vitals-VP2GKG3G.js} +23 -9
- package/dist/vitals-VP2GKG3G.js.map +1 -0
- package/package.json +6 -6
- package/dist/apps-BBYNHB2H.js.map +0 -1
- package/dist/auth-T7IDSMVX.js.map +0 -1
- package/dist/chunk-4QV4WD3F.js.map +0 -1
- package/dist/chunk-IVVT73IP.js.map +0 -1
- package/dist/chunk-QMKZYXDJ.js.map +0 -1
- package/dist/completion-U44CGHRH.js.map +0 -1
- package/dist/config-K7UJKIXT.js.map +0 -1
- package/dist/doctor-VDDUPTIM.js.map +0 -1
- package/dist/iap-QIV4CXKZ.js.map +0 -1
- package/dist/listings-PF5FDXKQ.js.map +0 -1
- package/dist/pricing-S4SB5FXJ.js.map +0 -1
- package/dist/publish-3BAIN4NQ.js.map +0 -1
- package/dist/purchases-E6A2T5WQ.js.map +0 -1
- package/dist/releases-464IMEEF.js.map +0 -1
- package/dist/reports-3YAD4U4F.js.map +0 -1
- package/dist/reviews-2CLM53E3.js.map +0 -1
- package/dist/status-M7U3YNMU.js.map +0 -1
- package/dist/subscriptions-PUHH4FBB.js.map +0 -1
- package/dist/testers-WWZMLB7J.js.map +0 -1
- package/dist/tracks-427E34S3.js.map +0 -1
- package/dist/users-E5Y5HI6K.js.map +0 -1
- package/dist/vitals-YMZMUPNA.js.map +0 -1
- /package/dist/{prompt-VP5LURRP.js.map → prompt-ASDQX6LZ.js.map} +0 -0
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import {
|
|
3
3
|
isDryRun,
|
|
4
4
|
printDryRun
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-Y3QZDAKS.js";
|
|
6
6
|
import {
|
|
7
7
|
requireConfirm
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-Q7KVGI46.js";
|
|
9
9
|
|
|
10
10
|
// src/commands/iap.ts
|
|
11
11
|
import { readFile } from "fs/promises";
|
|
@@ -38,7 +38,7 @@ function registerIapCommands(program) {
|
|
|
38
38
|
const iap = program.command("iap").description("Manage in-app products");
|
|
39
39
|
iap.command("list").description("List in-app products").option("--max <n>", "Maximum results per page", parseInt).option("--limit <n>", "Maximum total results", parseInt).option("--next-page <token>", "Resume from page token").action(async (options) => {
|
|
40
40
|
const config = await loadConfig();
|
|
41
|
-
const packageName = resolvePackageName(program.opts()
|
|
41
|
+
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
42
42
|
const client = await getClient(config);
|
|
43
43
|
const format = detectOutputFormat();
|
|
44
44
|
try {
|
|
@@ -55,7 +55,7 @@ function registerIapCommands(program) {
|
|
|
55
55
|
});
|
|
56
56
|
iap.command("get <sku>").description("Get an in-app product").action(async (sku) => {
|
|
57
57
|
const config = await loadConfig();
|
|
58
|
-
const packageName = resolvePackageName(program.opts()
|
|
58
|
+
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
59
59
|
const client = await getClient(config);
|
|
60
60
|
const format = detectOutputFormat();
|
|
61
61
|
try {
|
|
@@ -68,14 +68,18 @@ function registerIapCommands(program) {
|
|
|
68
68
|
});
|
|
69
69
|
iap.command("create").description("Create an in-app product from JSON file").requiredOption("--file <path>", "JSON file with product data").action(async (options) => {
|
|
70
70
|
const config = await loadConfig();
|
|
71
|
-
const packageName = resolvePackageName(program.opts()
|
|
71
|
+
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
72
72
|
const format = detectOutputFormat();
|
|
73
73
|
if (isDryRun(program)) {
|
|
74
|
-
printDryRun(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
74
|
+
printDryRun(
|
|
75
|
+
{
|
|
76
|
+
command: "iap create",
|
|
77
|
+
action: "create",
|
|
78
|
+
target: `in-app product from ${options.file}`
|
|
79
|
+
},
|
|
80
|
+
format,
|
|
81
|
+
formatOutput
|
|
82
|
+
);
|
|
79
83
|
return;
|
|
80
84
|
}
|
|
81
85
|
const client = await getClient(config);
|
|
@@ -90,15 +94,19 @@ function registerIapCommands(program) {
|
|
|
90
94
|
});
|
|
91
95
|
iap.command("update <sku>").description("Update an in-app product from JSON file").requiredOption("--file <path>", "JSON file with product data").action(async (sku, options) => {
|
|
92
96
|
const config = await loadConfig();
|
|
93
|
-
const packageName = resolvePackageName(program.opts()
|
|
97
|
+
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
94
98
|
const format = detectOutputFormat();
|
|
95
99
|
if (isDryRun(program)) {
|
|
96
|
-
printDryRun(
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
printDryRun(
|
|
101
|
+
{
|
|
102
|
+
command: "iap update",
|
|
103
|
+
action: "update",
|
|
104
|
+
target: sku,
|
|
105
|
+
details: { file: options.file }
|
|
106
|
+
},
|
|
107
|
+
format,
|
|
108
|
+
formatOutput
|
|
109
|
+
);
|
|
102
110
|
return;
|
|
103
111
|
}
|
|
104
112
|
const client = await getClient(config);
|
|
@@ -113,15 +121,19 @@ function registerIapCommands(program) {
|
|
|
113
121
|
});
|
|
114
122
|
iap.command("delete <sku>").description("Delete an in-app product").action(async (sku) => {
|
|
115
123
|
const config = await loadConfig();
|
|
116
|
-
const packageName = resolvePackageName(program.opts()
|
|
124
|
+
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
117
125
|
await requireConfirm(`Delete in-app product "${sku}"?`, program);
|
|
118
126
|
if (isDryRun(program)) {
|
|
119
127
|
const format = detectOutputFormat();
|
|
120
|
-
printDryRun(
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
128
|
+
printDryRun(
|
|
129
|
+
{
|
|
130
|
+
command: "iap delete",
|
|
131
|
+
action: "delete",
|
|
132
|
+
target: sku
|
|
133
|
+
},
|
|
134
|
+
format,
|
|
135
|
+
formatOutput
|
|
136
|
+
);
|
|
125
137
|
return;
|
|
126
138
|
}
|
|
127
139
|
const client = await getClient(config);
|
|
@@ -135,7 +147,7 @@ function registerIapCommands(program) {
|
|
|
135
147
|
});
|
|
136
148
|
iap.command("sync").description("Sync in-app products from a directory of JSON files").requiredOption("--dir <path>", "Directory containing product JSON files").option("--dry-run", "Preview changes without applying").action(async (options) => {
|
|
137
149
|
const config = await loadConfig();
|
|
138
|
-
const packageName = resolvePackageName(program.opts()
|
|
150
|
+
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
139
151
|
const client = await getClient(config);
|
|
140
152
|
const format = detectOutputFormat();
|
|
141
153
|
try {
|
|
@@ -155,4 +167,4 @@ function registerIapCommands(program) {
|
|
|
155
167
|
export {
|
|
156
168
|
registerIapCommands
|
|
157
169
|
};
|
|
158
|
-
//# sourceMappingURL=iap-
|
|
170
|
+
//# sourceMappingURL=iap-Z365AMDD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/iap.ts"],"sourcesContent":["import { readFile } from \"node:fs/promises\";\nimport type { GpcConfig } from \"@gpc-cli/config\";\nimport type { Command } from \"commander\";\nimport { loadConfig } from \"@gpc-cli/config\";\nimport { resolveAuth } from \"@gpc-cli/auth\";\nimport { createApiClient } from \"@gpc-cli/api\";\nimport {\n listInAppProducts,\n getInAppProduct,\n createInAppProduct,\n updateInAppProduct,\n deleteInAppProduct,\n syncInAppProducts,\n detectOutputFormat,\n formatOutput,\n} from \"@gpc-cli/core\";\nimport { isDryRun, printDryRun } from \"../dry-run.js\";\nimport { requireConfirm } from \"../prompt.js\";\n\nfunction resolvePackageName(packageArg: string | undefined, config: GpcConfig): string {\n const name = packageArg || config.app;\n if (!name) {\n console.error(\"Error: No package name. Use --app <package> or gpc config set app <package>\");\n process.exit(2);\n }\n return name;\n}\n\nasync function getClient(config: GpcConfig) {\n const auth = await resolveAuth({ serviceAccountPath: config.auth?.serviceAccount });\n return createApiClient({ auth });\n}\n\nexport function registerIapCommands(program: Command): void {\n const iap = program.command(\"iap\").description(\"Manage in-app products\");\n\n iap\n .command(\"list\")\n .description(\"List in-app products\")\n .option(\"--max <n>\", \"Maximum results per page\", parseInt)\n .option(\"--limit <n>\", \"Maximum total results\", parseInt)\n .option(\"--next-page <token>\", \"Resume from page token\")\n .action(async (options) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const client = await getClient(config);\n const format = detectOutputFormat();\n\n try {\n const result = await listInAppProducts(client, packageName, {\n maxResults: options.max,\n limit: options.limit,\n nextPage: options.nextPage,\n });\n console.log(formatOutput(result, format));\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n\n iap\n .command(\"get <sku>\")\n .description(\"Get an in-app product\")\n .action(async (sku: string) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const client = await getClient(config);\n const format = detectOutputFormat();\n\n try {\n const result = await getInAppProduct(client, packageName, sku);\n console.log(formatOutput(result, format));\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n\n iap\n .command(\"create\")\n .description(\"Create an in-app product from JSON file\")\n .requiredOption(\"--file <path>\", \"JSON file with product data\")\n .action(async (options) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const format = detectOutputFormat();\n\n if (isDryRun(program)) {\n printDryRun(\n {\n command: \"iap create\",\n action: \"create\",\n target: `in-app product from ${options.file}`,\n },\n format,\n formatOutput,\n );\n return;\n }\n\n const client = await getClient(config);\n\n try {\n const data = JSON.parse(await readFile(options.file, \"utf-8\"));\n const result = await createInAppProduct(client, packageName, data);\n console.log(formatOutput(result, format));\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n\n iap\n .command(\"update <sku>\")\n .description(\"Update an in-app product from JSON file\")\n .requiredOption(\"--file <path>\", \"JSON file with product data\")\n .action(async (sku: string, options) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const format = detectOutputFormat();\n\n if (isDryRun(program)) {\n printDryRun(\n {\n command: \"iap update\",\n action: \"update\",\n target: sku,\n details: { file: options.file },\n },\n format,\n formatOutput,\n );\n return;\n }\n\n const client = await getClient(config);\n\n try {\n const data = JSON.parse(await readFile(options.file, \"utf-8\"));\n const result = await updateInAppProduct(client, packageName, sku, data);\n console.log(formatOutput(result, format));\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n\n iap\n .command(\"delete <sku>\")\n .description(\"Delete an in-app product\")\n .action(async (sku: string) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n\n await requireConfirm(`Delete in-app product \"${sku}\"?`, program);\n\n if (isDryRun(program)) {\n const format = detectOutputFormat();\n printDryRun(\n {\n command: \"iap delete\",\n action: \"delete\",\n target: sku,\n },\n format,\n formatOutput,\n );\n return;\n }\n\n const client = await getClient(config);\n\n try {\n await deleteInAppProduct(client, packageName, sku);\n console.log(`In-app product ${sku} deleted.`);\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n\n iap\n .command(\"sync\")\n .description(\"Sync in-app products from a directory of JSON files\")\n .requiredOption(\"--dir <path>\", \"Directory containing product JSON files\")\n .option(\"--dry-run\", \"Preview changes without applying\")\n .action(async (options) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const client = await getClient(config);\n const format = detectOutputFormat();\n\n try {\n const result = await syncInAppProducts(client, packageName, options.dir, {\n dryRun: options.dryRun,\n });\n if (options.dryRun) {\n console.log(`[dry-run] Would create: ${result.created}, update: ${result.updated}`);\n }\n console.log(formatOutput(result, format));\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n}\n"],"mappings":";;;;;;;;;;AAAA,SAAS,gBAAgB;AAGzB,SAAS,kBAAkB;AAC3B,SAAS,mBAAmB;AAC5B,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAIP,SAAS,mBAAmB,YAAgC,QAA2B;AACrF,QAAM,OAAO,cAAc,OAAO;AAClC,MAAI,CAAC,MAAM;AACT,YAAQ,MAAM,6EAA6E;AAC3F,YAAQ,KAAK,CAAC;AAAA,EAChB;AACA,SAAO;AACT;AAEA,eAAe,UAAU,QAAmB;AAC1C,QAAM,OAAO,MAAM,YAAY,EAAE,oBAAoB,OAAO,MAAM,eAAe,CAAC;AAClF,SAAO,gBAAgB,EAAE,KAAK,CAAC;AACjC;AAEO,SAAS,oBAAoB,SAAwB;AAC1D,QAAM,MAAM,QAAQ,QAAQ,KAAK,EAAE,YAAY,wBAAwB;AAEvE,MACG,QAAQ,MAA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AAM,kBAAkB,QAAQ,aAAa,QAAQ,KAAK;AAAA,QACvE,QAAQ,QAAQ;AAAA,MAClB,CAAC;AACD,UAAI,QAAQ,QAAQ;AAClB,gBAAQ,IAAI,2BAA2B,OAAO,OAAO,aAAa,OAAO,OAAO,EAAE;AAAA,MACpF;AACA,cAAQ,IAAI,aAAa,QAAQ,MAAM,CAAC;AAAA,IAC1C,SAAS,OAAO;AACd,cAAQ,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC,EAAE;AAChF,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF,CAAC;AACL;","names":[]}
|
package/dist/index.js
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
import {
|
|
3
3
|
isDryRun,
|
|
4
4
|
printDryRun
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-Y3QZDAKS.js";
|
|
6
6
|
import {
|
|
7
7
|
isInteractive,
|
|
8
8
|
requireConfirm,
|
|
9
9
|
requireOption
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-Q7KVGI46.js";
|
|
11
11
|
|
|
12
12
|
// src/commands/listings.ts
|
|
13
13
|
import { loadConfig } from "@gpc-cli/config";
|
|
@@ -60,7 +60,7 @@ function registerListingsCommands(program) {
|
|
|
60
60
|
const listings = program.command("listings").description("Manage store listings and metadata");
|
|
61
61
|
listings.command("get").description("Get store listing(s)").option("--lang <language>", "Language code (BCP 47)").action(async (options) => {
|
|
62
62
|
const config = await loadConfig();
|
|
63
|
-
const packageName = resolvePackageName(program.opts()
|
|
63
|
+
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
64
64
|
const client = await getClient(config);
|
|
65
65
|
const format = detectOutputFormat();
|
|
66
66
|
try {
|
|
@@ -73,34 +73,45 @@ function registerListingsCommands(program) {
|
|
|
73
73
|
});
|
|
74
74
|
listings.command("update").description("Update a store listing").option("--lang <language>", "Language code (BCP 47)").option("--title <text>", "App title").option("--short <text>", "Short description").option("--full <text>", "Full description").option("--full-file <path>", "Read full description from file").option("--video <url>", "Video URL").action(async (options) => {
|
|
75
75
|
const config = await loadConfig();
|
|
76
|
-
const packageName = resolvePackageName(program.opts()
|
|
76
|
+
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
77
77
|
const interactive = isInteractive(program);
|
|
78
|
-
options.lang = await requireOption(
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
78
|
+
options.lang = await requireOption(
|
|
79
|
+
"lang",
|
|
80
|
+
options.lang,
|
|
81
|
+
{
|
|
82
|
+
message: "Language code (BCP 47):",
|
|
83
|
+
default: "en-US"
|
|
84
|
+
},
|
|
85
|
+
interactive
|
|
86
|
+
);
|
|
82
87
|
const format = detectOutputFormat();
|
|
83
88
|
try {
|
|
84
89
|
const data = {};
|
|
85
|
-
if (options
|
|
86
|
-
if (options
|
|
87
|
-
if (options
|
|
88
|
-
if (options
|
|
90
|
+
if (options["title"]) data["title"] = options["title"];
|
|
91
|
+
if (options["short"]) data["shortDescription"] = options["short"];
|
|
92
|
+
if (options["full"]) data["fullDescription"] = options["full"];
|
|
93
|
+
if (options["fullFile"]) {
|
|
89
94
|
const { readFile } = await import("fs/promises");
|
|
90
|
-
data
|
|
95
|
+
data["fullDescription"] = (await readFile(options["fullFile"], "utf-8")).trimEnd();
|
|
91
96
|
}
|
|
92
|
-
if (options
|
|
97
|
+
if (options["video"]) data["video"] = options["video"];
|
|
93
98
|
if (Object.keys(data).length === 0) {
|
|
94
|
-
console.error(
|
|
99
|
+
console.error(
|
|
100
|
+
"Error: Provide at least one field to update (--title, --short, --full, --full-file, --video)."
|
|
101
|
+
);
|
|
95
102
|
process.exit(2);
|
|
96
103
|
}
|
|
97
104
|
if (isDryRun(program)) {
|
|
98
|
-
printDryRun(
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
105
|
+
printDryRun(
|
|
106
|
+
{
|
|
107
|
+
command: "listings update",
|
|
108
|
+
action: "update listing for",
|
|
109
|
+
target: options.lang,
|
|
110
|
+
details: data
|
|
111
|
+
},
|
|
112
|
+
format,
|
|
113
|
+
formatOutput
|
|
114
|
+
);
|
|
104
115
|
return;
|
|
105
116
|
}
|
|
106
117
|
const client = await getClient(config);
|
|
@@ -113,19 +124,28 @@ function registerListingsCommands(program) {
|
|
|
113
124
|
});
|
|
114
125
|
listings.command("delete").description("Delete a store listing for a language").option("--lang <language>", "Language code (BCP 47)").action(async (options) => {
|
|
115
126
|
const config = await loadConfig();
|
|
116
|
-
const packageName = resolvePackageName(program.opts()
|
|
127
|
+
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
117
128
|
const interactive = isInteractive(program);
|
|
118
|
-
options.lang = await requireOption(
|
|
119
|
-
|
|
120
|
-
|
|
129
|
+
options.lang = await requireOption(
|
|
130
|
+
"lang",
|
|
131
|
+
options.lang,
|
|
132
|
+
{
|
|
133
|
+
message: "Language code (BCP 47):"
|
|
134
|
+
},
|
|
135
|
+
interactive
|
|
136
|
+
);
|
|
121
137
|
await requireConfirm(`Delete listing for "${options.lang}"?`, program);
|
|
122
138
|
if (isDryRun(program)) {
|
|
123
139
|
const format = detectOutputFormat();
|
|
124
|
-
printDryRun(
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
140
|
+
printDryRun(
|
|
141
|
+
{
|
|
142
|
+
command: "listings delete",
|
|
143
|
+
action: "delete listing for",
|
|
144
|
+
target: options.lang
|
|
145
|
+
},
|
|
146
|
+
format,
|
|
147
|
+
formatOutput
|
|
148
|
+
);
|
|
129
149
|
return;
|
|
130
150
|
}
|
|
131
151
|
const client = await getClient(config);
|
|
@@ -139,16 +159,21 @@ function registerListingsCommands(program) {
|
|
|
139
159
|
});
|
|
140
160
|
listings.command("pull").description("Download listings to Fastlane-format directory").option("--dir <path>", "Output directory", "metadata").action(async (options) => {
|
|
141
161
|
const config = await loadConfig();
|
|
142
|
-
const packageName = resolvePackageName(program.opts()
|
|
162
|
+
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
143
163
|
const client = await getClient(config);
|
|
144
164
|
const format = detectOutputFormat();
|
|
145
165
|
try {
|
|
146
166
|
const result = await pullListings(client, packageName, options.dir);
|
|
147
|
-
console.log(
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
167
|
+
console.log(
|
|
168
|
+
formatOutput(
|
|
169
|
+
{
|
|
170
|
+
directory: options.dir,
|
|
171
|
+
languages: result.listings.map((l) => l.language),
|
|
172
|
+
count: result.listings.length
|
|
173
|
+
},
|
|
174
|
+
format
|
|
175
|
+
)
|
|
176
|
+
);
|
|
152
177
|
} catch (error) {
|
|
153
178
|
console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
154
179
|
process.exit(4);
|
|
@@ -156,7 +181,7 @@ function registerListingsCommands(program) {
|
|
|
156
181
|
});
|
|
157
182
|
listings.command("push").description("Upload listings from Fastlane-format directory").option("--dir <path>", "Source directory", "metadata").option("--dry-run", "Preview changes without applying").action(async (options) => {
|
|
158
183
|
const config = await loadConfig();
|
|
159
|
-
const packageName = resolvePackageName(program.opts()
|
|
184
|
+
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
160
185
|
const client = await getClient(config);
|
|
161
186
|
const format = detectOutputFormat();
|
|
162
187
|
try {
|
|
@@ -172,16 +197,26 @@ function registerListingsCommands(program) {
|
|
|
172
197
|
const images = listings.command("images").description("Manage listing images");
|
|
173
198
|
images.command("list").description("List images for a language and type").option("--lang <language>", "Language code (BCP 47)").option("--type <type>", "Image type").action(async (options) => {
|
|
174
199
|
const config = await loadConfig();
|
|
175
|
-
const packageName = resolvePackageName(program.opts()
|
|
200
|
+
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
176
201
|
const interactive = isInteractive(program);
|
|
177
|
-
options.lang = await requireOption(
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
202
|
+
options.lang = await requireOption(
|
|
203
|
+
"lang",
|
|
204
|
+
options.lang,
|
|
205
|
+
{
|
|
206
|
+
message: "Language code (BCP 47):",
|
|
207
|
+
default: "en-US"
|
|
208
|
+
},
|
|
209
|
+
interactive
|
|
210
|
+
);
|
|
211
|
+
options.type = await requireOption(
|
|
212
|
+
"type",
|
|
213
|
+
options.type,
|
|
214
|
+
{
|
|
215
|
+
message: "Image type:",
|
|
216
|
+
choices: VALID_IMAGE_TYPES
|
|
217
|
+
},
|
|
218
|
+
interactive
|
|
219
|
+
);
|
|
185
220
|
const client = await getClient(config);
|
|
186
221
|
const format = detectOutputFormat();
|
|
187
222
|
const imageType = validateImageType(options.type);
|
|
@@ -195,16 +230,26 @@ function registerListingsCommands(program) {
|
|
|
195
230
|
});
|
|
196
231
|
images.command("upload <file>").description("Upload an image").option("--lang <language>", "Language code (BCP 47)").option("--type <type>", "Image type").action(async (file, options) => {
|
|
197
232
|
const config = await loadConfig();
|
|
198
|
-
const packageName = resolvePackageName(program.opts()
|
|
233
|
+
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
199
234
|
const interactive = isInteractive(program);
|
|
200
|
-
options.lang = await requireOption(
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
235
|
+
options.lang = await requireOption(
|
|
236
|
+
"lang",
|
|
237
|
+
options.lang,
|
|
238
|
+
{
|
|
239
|
+
message: "Language code (BCP 47):",
|
|
240
|
+
default: "en-US"
|
|
241
|
+
},
|
|
242
|
+
interactive
|
|
243
|
+
);
|
|
244
|
+
options.type = await requireOption(
|
|
245
|
+
"type",
|
|
246
|
+
options.type,
|
|
247
|
+
{
|
|
248
|
+
message: "Image type:",
|
|
249
|
+
choices: VALID_IMAGE_TYPES
|
|
250
|
+
},
|
|
251
|
+
interactive
|
|
252
|
+
);
|
|
208
253
|
const client = await getClient(config);
|
|
209
254
|
const format = detectOutputFormat();
|
|
210
255
|
const imageType = validateImageType(options.type);
|
|
@@ -218,18 +263,33 @@ function registerListingsCommands(program) {
|
|
|
218
263
|
});
|
|
219
264
|
images.command("delete").description("Delete an image").option("--lang <language>", "Language code (BCP 47)").option("--type <type>", "Image type").option("--id <imageId>", "Image ID to delete").action(async (options) => {
|
|
220
265
|
const config = await loadConfig();
|
|
221
|
-
const packageName = resolvePackageName(program.opts()
|
|
266
|
+
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
222
267
|
const interactive = isInteractive(program);
|
|
223
|
-
options.lang = await requireOption(
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
268
|
+
options.lang = await requireOption(
|
|
269
|
+
"lang",
|
|
270
|
+
options.lang,
|
|
271
|
+
{
|
|
272
|
+
message: "Language code (BCP 47):"
|
|
273
|
+
},
|
|
274
|
+
interactive
|
|
275
|
+
);
|
|
276
|
+
options.type = await requireOption(
|
|
277
|
+
"type",
|
|
278
|
+
options.type,
|
|
279
|
+
{
|
|
280
|
+
message: "Image type:",
|
|
281
|
+
choices: VALID_IMAGE_TYPES
|
|
282
|
+
},
|
|
283
|
+
interactive
|
|
284
|
+
);
|
|
285
|
+
options.id = await requireOption(
|
|
286
|
+
"id",
|
|
287
|
+
options.id,
|
|
288
|
+
{
|
|
289
|
+
message: "Image ID to delete:"
|
|
290
|
+
},
|
|
291
|
+
interactive
|
|
292
|
+
);
|
|
233
293
|
await requireConfirm(`Delete image "${options.id}"?`, program);
|
|
234
294
|
const client = await getClient(config);
|
|
235
295
|
const imageType = validateImageType(options.type);
|
|
@@ -243,7 +303,7 @@ function registerListingsCommands(program) {
|
|
|
243
303
|
});
|
|
244
304
|
listings.command("availability").description("Get country availability for a track").option("--track <track>", "Track name", "production").action(async (options) => {
|
|
245
305
|
const config = await loadConfig();
|
|
246
|
-
const packageName = resolvePackageName(program.opts()
|
|
306
|
+
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
247
307
|
const client = await getClient(config);
|
|
248
308
|
const format = detectOutputFormat();
|
|
249
309
|
try {
|
|
@@ -258,4 +318,4 @@ function registerListingsCommands(program) {
|
|
|
258
318
|
export {
|
|
259
319
|
registerListingsCommands
|
|
260
320
|
};
|
|
261
|
-
//# sourceMappingURL=listings-
|
|
321
|
+
//# sourceMappingURL=listings-U3T6NFVH.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/listings.ts"],"sourcesContent":["import type { Command } from \"commander\";\nimport type { GpcConfig } from \"@gpc-cli/config\";\nimport { loadConfig } from \"@gpc-cli/config\";\nimport { resolveAuth } from \"@gpc-cli/auth\";\nimport { createApiClient } from \"@gpc-cli/api\";\nimport type { ImageType } from \"@gpc-cli/api\";\nimport {\n getListings,\n updateListing,\n deleteListing,\n pullListings,\n pushListings,\n listImages,\n uploadImage,\n deleteImage,\n getCountryAvailability,\n detectOutputFormat,\n formatOutput,\n} from \"@gpc-cli/core\";\nimport { isDryRun, printDryRun } from \"../dry-run.js\";\nimport { isInteractive, requireOption, requireConfirm } from \"../prompt.js\";\n\nfunction resolvePackageName(packageArg: string | undefined, config: GpcConfig): string {\n const name = packageArg || config.app;\n if (!name) {\n console.error(\"Error: No package name. Use --app <package> or gpc config set app <package>\");\n process.exit(2);\n }\n return name;\n}\n\nasync function getClient(config: GpcConfig) {\n const auth = await resolveAuth({ serviceAccountPath: config.auth?.serviceAccount });\n return createApiClient({ auth });\n}\n\nconst VALID_IMAGE_TYPES: ImageType[] = [\n \"phoneScreenshots\",\n \"sevenInchScreenshots\",\n \"tenInchScreenshots\",\n \"tvScreenshots\",\n \"wearScreenshots\",\n \"icon\",\n \"featureGraphic\",\n \"tvBanner\",\n];\n\nfunction validateImageType(type: string): ImageType {\n if (!VALID_IMAGE_TYPES.includes(type as ImageType)) {\n console.error(`Error: Invalid image type \"${type}\".`);\n console.error(`Valid types: ${VALID_IMAGE_TYPES.join(\", \")}`);\n process.exit(2);\n }\n return type as ImageType;\n}\n\nexport function registerListingsCommands(program: Command): void {\n const listings = program.command(\"listings\").description(\"Manage store listings and metadata\");\n\n // Get\n listings\n .command(\"get\")\n .description(\"Get store listing(s)\")\n .option(\"--lang <language>\", \"Language code (BCP 47)\")\n .action(async (options) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const client = await getClient(config);\n const format = detectOutputFormat();\n\n try {\n const result = await getListings(client, packageName, options.lang);\n console.log(formatOutput(result, format));\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n\n // Update\n listings\n .command(\"update\")\n .description(\"Update a store listing\")\n .option(\"--lang <language>\", \"Language code (BCP 47)\")\n .option(\"--title <text>\", \"App title\")\n .option(\"--short <text>\", \"Short description\")\n .option(\"--full <text>\", \"Full description\")\n .option(\"--full-file <path>\", \"Read full description from file\")\n .option(\"--video <url>\", \"Video URL\")\n .action(async (options) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const interactive = isInteractive(program);\n\n options.lang = await requireOption(\n \"lang\",\n options.lang,\n {\n message: \"Language code (BCP 47):\",\n default: \"en-US\",\n },\n interactive,\n );\n const format = detectOutputFormat();\n\n try {\n const data: Record<string, string> = {};\n if (options[\"title\"]) data[\"title\"] = options[\"title\"];\n if (options[\"short\"]) data[\"shortDescription\"] = options[\"short\"];\n if (options[\"full\"]) data[\"fullDescription\"] = options[\"full\"];\n if (options[\"fullFile\"]) {\n const { readFile } = await import(\"node:fs/promises\");\n data[\"fullDescription\"] = (await readFile(options[\"fullFile\"], \"utf-8\")).trimEnd();\n }\n if (options[\"video\"]) data[\"video\"] = options[\"video\"];\n\n if (Object.keys(data).length === 0) {\n console.error(\n \"Error: Provide at least one field to update (--title, --short, --full, --full-file, --video).\",\n );\n process.exit(2);\n }\n\n if (isDryRun(program)) {\n printDryRun(\n {\n command: \"listings update\",\n action: \"update listing for\",\n target: options.lang,\n details: data,\n },\n format,\n formatOutput,\n );\n return;\n }\n\n const client = await getClient(config);\n const result = await updateListing(client, packageName, options.lang, data);\n console.log(formatOutput(result, format));\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n\n // Delete\n listings\n .command(\"delete\")\n .description(\"Delete a store listing for a language\")\n .option(\"--lang <language>\", \"Language code (BCP 47)\")\n .action(async (options) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const interactive = isInteractive(program);\n\n options.lang = await requireOption(\n \"lang\",\n options.lang,\n {\n message: \"Language code (BCP 47):\",\n },\n interactive,\n );\n\n await requireConfirm(`Delete listing for \"${options.lang}\"?`, program);\n\n if (isDryRun(program)) {\n const format = detectOutputFormat();\n printDryRun(\n {\n command: \"listings delete\",\n action: \"delete listing for\",\n target: options.lang,\n },\n format,\n formatOutput,\n );\n return;\n }\n\n const client = await getClient(config);\n\n try {\n await deleteListing(client, packageName, options.lang);\n console.log(`Listing for \"${options.lang}\" deleted.`);\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n\n // Pull\n listings\n .command(\"pull\")\n .description(\"Download listings to Fastlane-format directory\")\n .option(\"--dir <path>\", \"Output directory\", \"metadata\")\n .action(async (options) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const client = await getClient(config);\n const format = detectOutputFormat();\n\n try {\n const result = await pullListings(client, packageName, options.dir);\n console.log(\n formatOutput(\n {\n directory: options.dir,\n languages: result.listings.map((l) => l.language),\n count: result.listings.length,\n },\n format,\n ),\n );\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n\n // Push\n listings\n .command(\"push\")\n .description(\"Upload listings from Fastlane-format directory\")\n .option(\"--dir <path>\", \"Source directory\", \"metadata\")\n .option(\"--dry-run\", \"Preview changes without applying\")\n .action(async (options) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const client = await getClient(config);\n const format = detectOutputFormat();\n\n try {\n const result = await pushListings(client, packageName, options.dir, {\n dryRun: options.dryRun,\n });\n console.log(formatOutput(result, format));\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n\n // Images subcommand\n const images = listings.command(\"images\").description(\"Manage listing images\");\n\n // Images list\n images\n .command(\"list\")\n .description(\"List images for a language and type\")\n .option(\"--lang <language>\", \"Language code (BCP 47)\")\n .option(\"--type <type>\", \"Image type\")\n .action(async (options) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const interactive = isInteractive(program);\n\n options.lang = await requireOption(\n \"lang\",\n options.lang,\n {\n message: \"Language code (BCP 47):\",\n default: \"en-US\",\n },\n interactive,\n );\n\n options.type = await requireOption(\n \"type\",\n options.type,\n {\n message: \"Image type:\",\n choices: VALID_IMAGE_TYPES as unknown as string[],\n },\n interactive,\n );\n\n const client = await getClient(config);\n const format = detectOutputFormat();\n const imageType = validateImageType(options.type);\n\n try {\n const result = await listImages(client, packageName, options.lang, imageType);\n console.log(formatOutput(result, format));\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n\n // Images upload\n images\n .command(\"upload <file>\")\n .description(\"Upload an image\")\n .option(\"--lang <language>\", \"Language code (BCP 47)\")\n .option(\"--type <type>\", \"Image type\")\n .action(async (file: string, options) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const interactive = isInteractive(program);\n\n options.lang = await requireOption(\n \"lang\",\n options.lang,\n {\n message: \"Language code (BCP 47):\",\n default: \"en-US\",\n },\n interactive,\n );\n\n options.type = await requireOption(\n \"type\",\n options.type,\n {\n message: \"Image type:\",\n choices: VALID_IMAGE_TYPES as unknown as string[],\n },\n interactive,\n );\n\n const client = await getClient(config);\n const format = detectOutputFormat();\n const imageType = validateImageType(options.type);\n\n try {\n const result = await uploadImage(client, packageName, options.lang, imageType, file);\n console.log(formatOutput(result, format));\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n\n // Images delete\n images\n .command(\"delete\")\n .description(\"Delete an image\")\n .option(\"--lang <language>\", \"Language code (BCP 47)\")\n .option(\"--type <type>\", \"Image type\")\n .option(\"--id <imageId>\", \"Image ID to delete\")\n .action(async (options) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const interactive = isInteractive(program);\n\n options.lang = await requireOption(\n \"lang\",\n options.lang,\n {\n message: \"Language code (BCP 47):\",\n },\n interactive,\n );\n\n options.type = await requireOption(\n \"type\",\n options.type,\n {\n message: \"Image type:\",\n choices: VALID_IMAGE_TYPES as unknown as string[],\n },\n interactive,\n );\n\n options.id = await requireOption(\n \"id\",\n options.id,\n {\n message: \"Image ID to delete:\",\n },\n interactive,\n );\n\n await requireConfirm(`Delete image \"${options.id}\"?`, program);\n\n const client = await getClient(config);\n const imageType = validateImageType(options.type);\n\n try {\n await deleteImage(client, packageName, options.lang, imageType, options.id);\n console.log(`Image \"${options.id}\" deleted.`);\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n\n // Availability\n listings\n .command(\"availability\")\n .description(\"Get country availability for a track\")\n .option(\"--track <track>\", \"Track name\", \"production\")\n .action(async (options) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const client = await getClient(config);\n const format = detectOutputFormat();\n\n try {\n const result = await getCountryAvailability(client, packageName, options.track);\n console.log(formatOutput(result, format));\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n}\n"],"mappings":";;;;;;;;;;;;AAEA,SAAS,kBAAkB;AAC3B,SAAS,mBAAmB;AAC5B,SAAS,uBAAuB;AAEhC;AAA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c-cli/config";
|
|
5
5
|
import { resolveAuth } from "@gpc-cli/auth";
|
|
6
6
|
import { createApiClient } from "@gpc-cli/api";
|
|
7
|
-
import {
|
|
8
|
-
convertRegionPrices,
|
|
9
|
-
detectOutputFormat,
|
|
10
|
-
formatOutput
|
|
11
|
-
} from "@gpc-cli/core";
|
|
7
|
+
import { convertRegionPrices, detectOutputFormat, formatOutput } from "@gpc-cli/core";
|
|
12
8
|
function resolvePackageName(packageArg, config) {
|
|
13
9
|
const name = packageArg || config.app;
|
|
14
10
|
if (!name) {
|
|
@@ -25,16 +21,26 @@ function registerPricingCommands(program) {
|
|
|
25
21
|
const pricing = program.command("pricing").description("Pricing and regional price conversion");
|
|
26
22
|
pricing.command("convert").description("Convert a price to all regional prices").option("--from <currency>", "Source currency code (e.g. USD)").option("--amount <number>", "Price amount (e.g. 4.99)").action(async (options) => {
|
|
27
23
|
const config = await loadConfig();
|
|
28
|
-
const packageName = resolvePackageName(program.opts()
|
|
29
|
-
const { isInteractive, requireOption } = await import("./prompt-
|
|
24
|
+
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
25
|
+
const { isInteractive, requireOption } = await import("./prompt-ASDQX6LZ.js");
|
|
30
26
|
const interactive = isInteractive(program);
|
|
31
|
-
options.from = await requireOption(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
27
|
+
options.from = await requireOption(
|
|
28
|
+
"from",
|
|
29
|
+
options.from,
|
|
30
|
+
{
|
|
31
|
+
message: "Source currency code (e.g. USD):",
|
|
32
|
+
default: "USD"
|
|
33
|
+
},
|
|
34
|
+
interactive
|
|
35
|
+
);
|
|
36
|
+
options.amount = await requireOption(
|
|
37
|
+
"amount",
|
|
38
|
+
options.amount,
|
|
39
|
+
{
|
|
40
|
+
message: "Price amount (e.g. 4.99):"
|
|
41
|
+
},
|
|
42
|
+
interactive
|
|
43
|
+
);
|
|
38
44
|
const client = await getClient(config);
|
|
39
45
|
const format = detectOutputFormat();
|
|
40
46
|
try {
|
|
@@ -49,4 +55,4 @@ function registerPricingCommands(program) {
|
|
|
49
55
|
export {
|
|
50
56
|
registerPricingCommands
|
|
51
57
|
};
|
|
52
|
-
//# sourceMappingURL=pricing-
|
|
58
|
+
//# sourceMappingURL=pricing-LXIRB4R7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/pricing.ts"],"sourcesContent":["import type { Command } from \"commander\";\nimport type { GpcConfig } from \"@gpc-cli/config\";\nimport { loadConfig } from \"@gpc-cli/config\";\nimport { resolveAuth } from \"@gpc-cli/auth\";\nimport { createApiClient } from \"@gpc-cli/api\";\nimport { convertRegionPrices, detectOutputFormat, formatOutput } from \"@gpc-cli/core\";\n\nfunction resolvePackageName(packageArg: string | undefined, config: GpcConfig): string {\n const name = packageArg || config.app;\n if (!name) {\n console.error(\"Error: No package name. Use --app <package> or gpc config set app <package>\");\n process.exit(2);\n }\n return name;\n}\n\nasync function getClient(config: GpcConfig) {\n const auth = await resolveAuth({ serviceAccountPath: config.auth?.serviceAccount });\n return createApiClient({ auth });\n}\n\nexport function registerPricingCommands(program: Command): void {\n const pricing = program.command(\"pricing\").description(\"Pricing and regional price conversion\");\n\n pricing\n .command(\"convert\")\n .description(\"Convert a price to all regional prices\")\n .option(\"--from <currency>\", \"Source currency code (e.g. USD)\")\n .option(\"--amount <number>\", \"Price amount (e.g. 4.99)\")\n .action(async (options) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const { isInteractive, requireOption } = await import(\"../prompt.js\");\n const interactive = isInteractive(program);\n\n options.from = await requireOption(\n \"from\",\n options.from,\n {\n message: \"Source currency code (e.g. USD):\",\n default: \"USD\",\n },\n interactive,\n );\n\n options.amount = await requireOption(\n \"amount\",\n options.amount,\n {\n message: \"Price amount (e.g. 4.99):\",\n },\n interactive,\n );\n const client = await getClient(config);\n const format = detectOutputFormat();\n\n try {\n const result = await convertRegionPrices(client, packageName, options.from, options.amount);\n console.log(formatOutput(result, format));\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n}\n"],"mappings":";;;AAEA,SAAS,kBAAkB;AAC3B,SAAS,mBAAmB;AAC5B,SAAS,uBAAuB;AAChC,SAAS,qBAAqB,oBAAoB,oBAAoB;AAEtE,SAAS,mBAAmB,YAAgC,QAA2B;AACrF,QAAM,OAAO,cAAc,OAAO;AAClC,MAAI,CAAC,MAAM;AACT,YAAQ,MAAM,6EAA6E;AAC3F,YAAQ,KAAK,CAAC;AAAA,EAChB;AACA,SAAO;AACT;AAEA,eAAe,UAAU,QAAmB;AAC1C,QAAM,OAAO,MAAM,YAAY,EAAE,oBAAoB,OAAO,MAAM,eAAe,CAAC;AAClF,SAAO,gBAAgB,EAAE,KAAK,CAAC;AACjC;AAEO,SAAS,wBAAwB,SAAwB;AAC9D,QAAM,UAAU,QAAQ,QAAQ,SAAS,EAAE,YAAY,uCAAuC;AAE9F,UACG,QAAQ,SAAS,EACjB,YAAY,wCAAwC,EACpD,OAAO,qBAAqB,iCAAiC,EAC7D,OAAO,qBAAqB,0BAA0B,EACtD,OAAO,OAAO,YAAY;AACzB,UAAM,SAAS,MAAM,WAAW;AAChC,UAAM,cAAc,mBAAmB,QAAQ,KAAK,EAAE,KAAK,GAAG,MAAM;AACpE,UAAM,EAAE,eAAe,cAAc,IAAI,MAAM,OAAO,sBAAc;AACpE,UAAM,cAAc,cAAc,OAAO;AAEzC,YAAQ,OAAO,MAAM;AAAA,MACnB;AAAA,MACA,QAAQ;AAAA,MACR;AAAA,QACE,SAAS;AAAA,QACT,SAAS;AAAA,MACX;AAAA,MACA;AAAA,IACF;AAEA,YAAQ,SAAS,MAAM;AAAA,MACrB;AAAA,MACA,QAAQ;AAAA,MACR;AAAA,QACE,SAAS;AAAA,MACX;AAAA,MACA;AAAA,IACF;AACA,UAAM,SAAS,MAAM,UAAU,MAAM;AACrC,UAAM,SAAS,mBAAmB;AAElC,QAAI;AACF,YAAM,SAAS,MAAM,oBAAoB,QAAQ,aAAa,QAAQ,MAAM,QAAQ,MAAM;AAC1F,cAAQ,IAAI,aAAa,QAAQ,MAAM,CAAC;AAAA,IAC1C,SAAS,OAAO;AACd,cAAQ,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC,EAAE;AAChF,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF,CAAC;AACL;","names":[]}
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
requireConfirm,
|
|
8
8
|
requireOption,
|
|
9
9
|
skipConfirm
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-Q7KVGI46.js";
|
|
11
11
|
export {
|
|
12
12
|
isInteractive,
|
|
13
13
|
promptConfirm,
|
|
@@ -17,4 +17,4 @@ export {
|
|
|
17
17
|
requireOption,
|
|
18
18
|
skipConfirm
|
|
19
19
|
};
|
|
20
|
-
//# sourceMappingURL=prompt-
|
|
20
|
+
//# sourceMappingURL=prompt-ASDQX6LZ.js.map
|