@gpc-cli/core 0.9.46 → 0.9.48
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/dist/index.d.ts +5 -6
- package/dist/index.js +37 -31
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OutputFormat, ResolvedConfig, WebhookConfig } from '@gpc-cli/config';
|
|
2
2
|
import { AuthClient } from '@gpc-cli/auth';
|
|
3
3
|
import { GpcPlugin, PluginManifest, CommandEvent, CommandResult, PluginError, RequestEvent, ResponseEvent, PluginCommand } from '@gpc-cli/plugin-sdk';
|
|
4
|
-
import { PlayApiClient, EditCommitOptions, Track, ExternallyHostedApk, ExternallyHostedApkResponse, DeobfuscationFileType, UploadProgressEvent, ResumableUploadOptions, Listing, ImageType, CountryAvailability, Image, AppDetails, Review, ReviewReplyResponse, Subscription, SubscriptionOffer, OffersListResponse, BasePlanMigratePricesRequest, InAppProduct, Order, SubscriptionDeferResponse, SubscriptionsV2DeferResponse, ProductPurchase, ProductPurchaseV2, SubscriptionPurchaseV2, VoidedPurchase, UsersApiClient, User,
|
|
4
|
+
import { PlayApiClient, EditCommitOptions, Track, ExternallyHostedApk, ExternallyHostedApkResponse, DeobfuscationFileType, UploadProgressEvent, ResumableUploadOptions, Listing, ImageType, CountryAvailability, Image, AppDetails, Review, ReviewReplyResponse, Subscription, SubscriptionOffer, OffersListResponse, BasePlanMigratePricesRequest, InAppProduct, Order, SubscriptionDeferResponse, SubscriptionsV2DeferResponse, ProductPurchase, ProductPurchaseV2, SubscriptionPurchaseV2, VoidedPurchase, UsersApiClient, User, DeveloperLevelPermission, Grant, MetricRow, ReportingDimension, ReportingAggregation, VitalsMetricSet, ReportingApiClient, AnomalyDetectionResponse, MetricSetResponse, ErrorIssuesResponse, ConvertRegionPricesResponse, ReportType, StatsDimension, ReportBucket, Testers, AppRecoveryTargeting, AppRecoveryAction, CreateAppRecoveryActionRequest, DataSafety, ExternalTransaction, ExternalTransactionRefund, DeviceTierConfig, OneTimeOffer, OneTimeProduct, OneTimeOffersListResponse, OneTimeProductsListResponse, GamesApiClient, Achievement, GameEvent, Leaderboard, EnterpriseApiClient, CustomApp, GeneratedApk } from '@gpc-cli/api';
|
|
5
5
|
|
|
6
6
|
declare class GpcError extends Error {
|
|
7
7
|
readonly code: string;
|
|
@@ -570,8 +570,8 @@ declare function listUsers(client: UsersApiClient, developerId: string, options?
|
|
|
570
570
|
nextPageToken?: string;
|
|
571
571
|
}>;
|
|
572
572
|
declare function getUser(client: UsersApiClient, developerId: string, email: string): Promise<User>;
|
|
573
|
-
declare function inviteUser(client: UsersApiClient, developerId: string, email: string, permissions?:
|
|
574
|
-
declare function updateUser(client: UsersApiClient, developerId: string, userId: string, permissions?:
|
|
573
|
+
declare function inviteUser(client: UsersApiClient, developerId: string, email: string, permissions?: DeveloperLevelPermission[], grants?: Grant[]): Promise<User>;
|
|
574
|
+
declare function updateUser(client: UsersApiClient, developerId: string, userId: string, permissions?: DeveloperLevelPermission[], grants?: Grant[]): Promise<User>;
|
|
575
575
|
declare function removeUser(client: UsersApiClient, developerId: string, userId: string): Promise<void>;
|
|
576
576
|
declare function parseGrantArg(grantStr: string): Grant;
|
|
577
577
|
|
|
@@ -602,6 +602,7 @@ declare function getVitalsBattery(reporting: ReportingApiClient, packageName: st
|
|
|
602
602
|
declare function getVitalsMemory(reporting: ReportingApiClient, packageName: string, options?: VitalsQueryOptions): Promise<MetricSetResponse>;
|
|
603
603
|
/** LMK-specific query: enforces DAILY aggregation as required by the API. */
|
|
604
604
|
declare function getVitalsLmk(reporting: ReportingApiClient, packageName: string, options?: VitalsQueryOptions): Promise<MetricSetResponse>;
|
|
605
|
+
declare function getVitalsErrorCount(reporting: ReportingApiClient, packageName: string, options?: VitalsQueryOptions): Promise<MetricSetResponse>;
|
|
605
606
|
declare function getVitalsAnomalies(reporting: ReportingApiClient, packageName: string): Promise<AnomalyDetectionResponse>;
|
|
606
607
|
declare function searchVitalsErrors(reporting: ReportingApiClient, packageName: string, options?: {
|
|
607
608
|
filter?: string;
|
|
@@ -704,9 +705,7 @@ declare function deployRecoveryAction(client: PlayApiClient, packageName: string
|
|
|
704
705
|
declare function createRecoveryAction(client: PlayApiClient, packageName: string, request: CreateAppRecoveryActionRequest): Promise<AppRecoveryAction>;
|
|
705
706
|
declare function addRecoveryTargeting(client: PlayApiClient, packageName: string, actionId: string, targeting: AppRecoveryTargeting): Promise<AppRecoveryAction>;
|
|
706
707
|
|
|
707
|
-
declare function getDataSafety(client: PlayApiClient, packageName: string): Promise<DataSafety>;
|
|
708
708
|
declare function updateDataSafety(client: PlayApiClient, packageName: string, data: DataSafety): Promise<DataSafety>;
|
|
709
|
-
declare function exportDataSafety(client: PlayApiClient, packageName: string, outputPath: string): Promise<DataSafety>;
|
|
710
709
|
declare function importDataSafety(client: PlayApiClient, packageName: string, filePath: string): Promise<DataSafety>;
|
|
711
710
|
|
|
712
711
|
declare function createExternalTransaction(client: PlayApiClient, packageName: string, data: ExternalTransaction): Promise<ExternalTransaction>;
|
|
@@ -1301,4 +1300,4 @@ declare function decodeNotification(base64Payload: string): DecodedNotification;
|
|
|
1301
1300
|
*/
|
|
1302
1301
|
declare function formatNotification(notification: DecodedNotification): Record<string, unknown>;
|
|
1303
1302
|
|
|
1304
|
-
export { ApiError, type AppInfo, type AppStatus, type AuditEntry, type BatchSyncResult, type BundleAnalysis, type BundleComparison, type BundleEntry, type BundleSizeCheckResult, type BundleSizeConfig, type ChangelogEntry, type CommandContext, ConfigError, type CreateEnterpriseAppParams, DEFAULT_LIMITS, DEFAULT_PREFLIGHT_CONFIG, type DecodedNotification, type DiffToken, type DiscoverPluginsOptions, type DryRunPublishResult, type DryRunResult, type DryRunUploadResult, type ExportImagesOptions, type ExportImagesSummary, type FastlaneDetection, type FastlaneLane, type FetchChangelogOptions, type FieldLintResult, type FileValidationResult, type FindingSeverity, GOOGLE_PLAY_LANGUAGES, type GetAppStatusOptions, type GitNotesOptions, type GitReleaseNotes, GpcError, type ImageValidationResult, type InitOptions, type InitResult, type InternalSharingUploadResult, type ListIapOptions, type ListSubscriptionsOptions, type ListUsersOptions, type ListVoidedOptions, type ListingDiff, type ListingFieldLimits, type ListingLintResult, type ListingsResult, type LoadedPlugin, type MigrationResult, NetworkError, type OneTimeProductDiff, PERMISSION_PROPAGATION_WARNING, type ParsedManifest, type ParsedMonth, PluginManager, type PreflightConfig, type PreflightFinding, type PreflightOptions, type PreflightResult, type PreflightScanner, type PublishOptions, type PublishResult, type PushResult, type QuotaUsage, type ReleaseDiff, type ReleaseNotesValidation, type ReleaseStatusResult, type ReviewAnalysis, type ReviewExportOptions, type ReviewsFilterOptions, type RtdnStatus, SENSITIVE_ARG_KEYS, SENSITIVE_KEYS, SEVERITY_ORDER, type ScaffoldOptions, type ScaffoldResult, type Spinner, type StatusDiff, type StatusRelease, type StatusReviews, type StatusVitalMetric, type SubscriptionAnalytics, type SubscriptionDiff, type SyncResult, type ThresholdResult, type TrainConfig, type TrainState, type UploadResult, type ValidateCheck, type ValidateOptions, type ValidateResult, type VersionVitalsComparison, type VersionVitalsRow, type VitalsOverview, type VitalsQueryOptions, type VitalsTrendComparison, type WatchOptions, type WatchVitalsOptions, type WebhookPayload, abortTrain, acknowledgeProductPurchase, activateBasePlan, activateOffer, addRecoveryTargeting, addTesters, advanceTrain, analyzeBundle, analyzeRemoteListings, analyzeReviews, batchGetOrders, batchSyncInAppProducts, cancelRecoveryAction, cancelSubscriptionPurchase, cancelSubscriptionV2, checkBundleSize, checkThreshold, clearAuditLog, compareBundles, compareVersionVitals, compareVitalsTrend, computeStatusDiff, consumeProductPurchase, convertRegionPrices, createAuditEntry, createDeviceTier, createEnterpriseApp, createExternalTransaction, createGrant, createInAppProduct, createOffer, createOneTimeOffer, createOneTimeProduct, createRecoveryAction, createSpinner, createSubscription, createTrack, deactivateBasePlan, deactivateOffer, decodeNotification, deferSubscriptionPurchase, deferSubscriptionV2, deleteBasePlan, deleteGrant, deleteImage, deleteInAppProduct, deleteListing, deleteOffer, deleteOneTimeOffer, deleteOneTimeProduct, deleteSubscription, deployRecoveryAction, detectFastlane, detectOutputFormat, diffListings, diffListingsCommand, diffListingsEnhanced, diffOneTimeProduct, diffReleases, diffSubscription, discoverPlugins, downloadGeneratedApk, downloadReport,
|
|
1303
|
+
export { ApiError, type AppInfo, type AppStatus, type AuditEntry, type BatchSyncResult, type BundleAnalysis, type BundleComparison, type BundleEntry, type BundleSizeCheckResult, type BundleSizeConfig, type ChangelogEntry, type CommandContext, ConfigError, type CreateEnterpriseAppParams, DEFAULT_LIMITS, DEFAULT_PREFLIGHT_CONFIG, type DecodedNotification, type DiffToken, type DiscoverPluginsOptions, type DryRunPublishResult, type DryRunResult, type DryRunUploadResult, type ExportImagesOptions, type ExportImagesSummary, type FastlaneDetection, type FastlaneLane, type FetchChangelogOptions, type FieldLintResult, type FileValidationResult, type FindingSeverity, GOOGLE_PLAY_LANGUAGES, type GetAppStatusOptions, type GitNotesOptions, type GitReleaseNotes, GpcError, type ImageValidationResult, type InitOptions, type InitResult, type InternalSharingUploadResult, type ListIapOptions, type ListSubscriptionsOptions, type ListUsersOptions, type ListVoidedOptions, type ListingDiff, type ListingFieldLimits, type ListingLintResult, type ListingsResult, type LoadedPlugin, type MigrationResult, NetworkError, type OneTimeProductDiff, PERMISSION_PROPAGATION_WARNING, type ParsedManifest, type ParsedMonth, PluginManager, type PreflightConfig, type PreflightFinding, type PreflightOptions, type PreflightResult, type PreflightScanner, type PublishOptions, type PublishResult, type PushResult, type QuotaUsage, type ReleaseDiff, type ReleaseNotesValidation, type ReleaseStatusResult, type ReviewAnalysis, type ReviewExportOptions, type ReviewsFilterOptions, type RtdnStatus, SENSITIVE_ARG_KEYS, SENSITIVE_KEYS, SEVERITY_ORDER, type ScaffoldOptions, type ScaffoldResult, type Spinner, type StatusDiff, type StatusRelease, type StatusReviews, type StatusVitalMetric, type SubscriptionAnalytics, type SubscriptionDiff, type SyncResult, type ThresholdResult, type TrainConfig, type TrainState, type UploadResult, type ValidateCheck, type ValidateOptions, type ValidateResult, type VersionVitalsComparison, type VersionVitalsRow, type VitalsOverview, type VitalsQueryOptions, type VitalsTrendComparison, type WatchOptions, type WatchVitalsOptions, type WebhookPayload, abortTrain, acknowledgeProductPurchase, activateBasePlan, activateOffer, addRecoveryTargeting, addTesters, advanceTrain, analyzeBundle, analyzeRemoteListings, analyzeReviews, batchGetOrders, batchSyncInAppProducts, cancelRecoveryAction, cancelSubscriptionPurchase, cancelSubscriptionV2, checkBundleSize, checkThreshold, clearAuditLog, compareBundles, compareVersionVitals, compareVitalsTrend, computeStatusDiff, consumeProductPurchase, convertRegionPrices, createAuditEntry, createDeviceTier, createEnterpriseApp, createExternalTransaction, createGrant, createInAppProduct, createOffer, createOneTimeOffer, createOneTimeProduct, createRecoveryAction, createSpinner, createSubscription, createTrack, deactivateBasePlan, deactivateOffer, decodeNotification, deferSubscriptionPurchase, deferSubscriptionV2, deleteBasePlan, deleteGrant, deleteImage, deleteInAppProduct, deleteListing, deleteOffer, deleteOneTimeOffer, deleteOneTimeProduct, deleteSubscription, deployRecoveryAction, detectFastlane, detectOutputFormat, diffListings, diffListingsCommand, diffListingsEnhanced, diffOneTimeProduct, diffReleases, diffSubscription, discoverPlugins, downloadGeneratedApk, downloadReport, exportImages, exportReviews, fetchChangelog, fetchReleaseNotes, formatChangelogEntry, formatCustomPayload, formatDiscordPayload, formatJunit, formatNotification, formatOutput, formatSlackPayload, formatStatusDiff, formatStatusSummary, formatStatusTable, formatWordDiff, generateMigrationPlan, generateNotesFromGit, getAllScannerNames, getAppInfo, getAppStatus, getCountryAvailability, getDeviceTier, getExternalTransaction, getInAppProduct, getListings, getOffer, getOneTimeOffer, getOneTimeProduct, getOrderDetails, getProductPurchase, getProductPurchaseV2, getQuotaUsage, getReleasesStatus, getReview, getRtdnStatus, getSubscription, getSubscriptionAnalytics, getSubscriptionPurchase, getTrainStatus, getUser, getVitalsAnomalies, getVitalsAnr, getVitalsBattery, getVitalsCrashes, getVitalsErrorCount, getVitalsLmk, getVitalsMemory, getVitalsOverview, getVitalsRendering, getVitalsStartup, importDataSafety, importTestersFromCsv, initAudit, initProject, inviteUser, isFinancialReportType, isStatsReportType, isValidBcp47, isValidReportType, isValidStatsDimension, lintListing, lintListings, lintLocalListings, listAchievements, listAuditEvents, listDeviceTiers, listEvents, listGeneratedApks, listGrants, listImages, listInAppProducts, listLeaderboards, listOffers, listOneTimeOffers, listOneTimeProducts, listRecoveryActions, listReports, listReviews, listSubscriptions, listTesters, listTracks, listUsers, listVoidedPurchases, loadPreflightConfig, loadStatusCache, maybePaginate, migratePrices, parseAppfile, parseFastfile, parseGrantArg, parseMonth, pauseTrain, promoteRelease, publish, publishEnterpriseApp, pullListings, pushListings, readListingsFromDir, readReleaseNotesFromDir, redactAuditArgs, redactSensitive, refundExternalTransaction, refundOrder, relativeTime, removeTesters, removeUser, replyToReview, revokeSubscriptionPurchase, runPreflight, runWatchLoop, safePath, safePathWithin, saveStatusCache, scaffoldPlugin, searchAuditEvents, searchVitalsErrors, sendNotification, sendWebhook, sortResults, startTrain, statusHasBreach, syncInAppProducts, topFiles, trackBreachState, updateAppDetails, updateDataSafety, updateGrant, updateInAppProduct, updateListing, updateOffer, updateOneTimeOffer, updateOneTimeProduct, updateRollout, updateSubscription, updateTrackConfig, updateUser, uploadExternallyHosted, uploadImage, uploadInternalSharing, uploadRelease, validateImage, validateLanguageCode, validatePackageName, validatePreSubmission, validateReleaseNotes, validateSku, validateTrackName, validateUploadFile, validateVersionCode, watchVitalsWithAutoHalt, wordDiff, writeAuditLog, writeListingsToDir, writeMigrationOutput };
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,9 @@ var GpcError = class extends Error {
|
|
|
7
7
|
this.suggestion = suggestion;
|
|
8
8
|
this.name = "GpcError";
|
|
9
9
|
}
|
|
10
|
+
code;
|
|
11
|
+
exitCode;
|
|
12
|
+
suggestion;
|
|
10
13
|
toJSON() {
|
|
11
14
|
return {
|
|
12
15
|
success: false,
|
|
@@ -30,6 +33,7 @@ var ApiError = class extends GpcError {
|
|
|
30
33
|
this.statusCode = statusCode;
|
|
31
34
|
this.name = "ApiError";
|
|
32
35
|
}
|
|
36
|
+
statusCode;
|
|
33
37
|
};
|
|
34
38
|
var NetworkError = class extends GpcError {
|
|
35
39
|
constructor(message, suggestion) {
|
|
@@ -1666,7 +1670,7 @@ var ALL_IMAGE_TYPES = [
|
|
|
1666
1670
|
"tvBanner"
|
|
1667
1671
|
];
|
|
1668
1672
|
async function exportImages(client, packageName, dir, options) {
|
|
1669
|
-
const { mkdir: mkdir8, writeFile:
|
|
1673
|
+
const { mkdir: mkdir8, writeFile: writeFile9 } = await import("fs/promises");
|
|
1670
1674
|
const { join: join12 } = await import("path");
|
|
1671
1675
|
const edit = await client.edits.insert(packageName);
|
|
1672
1676
|
try {
|
|
@@ -1711,7 +1715,7 @@ async function exportImages(client, packageName, dir, options) {
|
|
|
1711
1715
|
}
|
|
1712
1716
|
const buffer = Buffer.from(await response.arrayBuffer());
|
|
1713
1717
|
const filePath = join12(dirPath, `${task.index}.png`);
|
|
1714
|
-
await
|
|
1718
|
+
await writeFile9(filePath, buffer);
|
|
1715
1719
|
return buffer.length;
|
|
1716
1720
|
})
|
|
1717
1721
|
);
|
|
@@ -2914,6 +2918,13 @@ var METRIC_SET_METRICS = {
|
|
|
2914
2918
|
"stuckBgWakelockRate28dUserWeighted",
|
|
2915
2919
|
"distinctUsers"
|
|
2916
2920
|
],
|
|
2921
|
+
lowMemoryKillerRateMetricSet: [
|
|
2922
|
+
"lmkRate",
|
|
2923
|
+
"lmkRate7dUserWeighted",
|
|
2924
|
+
"lmkRate28dUserWeighted",
|
|
2925
|
+
"userPerceivedLmkRate",
|
|
2926
|
+
"distinctUsers"
|
|
2927
|
+
],
|
|
2917
2928
|
errorCountMetricSet: ["errorReportCount", "distinctUsers"]
|
|
2918
2929
|
};
|
|
2919
2930
|
function buildQuery(metricSet, options) {
|
|
@@ -2992,11 +3003,15 @@ async function getVitalsMemory(reporting, packageName, options) {
|
|
|
2992
3003
|
return queryMetric(reporting, packageName, "stuckBackgroundWakelockRateMetricSet", options);
|
|
2993
3004
|
}
|
|
2994
3005
|
async function getVitalsLmk(reporting, packageName, options) {
|
|
2995
|
-
return queryMetric(reporting, packageName, "
|
|
3006
|
+
return queryMetric(reporting, packageName, "lowMemoryKillerRateMetricSet", {
|
|
2996
3007
|
...options,
|
|
2997
3008
|
aggregation: "DAILY"
|
|
2998
3009
|
});
|
|
2999
3010
|
}
|
|
3011
|
+
async function getVitalsErrorCount(reporting, packageName, options) {
|
|
3012
|
+
const opts = options?.dimension ? options : { ...options, dimension: "reportType" };
|
|
3013
|
+
return queryMetric(reporting, packageName, "errorCountMetricSet", opts);
|
|
3014
|
+
}
|
|
3000
3015
|
async function getVitalsAnomalies(reporting, packageName) {
|
|
3001
3016
|
return reporting.getAnomalies(packageName);
|
|
3002
3017
|
}
|
|
@@ -3795,18 +3810,10 @@ async function addRecoveryTargeting(client, packageName, actionId, targeting) {
|
|
|
3795
3810
|
}
|
|
3796
3811
|
|
|
3797
3812
|
// src/commands/data-safety.ts
|
|
3798
|
-
import { readFile as readFile6
|
|
3799
|
-
async function getDataSafety(client, packageName) {
|
|
3800
|
-
return client.dataSafety.get(packageName);
|
|
3801
|
-
}
|
|
3813
|
+
import { readFile as readFile6 } from "fs/promises";
|
|
3802
3814
|
async function updateDataSafety(client, packageName, data) {
|
|
3803
3815
|
return client.dataSafety.update(packageName, data);
|
|
3804
3816
|
}
|
|
3805
|
-
async function exportDataSafety(client, packageName, outputPath) {
|
|
3806
|
-
const dataSafety = await getDataSafety(client, packageName);
|
|
3807
|
-
await writeFile3(outputPath, JSON.stringify(dataSafety, null, 2) + "\n", "utf-8");
|
|
3808
|
-
return dataSafety;
|
|
3809
|
-
}
|
|
3810
3817
|
async function importDataSafety(client, packageName, filePath) {
|
|
3811
3818
|
const content = await readFile6(filePath, "utf-8");
|
|
3812
3819
|
let data;
|
|
@@ -4112,7 +4119,7 @@ function createSpinner(message) {
|
|
|
4112
4119
|
}
|
|
4113
4120
|
|
|
4114
4121
|
// src/utils/train-state.ts
|
|
4115
|
-
import { mkdir as mkdir3, readFile as readFile7, writeFile as
|
|
4122
|
+
import { mkdir as mkdir3, readFile as readFile7, writeFile as writeFile3 } from "fs/promises";
|
|
4116
4123
|
import { dirname, join as join5 } from "path";
|
|
4117
4124
|
import { getCacheDir } from "@gpc-cli/config";
|
|
4118
4125
|
function stateFile(packageName) {
|
|
@@ -4131,7 +4138,7 @@ async function writeTrainState(packageName, state) {
|
|
|
4131
4138
|
const path = stateFile(packageName);
|
|
4132
4139
|
const dir = dirname(path);
|
|
4133
4140
|
await mkdir3(dir, { recursive: true });
|
|
4134
|
-
await
|
|
4141
|
+
await writeFile3(path, JSON.stringify(state, null, 2), "utf-8");
|
|
4135
4142
|
}
|
|
4136
4143
|
async function clearTrainState(packageName) {
|
|
4137
4144
|
const { unlink } = await import("fs/promises");
|
|
@@ -4301,7 +4308,7 @@ async function publishEnterpriseApp(client, params) {
|
|
|
4301
4308
|
}
|
|
4302
4309
|
|
|
4303
4310
|
// src/audit.ts
|
|
4304
|
-
import { appendFile, chmod, mkdir as mkdir4, readFile as readFile8, writeFile as
|
|
4311
|
+
import { appendFile, chmod, mkdir as mkdir4, readFile as readFile8, writeFile as writeFile4 } from "fs/promises";
|
|
4305
4312
|
import { join as join6 } from "path";
|
|
4306
4313
|
var auditDir = null;
|
|
4307
4314
|
function initAudit(configDir) {
|
|
@@ -4415,7 +4422,7 @@ async function clearAuditLog(options) {
|
|
|
4415
4422
|
if (!options?.before) {
|
|
4416
4423
|
const count = lines.length;
|
|
4417
4424
|
if (!options?.dryRun) {
|
|
4418
|
-
await
|
|
4425
|
+
await writeFile4(logPath, "", { encoding: "utf-8", mode: 384 });
|
|
4419
4426
|
}
|
|
4420
4427
|
return { deleted: count, remaining: 0 };
|
|
4421
4428
|
}
|
|
@@ -4435,7 +4442,7 @@ async function clearAuditLog(options) {
|
|
|
4435
4442
|
}
|
|
4436
4443
|
}
|
|
4437
4444
|
if (!options?.dryRun) {
|
|
4438
|
-
await
|
|
4445
|
+
await writeFile4(logPath, keep.length > 0 ? keep.join("\n") + "\n" : "", {
|
|
4439
4446
|
encoding: "utf-8",
|
|
4440
4447
|
mode: 384
|
|
4441
4448
|
});
|
|
@@ -4495,7 +4502,7 @@ function safePathWithin(userPath, baseDir) {
|
|
|
4495
4502
|
}
|
|
4496
4503
|
|
|
4497
4504
|
// src/commands/init.ts
|
|
4498
|
-
import { mkdir as mkdir5, writeFile as
|
|
4505
|
+
import { mkdir as mkdir5, writeFile as writeFile5, stat as stat7 } from "fs/promises";
|
|
4499
4506
|
import { join as join7 } from "path";
|
|
4500
4507
|
async function exists2(path) {
|
|
4501
4508
|
try {
|
|
@@ -4514,7 +4521,7 @@ async function safeWrite(filePath, content, created, skipped, skipExisting) {
|
|
|
4514
4521
|
}
|
|
4515
4522
|
const dir = filePath.substring(0, filePath.lastIndexOf("/"));
|
|
4516
4523
|
await mkdir5(dir, { recursive: true });
|
|
4517
|
-
await
|
|
4524
|
+
await writeFile5(filePath, content, "utf-8");
|
|
4518
4525
|
created.push(filePath);
|
|
4519
4526
|
}
|
|
4520
4527
|
async function initProject(options) {
|
|
@@ -6337,7 +6344,7 @@ function sortResults(items, sortSpec) {
|
|
|
6337
6344
|
}
|
|
6338
6345
|
|
|
6339
6346
|
// src/commands/plugin-scaffold.ts
|
|
6340
|
-
import { mkdir as mkdir6, writeFile as
|
|
6347
|
+
import { mkdir as mkdir6, writeFile as writeFile6 } from "fs/promises";
|
|
6341
6348
|
import { join as join10 } from "path";
|
|
6342
6349
|
async function scaffoldPlugin(options) {
|
|
6343
6350
|
const { name, dir, description = `GPC plugin: ${name}` } = options;
|
|
@@ -6380,7 +6387,7 @@ async function scaffoldPlugin(options) {
|
|
|
6380
6387
|
vitest: "^3.0.0"
|
|
6381
6388
|
}
|
|
6382
6389
|
};
|
|
6383
|
-
await
|
|
6390
|
+
await writeFile6(join10(dir, "package.json"), JSON.stringify(pkg, null, 2) + "\n");
|
|
6384
6391
|
files.push("package.json");
|
|
6385
6392
|
const tsconfig = {
|
|
6386
6393
|
compilerOptions: {
|
|
@@ -6396,7 +6403,7 @@ async function scaffoldPlugin(options) {
|
|
|
6396
6403
|
},
|
|
6397
6404
|
include: ["src"]
|
|
6398
6405
|
};
|
|
6399
|
-
await
|
|
6406
|
+
await writeFile6(join10(dir, "tsconfig.json"), JSON.stringify(tsconfig, null, 2) + "\n");
|
|
6400
6407
|
files.push("tsconfig.json");
|
|
6401
6408
|
const srcContent = `import { definePlugin } from "@gpc-cli/plugin-sdk";
|
|
6402
6409
|
import type { CommandEvent, CommandResult } from "@gpc-cli/plugin-sdk";
|
|
@@ -6429,7 +6436,7 @@ export const plugin = definePlugin({
|
|
|
6429
6436
|
},
|
|
6430
6437
|
});
|
|
6431
6438
|
`;
|
|
6432
|
-
await
|
|
6439
|
+
await writeFile6(join10(srcDir, "index.ts"), srcContent);
|
|
6433
6440
|
files.push("src/index.ts");
|
|
6434
6441
|
const testContent = `import { describe, it, expect, vi } from "vitest";
|
|
6435
6442
|
import { plugin } from "../src/index";
|
|
@@ -6454,7 +6461,7 @@ describe("${pluginName}", () => {
|
|
|
6454
6461
|
});
|
|
6455
6462
|
});
|
|
6456
6463
|
`;
|
|
6457
|
-
await
|
|
6464
|
+
await writeFile6(join10(testDir, "plugin.test.ts"), testContent);
|
|
6458
6465
|
files.push("tests/plugin.test.ts");
|
|
6459
6466
|
return { dir, files };
|
|
6460
6467
|
}
|
|
@@ -6604,7 +6611,7 @@ function detectFileType(filePath) {
|
|
|
6604
6611
|
}
|
|
6605
6612
|
|
|
6606
6613
|
// src/commands/generated-apks.ts
|
|
6607
|
-
import { writeFile as
|
|
6614
|
+
import { writeFile as writeFile7 } from "fs/promises";
|
|
6608
6615
|
async function listGeneratedApks(client, packageName, versionCode) {
|
|
6609
6616
|
if (!Number.isInteger(versionCode) || versionCode <= 0) {
|
|
6610
6617
|
throw new GpcError(
|
|
@@ -6635,7 +6642,7 @@ async function downloadGeneratedApk(client, packageName, versionCode, apkId, out
|
|
|
6635
6642
|
}
|
|
6636
6643
|
const buffer = await client.generatedApks.download(packageName, versionCode, apkId);
|
|
6637
6644
|
const bytes = new Uint8Array(buffer);
|
|
6638
|
-
await
|
|
6645
|
+
await writeFile7(outputPath, bytes);
|
|
6639
6646
|
return { path: outputPath, sizeBytes: bytes.byteLength };
|
|
6640
6647
|
}
|
|
6641
6648
|
|
|
@@ -6835,7 +6842,7 @@ async function checkBundleSize(analysis, configPath = ".bundlesize.json") {
|
|
|
6835
6842
|
}
|
|
6836
6843
|
|
|
6837
6844
|
// src/commands/status.ts
|
|
6838
|
-
import { mkdir as mkdir7, readFile as readFile15, writeFile as
|
|
6845
|
+
import { mkdir as mkdir7, readFile as readFile15, writeFile as writeFile8 } from "fs/promises";
|
|
6839
6846
|
import { execFile as execFile2 } from "child_process";
|
|
6840
6847
|
import { join as join11 } from "path";
|
|
6841
6848
|
import { getCacheDir as getCacheDir2 } from "@gpc-cli/config";
|
|
@@ -6864,7 +6871,7 @@ async function saveStatusCache(packageName, data, ttlSeconds = DEFAULT_TTL_SECON
|
|
|
6864
6871
|
const dir = getCacheDir2();
|
|
6865
6872
|
await mkdir7(dir, { recursive: true });
|
|
6866
6873
|
const entry = { fetchedAt: data.fetchedAt, ttl: ttlSeconds, data };
|
|
6867
|
-
await
|
|
6874
|
+
await writeFile8(cacheFilePath(packageName), JSON.stringify(entry, null, 2), {
|
|
6868
6875
|
encoding: "utf-8",
|
|
6869
6876
|
mode: 384
|
|
6870
6877
|
});
|
|
@@ -7267,7 +7274,7 @@ async function trackBreachState(packageName, isBreaching) {
|
|
|
7267
7274
|
if (prevBreaching !== isBreaching) {
|
|
7268
7275
|
try {
|
|
7269
7276
|
await mkdir7(getCacheDir2(), { recursive: true });
|
|
7270
|
-
await
|
|
7277
|
+
await writeFile8(
|
|
7271
7278
|
filePath,
|
|
7272
7279
|
JSON.stringify({ breaching: isBreaching, since: (/* @__PURE__ */ new Date()).toISOString() }, null, 2),
|
|
7273
7280
|
{ encoding: "utf-8", mode: 384 }
|
|
@@ -7523,7 +7530,6 @@ export {
|
|
|
7523
7530
|
discoverPlugins,
|
|
7524
7531
|
downloadGeneratedApk,
|
|
7525
7532
|
downloadReport,
|
|
7526
|
-
exportDataSafety,
|
|
7527
7533
|
exportImages,
|
|
7528
7534
|
exportReviews,
|
|
7529
7535
|
fetchChangelog,
|
|
@@ -7545,7 +7551,6 @@ export {
|
|
|
7545
7551
|
getAppInfo,
|
|
7546
7552
|
getAppStatus,
|
|
7547
7553
|
getCountryAvailability,
|
|
7548
|
-
getDataSafety,
|
|
7549
7554
|
getDeviceTier,
|
|
7550
7555
|
getExternalTransaction,
|
|
7551
7556
|
getInAppProduct,
|
|
@@ -7569,6 +7574,7 @@ export {
|
|
|
7569
7574
|
getVitalsAnr,
|
|
7570
7575
|
getVitalsBattery,
|
|
7571
7576
|
getVitalsCrashes,
|
|
7577
|
+
getVitalsErrorCount,
|
|
7572
7578
|
getVitalsLmk,
|
|
7573
7579
|
getVitalsMemory,
|
|
7574
7580
|
getVitalsOverview,
|