codeplay-common 1.9.4 → 1.9.5

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.
Files changed (2) hide show
  1. package/files/finalrelease +21 -10
  2. package/package.json +1 -1
@@ -629,25 +629,36 @@ rl.question('Enter new versionCode (press enter to keep current): ', (newVersion
629
629
  // Build Android AAB file
630
630
  //child_process.execSync('cd android && ./gradlew bundleRelease', { stdio: 'inherit' });
631
631
 
632
+
633
+ // Build Android AAB or APK file based on store
634
+ console.log(`🏗️ Building release for ${storeName}...`);
632
635
 
633
- // Build Android AAB file with Capacitor
634
- execSync('npx cap sync android', { stdio: 'inherit' });
635
- execSync('npx cap build android --androidreleasetype=AAB', { stdio: 'inherit' });
636
+ let buildType = "AAB";
637
+ if (["VivoStore", "OppoStore", "MiStore"].includes(storeName)) {
638
+ buildType = "APK";
639
+ }
636
640
 
641
+ execSync('npx cap sync android', { stdio: 'inherit' });
642
+ execSync(`npx cap build android --androidreleasetype=${buildType}`, { stdio: 'inherit' });
637
643
 
644
+ // Determine output paths
645
+ let oldFilePath;
646
+ let newExt = buildType === "APK" ? "apk" : "aab";
638
647
 
639
- variablesGradleContent = variablesGradleContent.replace(/minSdkVersion\s*=\s*\d+/, 'minSdkVersion = 24');
640
- console.log('minSdkVersion revert to 24 (default)');
641
- writeFileSync(variablesGradleFilePath, variablesGradleContent);
648
+ if (buildType === "APK") {
649
+ oldFilePath = join("android", "app", "build", "outputs", "apk", "release", "app-release-signed.apk");
650
+ } else {
651
+ oldFilePath = join("android", "app", "build", "outputs", "bundle", "release", "app-release-signed.aab");
652
+ }
642
653
 
654
+ const checkFullPath = join("AAB", newFileName.replace(/\.aab$/, `.${newExt}`));
643
655
 
644
- // Rename the output AAB file
645
- const oldFilePath = join(aabDirectory, "app-release-signed.aab");
656
+ // Rename the output file
646
657
  if (existsSync(oldFilePath)) {
647
658
  renameSync(oldFilePath, checkFullPath);
648
- console.log(`✅ Renamed output AAB file to: ${newFileName}`);
659
+ console.log(`✅ Renamed output ${newExt.toUpperCase()} file to: ${path.basename(checkFullPath)}`);
649
660
  } else {
650
- console.error("❌ AAB file not found after build.");
661
+ console.error(`❌ ${newExt.toUpperCase()} file not found after build.`);
651
662
  }
652
663
 
653
664
  } catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeplay-common",
3
- "version": "1.9.4",
3
+ "version": "1.9.5",
4
4
  "description": "Common build scripts and files",
5
5
  "scripts": {
6
6
  "postinstall": "node scripts/sync-files.js",