@pmate/cli 0.41.0 → 0.41.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -364,3 +364,5 @@ Android services use `pmate service deploy pmate:merry-android`. The primary ser
364
364
  Use --variant, --bump, --force, --release-notes or --minimum-version-code to override release options. --dry-run prints the plan without incrementing versions, resolving signing secrets, building or uploading. Android currently does not support --local/--unsigned. service apk release was removed; service apk list remains a query.
365
365
 
366
366
  HarmonyOS NEXT projects exist in parrot-native (apps/pmate-app-harmony and apps/time-duck-harmony). They currently use signed build scripts and a GitHub Actions workflow, not a registered PMate service type or automatic AppGallery submission.
367
+
368
+ Android production releases check the existing current and compatibility update manifests before changing source versions or loading signing secrets. A candidate versionCode must exceed every published versionCode; stale checkouts are rejected and must be updated explicitly. APK package identity must match the registered service before upload.
package/dist/index.js CHANGED
@@ -18520,8 +18520,19 @@ var AndroidApkReleaseService = class {
18520
18520
  const identity = androidArtifactIdentity(service);
18521
18521
  const repoRoot = this.resolveRepoRoot(service, options.cwd);
18522
18522
  const appDir = this.resolveAppDir(service, repoRoot);
18523
+ let publishedFloor = 0;
18524
+ if (options.env === "prod" && options.variant.toLowerCase() === "release") {
18525
+ const expectedPackage2 = "type" in service && service.mobile && "packageName" in service.mobile ? service.mobile.packageName : void 0;
18526
+ for (const key of androidUpdateManifestKeys(service)) {
18527
+ const latest = await AliyunService.readJsonObject(ANDROID_APK_BUCKET, key);
18528
+ if (latest === null) continue;
18529
+ if (!expectedPackage2 || latest.applicationId !== expectedPackage2 || !Number.isSafeInteger(latest.versionCode) || latest.versionCode <= 0) throw new Error("Published Android manifest identity/version is invalid; release stopped");
18530
+ publishedFloor = Math.max(publishedFloor, latest.versionCode);
18531
+ }
18532
+ }
18533
+ const bump = planAndroidProjectVersion(appDir, options.bump, publishedFloor);
18523
18534
  const signing = options.variant.toLowerCase() === "release" ? await this.loadSigning(service.id, options.env) : void 0;
18524
- const bump = bumpAndroidProjectVersion(appDir, options.bump);
18535
+ (0, import_node_fs22.writeFileSync)(bump.filePath, bump.source);
18525
18536
  ui.info("Bumped Android version", {
18526
18537
  file: bump.filePath,
18527
18538
  from: `${bump.previousVersionName} (${bump.previousVersionCode})`,
@@ -18530,6 +18541,8 @@ var AndroidApkReleaseService = class {
18530
18541
  const builtApkPath = await this.runGradleAssembleAndFindApk(repoRoot, appDir, options.variant);
18531
18542
  const apkPath = signing ? await signAndroidApk(builtApkPath, signing) : builtApkPath;
18532
18543
  const metadata = await this.readApkMetadata(apkPath);
18544
+ const expectedPackage = "type" in service && service.mobile && "packageName" in service.mobile ? service.mobile.packageName : void 0;
18545
+ if (expectedPackage && metadata.applicationId !== expectedPackage) throw new Error("APK applicationId does not match registered Android service; upload stopped");
18533
18546
  if (metadata.versionName !== bump.versionName || metadata.versionCode !== bump.versionCode) {
18534
18547
  throw new Error(
18535
18548
  `APK metadata ${metadata.versionName} (${metadata.versionCode}) does not match bumped version ${bump.versionName} (${bump.versionCode}).`
@@ -18845,7 +18858,7 @@ function parseGradleOutputMetadata(source, apkFileName) {
18845
18858
  }
18846
18859
  return { applicationId, versionName, versionCode };
18847
18860
  }
18848
- function bumpAndroidProjectVersion(appDir, bump) {
18861
+ function planAndroidProjectVersion(appDir, bump, publishedFloor = 0) {
18849
18862
  const candidates = [
18850
18863
  import_node_path27.default.join(appDir, "app", "build.gradle.kts"),
18851
18864
  import_node_path27.default.join(appDir, "app", "build.gradle"),
@@ -18855,7 +18868,7 @@ function bumpAndroidProjectVersion(appDir, bump) {
18855
18868
  for (const candidate of candidates) {
18856
18869
  if (!(0, import_node_fs22.existsSync)(candidate)) continue;
18857
18870
  const result = bumpAndroidGradleVersionText((0, import_node_fs22.readFileSync)(candidate, "utf8"), bump);
18858
- (0, import_node_fs22.writeFileSync)(candidate, result.source);
18871
+ if (!Number.isSafeInteger(result.versionCode) || result.versionCode <= publishedFloor) throw new Error(`Android source is behind published versionCode ${publishedFloor}; update the checkout before releasing`);
18859
18872
  return { filePath: candidate, ...result };
18860
18873
  }
18861
18874
  throw new Error(`No Android Gradle version file found under ${appDir}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pmate/cli",
3
- "version": "0.41.0",
3
+ "version": "0.41.1",
4
4
  "description": "CLI utilities for the pMate project",
5
5
  "license": "MIT",
6
6
  "bin": {