@gpc-cli/cli 0.9.14 → 0.9.16
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/LICENSE +21 -0
- package/dist/{apps-5YQPQ3KB.js → apps-CVBURB5V.js} +8 -5
- package/dist/apps-CVBURB5V.js.map +1 -0
- package/dist/{auth-CIITFC3C.js → auth-5XAQMZRV.js} +9 -6
- package/dist/auth-5XAQMZRV.js.map +1 -0
- package/dist/bin.js +1 -1
- package/dist/chunk-ELXAK7GI.js +11 -0
- package/dist/chunk-ELXAK7GI.js.map +1 -0
- package/dist/chunk-NV75I5VP.js +0 -0
- package/dist/{chunk-JL4BM7MD.js → chunk-NYGU5OUZ.js} +28 -28
- package/dist/chunk-Y3QZDAKS.js +0 -0
- package/dist/completion-C3PPWNS7.js +0 -0
- package/dist/{config-VLIIRPDQ.js → config-R5U7GV56.js} +6 -3
- package/dist/config-R5U7GV56.js.map +1 -0
- package/dist/{data-safety-M2SFKQ3U.js → data-safety-TNG3QMJX.js} +7 -5
- package/dist/data-safety-TNG3QMJX.js.map +1 -0
- package/dist/{device-tiers-FUZC6IHD.js → device-tiers-WFBZWCTY.js} +7 -5
- package/dist/device-tiers-WFBZWCTY.js.map +1 -0
- package/dist/docs-CVTWIVMS.js +0 -0
- package/dist/doctor-TEIKODLP.js +0 -0
- package/dist/{external-transactions-5U3PMAAG.js → external-transactions-HCL7ROMN.js} +7 -5
- package/dist/external-transactions-HCL7ROMN.js.map +1 -0
- package/dist/{generated-apks-HF7VYA54.js → generated-apks-N4S5PIQH.js} +6 -4
- package/dist/generated-apks-N4S5PIQH.js.map +1 -0
- package/dist/{iap-2CV6SJUF.js → iap-HDSHNFVG.js} +20 -19
- package/dist/iap-HDSHNFVG.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/install-skills-OV4HVANW.js +0 -0
- package/dist/{internal-sharing-FEZFTPWE.js → internal-sharing-OS3HVIY5.js} +5 -3
- package/dist/internal-sharing-OS3HVIY5.js.map +1 -0
- package/dist/{listings-4QCTOEWL.js → listings-AKOLKWLW.js} +14 -12
- package/dist/listings-AKOLKWLW.js.map +1 -0
- package/dist/{migrate-5IA6WGMO.js → migrate-V6G5YUVH.js} +7 -3
- package/dist/migrate-V6G5YUVH.js.map +1 -0
- package/dist/{one-time-products-BHE6WPZI.js → one-time-products-UYXGLH5A.js} +14 -12
- package/dist/one-time-products-UYXGLH5A.js.map +1 -0
- package/dist/{pricing-CQXQDB74.js → pricing-OB3MSWID.js} +6 -3
- package/dist/pricing-OB3MSWID.js.map +1 -0
- package/dist/prompt-BSV22CQZ.js +0 -0
- package/dist/{publish-YP7U64T2.js → publish-PZRWX3TH.js} +6 -3
- package/dist/publish-PZRWX3TH.js.map +1 -0
- package/dist/{purchase-options-2NUBLODI.js → purchase-options-PIOSWZOW.js} +9 -7
- package/dist/purchase-options-PIOSWZOW.js.map +1 -0
- package/dist/{purchases-FI25MLBU.js → purchases-NB5P4FL4.js} +13 -11
- package/dist/purchases-NB5P4FL4.js.map +1 -0
- package/dist/{recovery-DC66ZTGD.js → recovery-Q2I2HV6Q.js} +11 -9
- package/dist/recovery-Q2I2HV6Q.js.map +1 -0
- package/dist/{releases-HDCDARH5.js → releases-KXKLLIRR.js} +10 -7
- package/dist/releases-KXKLLIRR.js.map +1 -0
- package/dist/{reports-T6GBAYUK.js → reports-ZFVKYI4C.js} +5 -3
- package/dist/reports-ZFVKYI4C.js.map +1 -0
- package/dist/{reviews-G3HZG3AS.js → reviews-6V3DO4NB.js} +7 -5
- package/dist/reviews-6V3DO4NB.js.map +1 -0
- package/dist/{status-TBPVS7YR.js → status-S3FAEXNH.js} +6 -3
- package/dist/status-S3FAEXNH.js.map +1 -0
- package/dist/{subscriptions-ZBBYZYP2.js → subscriptions-L4YWMG3F.js} +20 -18
- package/dist/subscriptions-L4YWMG3F.js.map +1 -0
- package/dist/{testers-NXWT2PFS.js → testers-QSAXJM7W.js} +8 -6
- package/dist/testers-QSAXJM7W.js.map +1 -0
- package/dist/{tracks-D6FUNJ75.js → tracks-TP6TDO56.js} +8 -5
- package/dist/tracks-TP6TDO56.js.map +1 -0
- package/dist/{users-N2TK6KI7.js → users-KUVAYRJC.js} +9 -7
- package/dist/users-KUVAYRJC.js.map +1 -0
- package/dist/{validate-TPKVSIMR.js → validate-UYXICKBO.js} +8 -3
- package/dist/validate-UYXICKBO.js.map +1 -0
- package/dist/{vitals-VP2GKG3G.js → vitals-I6FKKKPO.js} +9 -7
- package/dist/vitals-I6FKKKPO.js.map +1 -0
- package/package.json +17 -17
- package/dist/apps-5YQPQ3KB.js.map +0 -1
- package/dist/auth-CIITFC3C.js.map +0 -1
- package/dist/config-VLIIRPDQ.js.map +0 -1
- package/dist/data-safety-M2SFKQ3U.js.map +0 -1
- package/dist/device-tiers-FUZC6IHD.js.map +0 -1
- package/dist/external-transactions-5U3PMAAG.js.map +0 -1
- package/dist/generated-apks-HF7VYA54.js.map +0 -1
- package/dist/iap-2CV6SJUF.js.map +0 -1
- package/dist/internal-sharing-FEZFTPWE.js.map +0 -1
- package/dist/listings-4QCTOEWL.js.map +0 -1
- package/dist/migrate-5IA6WGMO.js.map +0 -1
- package/dist/one-time-products-BHE6WPZI.js.map +0 -1
- package/dist/pricing-CQXQDB74.js.map +0 -1
- package/dist/publish-YP7U64T2.js.map +0 -1
- package/dist/purchase-options-2NUBLODI.js.map +0 -1
- package/dist/purchases-FI25MLBU.js.map +0 -1
- package/dist/recovery-DC66ZTGD.js.map +0 -1
- package/dist/releases-HDCDARH5.js.map +0 -1
- package/dist/reports-T6GBAYUK.js.map +0 -1
- package/dist/reviews-G3HZG3AS.js.map +0 -1
- package/dist/status-TBPVS7YR.js.map +0 -1
- package/dist/subscriptions-ZBBYZYP2.js.map +0 -1
- package/dist/testers-NXWT2PFS.js.map +0 -1
- package/dist/tracks-D6FUNJ75.js.map +0 -1
- package/dist/users-N2TK6KI7.js.map +0 -1
- package/dist/validate-TPKVSIMR.js.map +0 -1
- package/dist/vitals-VP2GKG3G.js.map +0 -1
- /package/dist/{chunk-JL4BM7MD.js.map → chunk-NYGU5OUZ.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/generated-apks.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 {\n listGeneratedApks,\n downloadGeneratedApk,\n formatOutput,\n} from \"@gpc-cli/core\";\nimport { getOutputFormat } from \"../format.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 registerGeneratedApksCommands(program: Command): void {\n const cmd = program\n .command(\"generated-apks\")\n .description(\"Manage device-specific APKs generated by Google Play\");\n\n cmd\n .command(\"list <version-code>\")\n .description(\"List generated APKs for a version code\")\n .action(async (versionCodeStr: string) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const client = await getClient(config);\n const format = getOutputFormat(program, config);\n\n const versionCode = parseInt(versionCodeStr, 10);\n if (isNaN(versionCode)) {\n console.error(\"Error: version-code must be a number\");\n process.exit(2);\n }\n\n try {\n const result = await listGeneratedApks(client, packageName, versionCode);\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 cmd\n .command(\"download <version-code> <apk-id>\")\n .description(\"Download a generated APK\")\n .requiredOption(\"--output <path>\", \"Output file path\")\n .action(async (versionCodeStr: string, apkId: string, opts: { output: string }) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const client = await getClient(config);\n const format = getOutputFormat(program, config);\n\n const versionCode = parseInt(versionCodeStr, 10);\n if (isNaN(versionCode)) {\n console.error(\"Error: version-code must be a number\");\n process.exit(2);\n }\n\n try {\n const result = await downloadGeneratedApk(\n client,\n packageName,\n versionCode,\n apkId,\n opts.output,\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":";;;;;;AAEA,SAAS,kBAAkB;AAC3B,SAAS,mBAAmB;AAC5B,SAAS,uBAAuB;AAChC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP,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,8BAA8B,SAAwB;AACpE,QAAM,MAAM,QACT,QAAQ,gBAAgB,EACxB,YAAY,sDAAsD;AAErE,MACG,QAAQ,qBAAqB,EAC7B,YAAY,wCAAwC,EACpD,OAAO,OAAO,mBAA2B;AACxC,UAAM,SAAS,MAAM,WAAW;AAChC,UAAM,cAAc,mBAAmB,QAAQ,KAAK,EAAE,KAAK,GAAG,MAAM;AACpE,UAAM,SAAS,MAAM,UAAU,MAAM;AACrC,UAAM,SAAS,gBAAgB,SAAS,MAAM;AAE9C,UAAM,cAAc,SAAS,gBAAgB,EAAE;AAC/C,QAAI,MAAM,WAAW,GAAG;AACtB,cAAQ,MAAM,sCAAsC;AACpD,cAAQ,KAAK,CAAC;AAAA,IAChB;AAEA,QAAI;AACF,YAA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
|
|
@@ -13,13 +16,12 @@ import { loadConfig } from "@gpc-cli/config";
|
|
|
13
16
|
import { resolveAuth } from "@gpc-cli/auth";
|
|
14
17
|
import { createApiClient } from "@gpc-cli/api";
|
|
15
18
|
import {
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
listOneTimeProducts,
|
|
20
|
+
getOneTimeProduct,
|
|
18
21
|
createInAppProduct,
|
|
19
22
|
updateInAppProduct,
|
|
20
23
|
deleteInAppProduct,
|
|
21
24
|
syncInAppProducts,
|
|
22
|
-
detectOutputFormat,
|
|
23
25
|
formatOutput,
|
|
24
26
|
sortResults,
|
|
25
27
|
createSpinner
|
|
@@ -37,22 +39,20 @@ async function getClient(config) {
|
|
|
37
39
|
return createApiClient({ auth });
|
|
38
40
|
}
|
|
39
41
|
function registerIapCommands(program) {
|
|
40
|
-
const iap = program.command("iap").description("Manage in-app products");
|
|
42
|
+
const iap = program.command("iap").description("Manage in-app products (uses one-time products API)");
|
|
41
43
|
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").option("--sort <field>", "Sort by field (prefix with - for descending)").action(async (options) => {
|
|
42
44
|
const config = await loadConfig();
|
|
43
45
|
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
44
46
|
const client = await getClient(config);
|
|
45
|
-
const format =
|
|
47
|
+
const format = getOutputFormat(program, config);
|
|
48
|
+
console.error("Note: Using oneTimeProducts API (inappproducts endpoint is deprecated, shutdown Aug 2027)");
|
|
46
49
|
try {
|
|
47
|
-
const result = await
|
|
48
|
-
|
|
49
|
-
limit: options.limit,
|
|
50
|
-
nextPage: options.nextPage
|
|
51
|
-
});
|
|
50
|
+
const result = await listOneTimeProducts(client, packageName);
|
|
51
|
+
let products = result.oneTimeProducts || [];
|
|
52
52
|
if (options.sort) {
|
|
53
|
-
|
|
53
|
+
products = sortResults(products, options.sort);
|
|
54
54
|
}
|
|
55
|
-
console.log(formatOutput(
|
|
55
|
+
console.log(formatOutput(products, format));
|
|
56
56
|
} catch (error) {
|
|
57
57
|
console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
58
58
|
process.exit(4);
|
|
@@ -62,9 +62,10 @@ function registerIapCommands(program) {
|
|
|
62
62
|
const config = await loadConfig();
|
|
63
63
|
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
64
64
|
const client = await getClient(config);
|
|
65
|
-
const format =
|
|
65
|
+
const format = getOutputFormat(program, config);
|
|
66
|
+
console.error("Note: Using oneTimeProducts API (inappproducts endpoint is deprecated, shutdown Aug 2027)");
|
|
66
67
|
try {
|
|
67
|
-
const result = await
|
|
68
|
+
const result = await getOneTimeProduct(client, packageName, sku);
|
|
68
69
|
console.log(formatOutput(result, format));
|
|
69
70
|
} catch (error) {
|
|
70
71
|
console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
@@ -74,7 +75,7 @@ function registerIapCommands(program) {
|
|
|
74
75
|
iap.command("create").description("Create an in-app product from JSON file").requiredOption("--file <path>", "JSON file with product data").action(async (options) => {
|
|
75
76
|
const config = await loadConfig();
|
|
76
77
|
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
77
|
-
const format =
|
|
78
|
+
const format = getOutputFormat(program, config);
|
|
78
79
|
if (isDryRun(program)) {
|
|
79
80
|
printDryRun(
|
|
80
81
|
{
|
|
@@ -100,7 +101,7 @@ function registerIapCommands(program) {
|
|
|
100
101
|
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) => {
|
|
101
102
|
const config = await loadConfig();
|
|
102
103
|
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
103
|
-
const format =
|
|
104
|
+
const format = getOutputFormat(program, config);
|
|
104
105
|
if (isDryRun(program)) {
|
|
105
106
|
printDryRun(
|
|
106
107
|
{
|
|
@@ -129,7 +130,7 @@ function registerIapCommands(program) {
|
|
|
129
130
|
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
130
131
|
await requireConfirm(`Delete in-app product "${sku}"?`, program);
|
|
131
132
|
if (isDryRun(program)) {
|
|
132
|
-
const format =
|
|
133
|
+
const format = getOutputFormat(program, config);
|
|
133
134
|
printDryRun(
|
|
134
135
|
{
|
|
135
136
|
command: "iap delete",
|
|
@@ -154,7 +155,7 @@ function registerIapCommands(program) {
|
|
|
154
155
|
const config = await loadConfig();
|
|
155
156
|
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
156
157
|
const client = await getClient(config);
|
|
157
|
-
const format =
|
|
158
|
+
const format = getOutputFormat(program, config);
|
|
158
159
|
const dryRun = isDryRun(program);
|
|
159
160
|
const spinner = createSpinner("Syncing in-app products...");
|
|
160
161
|
if (!program.opts()["quiet"] && process.stderr.isTTY) spinner.start();
|
|
@@ -177,4 +178,4 @@ function registerIapCommands(program) {
|
|
|
177
178
|
export {
|
|
178
179
|
registerIapCommands
|
|
179
180
|
};
|
|
180
|
-
//# sourceMappingURL=iap-
|
|
181
|
+
//# sourceMappingURL=iap-HDSHNFVG.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 listOneTimeProducts,\n getOneTimeProduct,\n createInAppProduct,\n updateInAppProduct,\n deleteInAppProduct,\n syncInAppProducts,\n formatOutput,\n sortResults,\n createSpinner,\n} from \"@gpc-cli/core\";\nimport { isDryRun, printDryRun } from \"../dry-run.js\";\nimport { getOutputFormat } from \"../format.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 (uses one-time products API)\");\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 .option(\"--sort <field>\", \"Sort by field (prefix with - for descending)\")\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 = getOutputFormat(program, config);\n\n console.error(\"Note: Using oneTimeProducts API (inappproducts endpoint is deprecated, shutdown Aug 2027)\");\n\n try {\n const result = await listOneTimeProducts(client, packageName);\n let products = result.oneTimeProducts || [];\n if (options.sort) {\n products = sortResults(products, options.sort);\n }\n console.log(formatOutput(products, 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 = getOutputFormat(program, config);\n\n console.error(\"Note: Using oneTimeProducts API (inappproducts endpoint is deprecated, shutdown Aug 2027)\");\n\n try {\n const result = await getOneTimeProduct(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 = getOutputFormat(program, config);\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 = getOutputFormat(program, config);\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 = getOutputFormat(program, config);\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 .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 = getOutputFormat(program, config);\n const dryRun = isDryRun(program);\n\n const spinner = createSpinner(\"Syncing in-app products...\");\n if (!program.opts()[\"quiet\"] && process.stderr.isTTY) spinner.start();\n\n try {\n const result = await syncInAppProducts(client, packageName, options.dir, {\n dryRun,\n });\n spinner.stop(\"Sync complete\");\n if (dryRun) {\n console.log(`[dry-run] Would create: ${result.created}, update: ${result.updated}`);\n }\n console.log(formatOutput(result, format));\n } catch (error) {\n spinner.fail(\"Sync failed\");\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,EACA;AAAA,OACK;AAKP,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,qDAAqD;AAEpG,MACG,QAAQ,MAAM,EACd,YAAY,sBAAsB,EAClC,OAAO,aAAa,4BAA4B,QAAQ,EACxD,OAAO,eAAe,yBAAyB,QAAQ,EACvD,OAAO,uBAAuB,wBAAwB,EACtD,OAAO,kBAAkB,8CAA8C,EACvE,OAAO,OAAO,YAA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,UAAM,UAAU,cAAc,4BAA4B;AAC1D,QAAI,CAAC,QAAQ,KAAK,EAAE,OAAO,KAAK,QAAQ,OAAO,MAAO,SAAQ,MAAM;AAEpE,QAAI;AACF,YAAM,SAAS,MAAM,kBAAkB,QAAQ,aAAa,QAAQ,KAAK;AAAA,QACvE;AAAA,MACF,CAAC;AACD,cAAQ,KAAK,eAAe;AAC5B,UAAI,QAAQ;AACV,gBAAQ,IAAI,2BAA2B,OAAO,OAAO,aAAa,OAAO,OAAO,EAAE;AAAA,MACpF;AACA,cAAQ,IAAI,aAAa,QAAQ,MAAM,CAAC;AAAA,IAC1C,SAAS,OAAO;AACd,cAAQ,KAAK,aAAa;AAC1B,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
|
File without changes
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
getOutputFormat
|
|
4
|
+
} from "./chunk-ELXAK7GI.js";
|
|
2
5
|
|
|
3
6
|
// src/commands/internal-sharing.ts
|
|
4
7
|
import { loadConfig } from "@gpc-cli/config";
|
|
@@ -6,7 +9,6 @@ import { resolveAuth } from "@gpc-cli/auth";
|
|
|
6
9
|
import { createApiClient } from "@gpc-cli/api";
|
|
7
10
|
import {
|
|
8
11
|
uploadInternalSharing,
|
|
9
|
-
detectOutputFormat,
|
|
10
12
|
formatOutput,
|
|
11
13
|
createSpinner
|
|
12
14
|
} from "@gpc-cli/core";
|
|
@@ -28,7 +30,7 @@ function registerInternalSharingCommands(program) {
|
|
|
28
30
|
const config = await loadConfig();
|
|
29
31
|
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
30
32
|
const client = await getClient(config);
|
|
31
|
-
const format =
|
|
33
|
+
const format = getOutputFormat(program, config);
|
|
32
34
|
const fileType = opts.type;
|
|
33
35
|
const spinner = createSpinner("Uploading for internal sharing...");
|
|
34
36
|
if (!program.opts()["quiet"] && process.stderr.isTTY) spinner.start();
|
|
@@ -46,4 +48,4 @@ function registerInternalSharingCommands(program) {
|
|
|
46
48
|
export {
|
|
47
49
|
registerInternalSharingCommands
|
|
48
50
|
};
|
|
49
|
-
//# sourceMappingURL=internal-sharing-
|
|
51
|
+
//# sourceMappingURL=internal-sharing-OS3HVIY5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/internal-sharing.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 {\n uploadInternalSharing,\n formatOutput,\n createSpinner,\n} from \"@gpc-cli/core\";\nimport { getOutputFormat } from \"../format.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 registerInternalSharingCommands(program: Command): void {\n const cmd = program\n .command(\"internal-sharing\")\n .description(\"Upload bundles or APKs for instant internal sharing\");\n\n cmd\n .command(\"upload <file>\")\n .description(\"Upload a bundle or APK for internal app sharing\")\n .option(\"--type <type>\", \"File type: bundle or apk (auto-detected from extension)\")\n .action(async (file: string, opts: { type?: string }) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const client = await getClient(config);\n const format = getOutputFormat(program, config);\n\n const fileType = opts.type as \"bundle\" | \"apk\" | undefined;\n\n const spinner = createSpinner(\"Uploading for internal sharing...\");\n if (!program.opts()[\"quiet\"] && process.stderr.isTTY) spinner.start();\n\n try {\n const result = await uploadInternalSharing(client, packageName, file, fileType);\n spinner.stop(\"Upload complete\");\n console.log(formatOutput(result, format));\n } catch (error) {\n spinner.fail(\"Upload failed\");\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;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP,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,gCAAgC,SAAwB;AACtE,QAAM,MAAM,QACT,QAAQ,kBAAkB,EAC1B,YAAY,qDAAqD;AAEpE,MACG,QAAQ,eAAe,EACvB,YAAY,iDAAiD,EAC7D,OAAO,iBAAiB,yDAAyD,EACjF,OAAO,OAAO,MAAc,SAA4B;AACvD,UAAM,SAAS,MAAM,WAAW;AAChC,UAAM,cAAc,mBAAmB,QAAQ,KAAK,EAAE,KAAK,GAAG,MAAM;AACpE,UAAM,SAAS,MAAM,UAAU,MAAM;AACrC,UAAM,SAAS,gBAAgB,SAAS,MAAM;AAE9C,UAAM,WAAW,KAAK;AAEtB,UAAM,UAAU,cAAc,mCAAmC;AACjE,QAAI,CAAC,QAAQ,KAAK,EAAE,OAAO,KAAK,QAAQ,OAAO,MAAO,SAAQ,MAAM;AAEpE,QAAI;AACF,YAAM,SAAS,MAAM,sBAAsB,QAAQ,aAAa,MAAM,QAAQ;AAC9E,cAAQ,KAAK,iBAAiB;AAC9B,cAAQ,IAAI,aAAa,QAAQ,MAAM,CAAC;AAAA,IAC1C,SAAS,OAAO;AACd,cAAQ,KAAK,eAAe;AAC5B,cAAQ,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC,EAAE;AAChF,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF,CAAC;AACL;","names":[]}
|
|
@@ -3,6 +3,9 @@ import {
|
|
|
3
3
|
isDryRun,
|
|
4
4
|
printDryRun
|
|
5
5
|
} from "./chunk-Y3QZDAKS.js";
|
|
6
|
+
import {
|
|
7
|
+
getOutputFormat
|
|
8
|
+
} from "./chunk-ELXAK7GI.js";
|
|
6
9
|
import {
|
|
7
10
|
isInteractive,
|
|
8
11
|
requireConfirm,
|
|
@@ -25,7 +28,6 @@ import {
|
|
|
25
28
|
deleteImage,
|
|
26
29
|
exportImages,
|
|
27
30
|
getCountryAvailability,
|
|
28
|
-
detectOutputFormat,
|
|
29
31
|
formatOutput,
|
|
30
32
|
createSpinner
|
|
31
33
|
} from "@gpc-cli/core";
|
|
@@ -65,7 +67,7 @@ function registerListingsCommands(program) {
|
|
|
65
67
|
const config = await loadConfig();
|
|
66
68
|
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
67
69
|
const client = await getClient(config);
|
|
68
|
-
const format =
|
|
70
|
+
const format = getOutputFormat(program, config);
|
|
69
71
|
try {
|
|
70
72
|
const result = await getListings(client, packageName, options.lang);
|
|
71
73
|
console.log(formatOutput(result, format));
|
|
@@ -87,7 +89,7 @@ function registerListingsCommands(program) {
|
|
|
87
89
|
},
|
|
88
90
|
interactive
|
|
89
91
|
);
|
|
90
|
-
const format =
|
|
92
|
+
const format = getOutputFormat(program, config);
|
|
91
93
|
try {
|
|
92
94
|
const data = {};
|
|
93
95
|
if (options["title"]) data["title"] = options["title"];
|
|
@@ -139,7 +141,7 @@ function registerListingsCommands(program) {
|
|
|
139
141
|
);
|
|
140
142
|
await requireConfirm(`Delete listing for "${options.lang}"?`, program);
|
|
141
143
|
if (isDryRun(program)) {
|
|
142
|
-
const format =
|
|
144
|
+
const format = getOutputFormat(program, config);
|
|
143
145
|
printDryRun(
|
|
144
146
|
{
|
|
145
147
|
command: "listings delete",
|
|
@@ -164,7 +166,7 @@ function registerListingsCommands(program) {
|
|
|
164
166
|
const config = await loadConfig();
|
|
165
167
|
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
166
168
|
const client = await getClient(config);
|
|
167
|
-
const format =
|
|
169
|
+
const format = getOutputFormat(program, config);
|
|
168
170
|
try {
|
|
169
171
|
const result = await pullListings(client, packageName, options.dir);
|
|
170
172
|
console.log(
|
|
@@ -186,7 +188,7 @@ function registerListingsCommands(program) {
|
|
|
186
188
|
const config = await loadConfig();
|
|
187
189
|
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
188
190
|
const client = await getClient(config);
|
|
189
|
-
const format =
|
|
191
|
+
const format = getOutputFormat(program, config);
|
|
190
192
|
const spinner = createSpinner("Pushing listings...");
|
|
191
193
|
if (!program.opts()["quiet"] && process.stderr.isTTY) spinner.start();
|
|
192
194
|
try {
|
|
@@ -205,7 +207,7 @@ function registerListingsCommands(program) {
|
|
|
205
207
|
const config = await loadConfig();
|
|
206
208
|
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
207
209
|
const client = await getClient(config);
|
|
208
|
-
const format =
|
|
210
|
+
const format = getOutputFormat(program, config);
|
|
209
211
|
try {
|
|
210
212
|
const diffs = await diffListingsCommand(client, packageName, options.dir);
|
|
211
213
|
if (diffs.length === 0) {
|
|
@@ -254,7 +256,7 @@ function registerListingsCommands(program) {
|
|
|
254
256
|
interactive
|
|
255
257
|
);
|
|
256
258
|
const client = await getClient(config);
|
|
257
|
-
const format =
|
|
259
|
+
const format = getOutputFormat(program, config);
|
|
258
260
|
const imageType = validateImageType(options.type);
|
|
259
261
|
try {
|
|
260
262
|
const result = await listImages(client, packageName, options.lang, imageType);
|
|
@@ -287,7 +289,7 @@ function registerListingsCommands(program) {
|
|
|
287
289
|
interactive
|
|
288
290
|
);
|
|
289
291
|
const client = await getClient(config);
|
|
290
|
-
const format =
|
|
292
|
+
const format = getOutputFormat(program, config);
|
|
291
293
|
const imageType = validateImageType(options.type);
|
|
292
294
|
const spinner = createSpinner("Uploading image...");
|
|
293
295
|
if (!program.opts()["quiet"] && process.stderr.isTTY) spinner.start();
|
|
@@ -345,7 +347,7 @@ function registerListingsCommands(program) {
|
|
|
345
347
|
const config = await loadConfig();
|
|
346
348
|
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
347
349
|
const client = await getClient(config);
|
|
348
|
-
const format =
|
|
350
|
+
const format = getOutputFormat(program, config);
|
|
349
351
|
const exportOpts = {};
|
|
350
352
|
if (options.lang) exportOpts.lang = options.lang;
|
|
351
353
|
if (options.type) {
|
|
@@ -367,7 +369,7 @@ function registerListingsCommands(program) {
|
|
|
367
369
|
const config = await loadConfig();
|
|
368
370
|
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
369
371
|
const client = await getClient(config);
|
|
370
|
-
const format =
|
|
372
|
+
const format = getOutputFormat(program, config);
|
|
371
373
|
try {
|
|
372
374
|
const result = await getCountryAvailability(client, packageName, options.track);
|
|
373
375
|
console.log(formatOutput(result, format));
|
|
@@ -380,4 +382,4 @@ function registerListingsCommands(program) {
|
|
|
380
382
|
export {
|
|
381
383
|
registerListingsCommands
|
|
382
384
|
};
|
|
383
|
-
//# sourceMappingURL=listings-
|
|
385
|
+
//# sourceMappingURL=listings-AKOLKWLW.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 diffListingsCommand,\n listImages,\n uploadImage,\n deleteImage,\n exportImages,\n getCountryAvailability,\n formatOutput,\n createSpinner,\n} from \"@gpc-cli/core\";\nimport { getOutputFormat } from \"../format.js\";\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 = getOutputFormat(program, config);\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 = getOutputFormat(program, config);\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 = getOutputFormat(program, config);\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 = getOutputFormat(program, config);\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 .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 = getOutputFormat(program, config);\n\n const spinner = createSpinner(\"Pushing listings...\");\n if (!program.opts()[\"quiet\"] && process.stderr.isTTY) spinner.start();\n\n try {\n const result = await pushListings(client, packageName, options.dir, {\n dryRun: isDryRun(program),\n });\n spinner.stop(\"Listings pushed\");\n console.log(formatOutput(result, format));\n } catch (error) {\n spinner.fail(\"Push failed\");\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n\n // Diff\n listings\n .command(\"diff\")\n .description(\"Compare local Fastlane-format metadata against remote listings\")\n .option(\"--dir <path>\", \"Local metadata 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 = getOutputFormat(program, config);\n\n try {\n const diffs = await diffListingsCommand(client, packageName, options.dir);\n\n if (diffs.length === 0) {\n if (format === \"json\") {\n console.log(formatOutput([], format));\n } else {\n console.log(\"No differences found.\");\n }\n return;\n }\n\n if (format === \"json\") {\n console.log(formatOutput(diffs, format));\n } else {\n for (const diff of diffs) {\n console.log(`[${diff.language}] ${diff.field}:`);\n console.log(` local: ${diff.local || \"(empty)\"}`);\n console.log(` remote: ${diff.remote || \"(empty)\"}`);\n }\n }\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 .option(\"--limit <n>\", \"Maximum results to return\")\n .option(\"--next-page <token>\", \"Pagination token for next page\")\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 = getOutputFormat(program, config);\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 = getOutputFormat(program, config);\n const imageType = validateImageType(options.type);\n\n const spinner = createSpinner(\"Uploading image...\");\n if (!program.opts()[\"quiet\"] && process.stderr.isTTY) spinner.start();\n\n try {\n const result = await uploadImage(client, packageName, options.lang, imageType, file);\n spinner.stop(\"Image uploaded\");\n console.log(formatOutput(result, format));\n } catch (error) {\n spinner.fail(\"Image upload failed\");\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 // Images export\n images\n .command(\"export\")\n .description(\"Export all images to a local directory\")\n .option(\"--dir <path>\", \"Output directory\", \"images\")\n .option(\"--lang <language>\", \"Language code (BCP 47) — export only this language\")\n .option(\"--type <type>\", \"Image type — export only this type\")\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 = getOutputFormat(program, config);\n\n const exportOpts: { lang?: string; type?: ImageType } = {};\n if (options.lang) exportOpts.lang = options.lang;\n if (options.type) {\n exportOpts.type = validateImageType(options.type);\n }\n\n const spinner = createSpinner(\"Exporting images...\");\n if (!program.opts()[\"quiet\"] && process.stderr.isTTY) spinner.start();\n\n try {\n const result = await exportImages(client, packageName, options.dir, exportOpts);\n spinner.stop(\"Images exported\");\n console.log(formatOutput(result, format));\n } catch (error) {\n spinner.fail(\"Image export failed\");\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 = getOutputFormat(program, config);\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;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAKP,SAAS,mBAAmB,YAAgC,QAA2B;AACrF,QAAM,OAAO,cAAc,OAAO;AAClC,MAAI,CAAC,MAAM;AACT,YAAQ,MAAM,6EAA6E;AAC3F,YAA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AAM,aAAa,QAAQ,aAAa,QAAQ,KAAK,UAAU;AAC9E,cAAQ,KAAK,iBAAiB;AAC9B,cAAQ,IAAI,aAAa,QAAQ,MAAM,CAAC;AAAA,IAC1C,SAAS,OAAO;AACd,cAAQ,KAAK,qBAAqB;AAClC,cAAQ,MAAM,UAAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC,EAAE;AAChF,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF,CAAC;AAGH,WACG,QAAQ,cAAc,EACtB,YAAY,sCAAsC,EAClD,OAAO,mBAAmB,cAAc,YAAY,EACpD,OAAO,OAAO,YAAY;AACzB,UAAM,SAAS,MAAM,WAAW;AAChC,UAAM,cAAc,mBAAmB,QAAQ,KAAK,EAAE,KAAK,GAAG,MAAM;AACpE,UAAM,SAAS,MAAM,UAAU,MAAM;AACrC,UAAM,SAAS,gBAAgB,SAAS,MAAM;AAE9C,QAAI;AACF,YAAM,SAAS,MAAM,uBAAuB,QAAQ,aAAa,QAAQ,KAAK;AAC9E,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":[]}
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
getOutputFormat
|
|
4
|
+
} from "./chunk-ELXAK7GI.js";
|
|
2
5
|
|
|
3
6
|
// src/commands/migrate.ts
|
|
7
|
+
import { loadConfig } from "@gpc-cli/config";
|
|
4
8
|
import {
|
|
5
9
|
detectFastlane,
|
|
6
10
|
generateMigrationPlan,
|
|
7
11
|
writeMigrationOutput,
|
|
8
|
-
detectOutputFormat,
|
|
9
12
|
formatOutput
|
|
10
13
|
} from "@gpc-cli/core";
|
|
11
14
|
function registerMigrateCommands(program) {
|
|
12
15
|
const migrate = program.command("migrate").description("Migrate from other tools to GPC");
|
|
13
16
|
migrate.command("fastlane").description("Migrate from Fastlane to GPC").option("--dir <path>", "Directory containing Fastlane files", ".").option("--output <path>", "Output directory for migration files", ".").action(async (options) => {
|
|
14
|
-
const
|
|
17
|
+
const config = await loadConfig();
|
|
18
|
+
const format = getOutputFormat(program, config);
|
|
15
19
|
try {
|
|
16
20
|
const detection = await detectFastlane(options.dir);
|
|
17
21
|
if (format === "json") {
|
|
@@ -73,4 +77,4 @@ function registerMigrateCommands(program) {
|
|
|
73
77
|
export {
|
|
74
78
|
registerMigrateCommands
|
|
75
79
|
};
|
|
76
|
-
//# sourceMappingURL=migrate-
|
|
80
|
+
//# sourceMappingURL=migrate-V6G5YUVH.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/migrate.ts"],"sourcesContent":["import type { Command } from \"commander\";\nimport { loadConfig } from \"@gpc-cli/config\";\nimport {\n detectFastlane,\n generateMigrationPlan,\n writeMigrationOutput,\n formatOutput,\n} from \"@gpc-cli/core\";\nimport { getOutputFormat } from \"../format.js\";\n\nexport function registerMigrateCommands(program: Command): void {\n const migrate = program.command(\"migrate\").description(\"Migrate from other tools to GPC\");\n\n migrate\n .command(\"fastlane\")\n .description(\"Migrate from Fastlane to GPC\")\n .option(\"--dir <path>\", \"Directory containing Fastlane files\", \".\")\n .option(\"--output <path>\", \"Output directory for migration files\", \".\")\n .action(async (options) => {\n const config = await loadConfig();\n const format = getOutputFormat(program, config);\n\n try {\n const detection = await detectFastlane(options.dir);\n\n // Show detection results\n if (format === \"json\") {\n console.log(formatOutput(detection, format));\n } else {\n console.log(\"Fastlane Detection Results:\");\n console.log(` Fastfile: ${detection.hasFastfile ? \"found\" : \"not found\"}`);\n console.log(` Appfile: ${detection.hasAppfile ? \"found\" : \"not found\"}`);\n console.log(` Metadata: ${detection.hasMetadata ? \"found\" : \"not found\"}`);\n console.log(` Gemfile: ${detection.hasGemfile ? \"found\" : \"not found\"}`);\n\n if (detection.packageName) {\n console.log(` Package: ${detection.packageName}`);\n }\n\n if (detection.lanes.length > 0) {\n console.log(`\\n Lanes found: ${detection.lanes.length}`);\n for (const lane of detection.lanes) {\n const equiv = lane.gpcEquivalent ? ` -> ${lane.gpcEquivalent}` : \" (no equivalent)\";\n console.log(` - ${lane.name}${equiv}`);\n }\n }\n\n if (detection.metadataLanguages.length > 0) {\n console.log(`\\n Metadata languages: ${detection.metadataLanguages.join(\", \")}`);\n }\n }\n\n if (\n !detection.hasFastfile &&\n !detection.hasAppfile &&\n !detection.hasMetadata\n ) {\n if (format !== \"json\") {\n console.log(\"\\nNo Fastlane files detected. Nothing to migrate.\");\n }\n return;\n }\n\n // Generate migration plan\n const plan = generateMigrationPlan(detection);\n\n // Write output files\n const files = await writeMigrationOutput(plan, options.output);\n\n if (format === \"json\") {\n console.log(formatOutput({ detection, plan, files }, format));\n } else {\n console.log(\"\\nMigration files written:\");\n for (const file of files) {\n console.log(` ${file}`);\n }\n\n if (plan.warnings.length > 0) {\n console.log(\"\\nWarnings:\");\n for (const warning of plan.warnings) {\n console.log(` - ${warning}`);\n }\n }\n\n console.log(\"\\nMigration Checklist:\");\n for (const item of plan.checklist) {\n console.log(` [ ] ${item}`);\n }\n }\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(1);\n }\n });\n}\n"],"mappings":";;;;;;AACA,SAAS,kBAAkB;AAC3B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGA,SAAS,wBAAwB,SAAwB;AAC9D,QAAM,UAAU,QAAQ,QAAQ,SAAS,EAAE,YAAY,iCAAiC;AAExF,UACG,QAAQ,UAAU,EAClB,YAAY,8BAA8B,EAC1C,OAAO,gBAAgB,uCAAuC,GAAG,EACjE,OAAO,mBAAmB,wCAAwC,GAAG,EACrE,OAAO,OAAO,YAAY;AACzB,UAAM,SAAS,MAAM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E,WAAW,MAAM,MAAM,GAAG,MAAM,CAAC;AAAA,MAC9D,OAAO;AACL,gBAAQ,IAAI,4BAA4B;AACxC,mBAAW,QAAQ,OAAO;AACxB,kBAAQ,IAAI,KAAK,IAAI,EAAE;AAAA,QACzB;AAEA,YAAI,KAAK,SAAS,SAAS,GAAG;AAC5B,kBAAQ,IAAI,aAAa;AACzB,qBAAW,WAAW,KAAK,UAAU;AACnC,oBAAQ,IAAI,OAAO,OAAO,EAAE;AAAA,UAC9B;AAAA,QACF;AAEA,gBAAQ,IAAI,wBAAwB;AACpC,mBAAW,QAAQ,KAAK,WAAW;AACjC,kBAAQ,IAAI,SAAS,IAAI,EAAE;AAAA,QAC7B;AAAA,MACF;AAAA,IACF,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":[]}
|
|
@@ -3,6 +3,9 @@ import {
|
|
|
3
3
|
isDryRun,
|
|
4
4
|
printDryRun
|
|
5
5
|
} from "./chunk-Y3QZDAKS.js";
|
|
6
|
+
import {
|
|
7
|
+
getOutputFormat
|
|
8
|
+
} from "./chunk-ELXAK7GI.js";
|
|
6
9
|
import {
|
|
7
10
|
requireConfirm
|
|
8
11
|
} from "./chunk-NV75I5VP.js";
|
|
@@ -23,7 +26,6 @@ import {
|
|
|
23
26
|
createOneTimeOffer,
|
|
24
27
|
updateOneTimeOffer,
|
|
25
28
|
deleteOneTimeOffer,
|
|
26
|
-
detectOutputFormat,
|
|
27
29
|
formatOutput,
|
|
28
30
|
sortResults
|
|
29
31
|
} from "@gpc-cli/core";
|
|
@@ -45,7 +47,7 @@ function registerOneTimeProductsCommands(program) {
|
|
|
45
47
|
const config = await loadConfig();
|
|
46
48
|
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
47
49
|
const client = await getClient(config);
|
|
48
|
-
const format =
|
|
50
|
+
const format = getOutputFormat(program, config);
|
|
49
51
|
try {
|
|
50
52
|
const result = await listOneTimeProducts(client, packageName);
|
|
51
53
|
if (options.sort) {
|
|
@@ -61,7 +63,7 @@ function registerOneTimeProductsCommands(program) {
|
|
|
61
63
|
const config = await loadConfig();
|
|
62
64
|
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
63
65
|
const client = await getClient(config);
|
|
64
|
-
const format =
|
|
66
|
+
const format = getOutputFormat(program, config);
|
|
65
67
|
try {
|
|
66
68
|
const result = await getOneTimeProduct(client, packageName, productId);
|
|
67
69
|
console.log(formatOutput(result, format));
|
|
@@ -73,7 +75,7 @@ function registerOneTimeProductsCommands(program) {
|
|
|
73
75
|
otp.command("create").description("Create a one-time product from JSON file").requiredOption("--file <path>", "JSON file with product data").action(async (options) => {
|
|
74
76
|
const config = await loadConfig();
|
|
75
77
|
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
76
|
-
const format =
|
|
78
|
+
const format = getOutputFormat(program, config);
|
|
77
79
|
if (isDryRun(program)) {
|
|
78
80
|
printDryRun(
|
|
79
81
|
{
|
|
@@ -99,7 +101,7 @@ function registerOneTimeProductsCommands(program) {
|
|
|
99
101
|
otp.command("update <product-id>").description("Update a one-time product from JSON file").requiredOption("--file <path>", "JSON file with product data").action(async (productId, options) => {
|
|
100
102
|
const config = await loadConfig();
|
|
101
103
|
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
102
|
-
const format =
|
|
104
|
+
const format = getOutputFormat(program, config);
|
|
103
105
|
if (isDryRun(program)) {
|
|
104
106
|
printDryRun(
|
|
105
107
|
{
|
|
@@ -128,7 +130,7 @@ function registerOneTimeProductsCommands(program) {
|
|
|
128
130
|
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
129
131
|
await requireConfirm(`Delete one-time product "${productId}"?`, program);
|
|
130
132
|
if (isDryRun(program)) {
|
|
131
|
-
const format =
|
|
133
|
+
const format = getOutputFormat(program, config);
|
|
132
134
|
printDryRun(
|
|
133
135
|
{
|
|
134
136
|
command: "one-time-products delete",
|
|
@@ -154,7 +156,7 @@ function registerOneTimeProductsCommands(program) {
|
|
|
154
156
|
const config = await loadConfig();
|
|
155
157
|
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
156
158
|
const client = await getClient(config);
|
|
157
|
-
const format =
|
|
159
|
+
const format = getOutputFormat(program, config);
|
|
158
160
|
try {
|
|
159
161
|
const result = await listOneTimeOffers(client, packageName, productId);
|
|
160
162
|
if (options.sort) {
|
|
@@ -170,7 +172,7 @@ function registerOneTimeProductsCommands(program) {
|
|
|
170
172
|
const config = await loadConfig();
|
|
171
173
|
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
172
174
|
const client = await getClient(config);
|
|
173
|
-
const format =
|
|
175
|
+
const format = getOutputFormat(program, config);
|
|
174
176
|
try {
|
|
175
177
|
const result = await getOneTimeOffer(client, packageName, productId, offerId);
|
|
176
178
|
console.log(formatOutput(result, format));
|
|
@@ -182,7 +184,7 @@ function registerOneTimeProductsCommands(program) {
|
|
|
182
184
|
offers.command("create <product-id>").description("Create an offer from JSON file").requiredOption("--file <path>", "JSON file with offer data").action(async (productId, options) => {
|
|
183
185
|
const config = await loadConfig();
|
|
184
186
|
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
185
|
-
const format =
|
|
187
|
+
const format = getOutputFormat(program, config);
|
|
186
188
|
if (isDryRun(program)) {
|
|
187
189
|
printDryRun(
|
|
188
190
|
{
|
|
@@ -209,7 +211,7 @@ function registerOneTimeProductsCommands(program) {
|
|
|
209
211
|
offers.command("update <product-id> <offer-id>").description("Update an offer from JSON file").requiredOption("--file <path>", "JSON file with offer data").action(async (productId, offerId, options) => {
|
|
210
212
|
const config = await loadConfig();
|
|
211
213
|
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
212
|
-
const format =
|
|
214
|
+
const format = getOutputFormat(program, config);
|
|
213
215
|
if (isDryRun(program)) {
|
|
214
216
|
printDryRun(
|
|
215
217
|
{
|
|
@@ -238,7 +240,7 @@ function registerOneTimeProductsCommands(program) {
|
|
|
238
240
|
const packageName = resolvePackageName(program.opts()["app"], config);
|
|
239
241
|
await requireConfirm(`Delete offer "${offerId}" for product "${productId}"?`, program);
|
|
240
242
|
if (isDryRun(program)) {
|
|
241
|
-
const format =
|
|
243
|
+
const format = getOutputFormat(program, config);
|
|
242
244
|
printDryRun(
|
|
243
245
|
{
|
|
244
246
|
command: "one-time-products offers delete",
|
|
@@ -263,4 +265,4 @@ function registerOneTimeProductsCommands(program) {
|
|
|
263
265
|
export {
|
|
264
266
|
registerOneTimeProductsCommands
|
|
265
267
|
};
|
|
266
|
-
//# sourceMappingURL=one-time-products-
|
|
268
|
+
//# sourceMappingURL=one-time-products-UYXGLH5A.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/one-time-products.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 listOneTimeProducts,\n getOneTimeProduct,\n createOneTimeProduct,\n updateOneTimeProduct,\n deleteOneTimeProduct,\n listOneTimeOffers,\n getOneTimeOffer,\n createOneTimeOffer,\n updateOneTimeOffer,\n deleteOneTimeOffer,\n formatOutput,\n sortResults,\n} from \"@gpc-cli/core\";\nimport { getOutputFormat } from \"../format.js\";\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 registerOneTimeProductsCommands(program: Command): void {\n const otp = program\n .command(\"one-time-products\")\n .alias(\"otp\")\n .description(\"Manage one-time products and offers (modern OTP API)\");\n\n otp\n .command(\"list\")\n .description(\"List one-time products\")\n .option(\"--sort <field>\", \"Sort by field (prefix with - for descending)\")\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 = getOutputFormat(program, config);\n\n try {\n const result = await listOneTimeProducts(client, packageName);\n if (options.sort) {\n result.oneTimeProducts = sortResults(result.oneTimeProducts, options.sort);\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 otp\n .command(\"get <product-id>\")\n .description(\"Get a one-time product\")\n .action(async (productId: string) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const client = await getClient(config);\n const format = getOutputFormat(program, config);\n\n try {\n const result = await getOneTimeProduct(client, packageName, productId);\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 otp\n .command(\"create\")\n .description(\"Create a one-time 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 = getOutputFormat(program, config);\n\n if (isDryRun(program)) {\n printDryRun(\n {\n command: \"one-time-products create\",\n action: \"create\",\n target: `one-time 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 createOneTimeProduct(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 otp\n .command(\"update <product-id>\")\n .description(\"Update a one-time product from JSON file\")\n .requiredOption(\"--file <path>\", \"JSON file with product data\")\n .action(async (productId: string, options) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const format = getOutputFormat(program, config);\n\n if (isDryRun(program)) {\n printDryRun(\n {\n command: \"one-time-products update\",\n action: \"update\",\n target: productId,\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 updateOneTimeProduct(client, packageName, productId, 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 otp\n .command(\"delete <product-id>\")\n .description(\"Delete a one-time product\")\n .action(async (productId: string) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n\n await requireConfirm(`Delete one-time product \"${productId}\"?`, program);\n\n if (isDryRun(program)) {\n const format = getOutputFormat(program, config);\n printDryRun(\n {\n command: \"one-time-products delete\",\n action: \"delete\",\n target: productId,\n },\n format,\n formatOutput,\n );\n return;\n }\n\n const client = await getClient(config);\n\n try {\n await deleteOneTimeProduct(client, packageName, productId);\n console.log(`One-time product ${productId} deleted.`);\n } catch (error) {\n console.error(`Error: ${error instanceof Error ? error.message : String(error)}`);\n process.exit(4);\n }\n });\n\n // --- Offers ---\n const offers = otp.command(\"offers\").description(\"Manage one-time product offers\");\n\n offers\n .command(\"list <product-id>\")\n .description(\"List offers for a one-time product\")\n .option(\"--sort <field>\", \"Sort by field (prefix with - for descending)\")\n .action(async (productId: string, options) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const client = await getClient(config);\n const format = getOutputFormat(program, config);\n\n try {\n const result = await listOneTimeOffers(client, packageName, productId);\n if (options.sort) {\n result.oneTimeOffers = sortResults(result.oneTimeOffers, options.sort);\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 offers\n .command(\"get <product-id> <offer-id>\")\n .description(\"Get an offer for a one-time product\")\n .action(async (productId: string, offerId: string) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const client = await getClient(config);\n const format = getOutputFormat(program, config);\n\n try {\n const result = await getOneTimeOffer(client, packageName, productId, offerId);\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 offers\n .command(\"create <product-id>\")\n .description(\"Create an offer from JSON file\")\n .requiredOption(\"--file <path>\", \"JSON file with offer data\")\n .action(async (productId: string, options: { file: string }) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const format = getOutputFormat(program, config);\n\n if (isDryRun(program)) {\n printDryRun(\n {\n command: \"one-time-products offers create\",\n action: \"create offer for\",\n target: productId,\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 createOneTimeOffer(client, packageName, productId, 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 offers\n .command(\"update <product-id> <offer-id>\")\n .description(\"Update an offer from JSON file\")\n .requiredOption(\"--file <path>\", \"JSON file with offer data\")\n .action(async (productId: string, offerId: string, options: { file: string }) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n const format = getOutputFormat(program, config);\n\n if (isDryRun(program)) {\n printDryRun(\n {\n command: \"one-time-products offers update\",\n action: \"update offer\",\n target: `${productId}/${offerId}`,\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 updateOneTimeOffer(client, packageName, productId, offerId, 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 offers\n .command(\"delete <product-id> <offer-id>\")\n .description(\"Delete an offer\")\n .action(async (productId: string, offerId: string) => {\n const config = await loadConfig();\n const packageName = resolvePackageName(program.opts()[\"app\"], config);\n\n await requireConfirm(`Delete offer \"${offerId}\" for product \"${productId}\"?`, program);\n\n if (isDryRun(program)) {\n const format = getOutputFormat(program, config);\n printDryRun(\n {\n command: \"one-time-products offers delete\",\n action: \"delete offer\",\n target: `${productId}/${offerId}`,\n },\n format,\n formatOutput,\n );\n return;\n }\n\n const client = await getClient(config);\n\n try {\n await deleteOneTimeOffer(client, packageName, productId, offerId);\n console.log(`Offer ${offerId} deleted.`);\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,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAKP,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,gCAAgC,SAAwB;AACtE,QAAM,MAAM,QACT,QAAQ,mBAAmB,EAC3B,MAAM,KAAK,EACX,YAAY,sDAAsD;AAErE,MACG,QAAQ,MAAM,EACd,YAAY,wB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AAU,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK,CAAC,EAAE;AAChF,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF,CAAC;AAEH,SACG,QAAQ,gCAAgC,EACxC,YAAY,iBAAiB,EAC7B,OAAO,OAAO,WAAmB,YAAoB;AACpD,UAAM,SAAS,MAAM,WAAW;AAChC,UAAM,cAAc,mBAAmB,QAAQ,KAAK,EAAE,KAAK,GAAG,MAAM;AAEpE,UAAM,eAAe,iBAAiB,OAAO,kBAAkB,SAAS,MAAM,OAAO;AAErF,QAAI,SAAS,OAAO,GAAG;AACrB,YAAM,SAAS,gBAAgB,SAAS,MAAM;AAC9C;AAAA,QACE;AAAA,UACE,SAAS;AAAA,UACT,QAAQ;AAAA,UACR,QAAQ,GAAG,SAAS,IAAI,OAAO;AAAA,QACjC;AAAA,QACA;AAAA,QACA;AAAA,MACF;AACA;AAAA,IACF;AAEA,UAAM,SAAS,MAAM,UAAU,MAAM;AAErC,QAAI;AACF,YAAM,mBAAmB,QAAQ,aAAa,WAAW,OAAO;AAChE,cAAQ,IAAI,SAAS,OAAO,WAAW;AAAA,IACzC,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":[]}
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
getOutputFormat
|
|
4
|
+
} from "./chunk-ELXAK7GI.js";
|
|
2
5
|
|
|
3
6
|
// src/commands/pricing.ts
|
|
4
7
|
import { loadConfig } from "@gpc-cli/config";
|
|
5
8
|
import { resolveAuth } from "@gpc-cli/auth";
|
|
6
9
|
import { createApiClient } from "@gpc-cli/api";
|
|
7
|
-
import { convertRegionPrices,
|
|
10
|
+
import { convertRegionPrices, formatOutput } from "@gpc-cli/core";
|
|
8
11
|
function resolvePackageName(packageArg, config) {
|
|
9
12
|
const name = packageArg || config.app;
|
|
10
13
|
if (!name) {
|
|
@@ -42,7 +45,7 @@ function registerPricingCommands(program) {
|
|
|
42
45
|
interactive
|
|
43
46
|
);
|
|
44
47
|
const client = await getClient(config);
|
|
45
|
-
const format =
|
|
48
|
+
const format = getOutputFormat(program, config);
|
|
46
49
|
try {
|
|
47
50
|
const result = await convertRegionPrices(client, packageName, options.from, options.amount);
|
|
48
51
|
console.log(formatOutput(result, format));
|
|
@@ -55,4 +58,4 @@ function registerPricingCommands(program) {
|
|
|
55
58
|
export {
|
|
56
59
|
registerPricingCommands
|
|
57
60
|
};
|
|
58
|
-
//# sourceMappingURL=pricing-
|
|
61
|
+
//# sourceMappingURL=pricing-OB3MSWID.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, formatOutput } from \"@gpc-cli/core\";\nimport { getOutputFormat } from \"../format.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 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 = getOutputFormat(program, config);\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;AAGlD,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,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