codeplay-common 4.8.6 → 4.8.8

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/.gitattributes CHANGED
@@ -1,2 +1,2 @@
1
- # Auto detect text files and perform LF normalization
2
- * text=auto
1
+ # Auto detect text files and perform LF normalization
2
+ * text=auto
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Merbin Joe
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Merbin Joe
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,169 +1,169 @@
1
- # codeplay-common
2
- Everything automatted in Capacitor apps, easy to maintain many apps in capacitor. It will reduce your 40% of work, with common file code.
3
-
4
-
5
- Easy add splashscreen and set animation
6
- Admob id automatically from capacitor.config.json file
7
- Make three build file for different store as per our requirement
8
- Based on store install various IAP plugins
9
- Make it to ionic project
10
-
11
- ## Platform builds and shared validation
12
-
13
- Installing or updating `codeplay-common` updates the consuming project's `package.json`
14
- to use the latest bundled pre-build script and adds these commands:
15
-
16
- - `npm run build`: Android by default, including on macOS.
17
- - `npm run build:ios`: sets `CODEPLAY_BUILD_PLATFORM=ios` and runs the same build pipeline.
18
- - `npm run build-capacitor-android`: runs the shared checks and copies the web build to Android.
19
-
20
- The pre-build script migrates direct `saveToGalleryAndSaveAnyFile` imports to
21
- `@saveGallery` and sets the Vite alias to the matching Android or iOS helper.
22
- Before changing source imports or the alias, it lists the build target, affected files,
23
- and exact replacements. Press Enter or type `y` to continue; any other answer cancels.
24
- Correct imports and alias targets continue without prompting. Missing helpers, mixed
25
- versions and query/hash imports stop with an actionable error.
26
-
27
- Source validation reuses a directory inventory and combines the gallery and editor
28
- checks in one content pass. The inventory refreshes when generated or downloaded
29
- files change the source tree.
30
-
31
- Builds also keep `agent-temp/` ignored and remove existing `buildCodeplay/` ignore entries.
32
- If `onesignal-cordova-plugin` is declared or installed, the pre-build script warns and
33
- runs `npm uninstall onesignal-cordova-plugin`. It stops if removal fails or active
34
- package imports remain. Legacy OneSignal patching and helper downloads are disabled.
35
-
36
- ## Screenshot data
37
-
38
- Shared screenshot helpers are installed into `scripts/screenshot/` and updated with
39
- the package. App-specific data is not bundled with the package.
40
- During an upgrade, cleanup removes only the two legacy helpers `frame-samples.js`
41
- and `background-decorations.js` from `scripts-screenshot/screenshot/`, preserving
42
- the folder, JSON data, and other app files.
43
-
44
- `take-screen-image.js` creates `scripts-screenshot/screenshot/` and empty
45
- `screenshot-copy.json` and `screenshot-info.json` files when needed. Existing files
46
- are preserved during initialization, package installation, and cleanup. Capture
47
- updates screenshot information; the AI text-generation workflow fills screenshot
48
- copy. `--delete` removes matching records, and screenshot runs reconcile records
49
- against the captured images (except dry runs and `--refresh-info`).
50
-
51
- ## Agent instructions
52
-
53
- Agent instructions are updated during `npm run build`, not during npm installation.
54
- The build script reads the `agents` version from
55
- `https://htmlcodeplay.com/code-play-plugin/versions.json` and downloads the matching
56
- `agents-<version>.zip` archive when the project has no agent instructions or the
57
- server version is newer.
58
-
59
- The ZIP root must contain `AGENTS.md` and `AGENTS/`. These are copied directly to
60
- the project root. The installed version is stored in `AGENTS/.codeplay-version`.
61
- Existing files with matching names are replaced; project-only files with other
62
- names inside `AGENTS/` are preserved.
63
-
64
- For example, publish `agents-1.1.zip` and add this entry to the server's
65
- `versions.json`:
66
-
67
- ```json
68
- "agents": "1.1"
69
- ```
70
-
71
- Donate to get full code including many common functions
72
- https://ko-fi.com/codeplay
73
-
74
- Version 4.6.1
75
- Added automatic IAP startup integration for Framework7 home pages.
76
- Updated minimum shared versions to IAP 4.2 and AdMob nextgen 2.5.
77
-
78
- 4.2.8
79
- baseline profile code modifications
80
-
81
- Version 4.2.3
82
- Added build warning confirmation when android.ORIENTATION is not "auto" or android.RESIZEABLE_ACTIVITY is not true.
83
-
84
- Version 4.2.2
85
- Added "bannerDisabledPages" property and its default value
86
- The admob configuration default value priority is updated
87
-
88
- Version 4.2.1
89
- Updated AdMob nextgen file validation to match admob-emi-nextgen file names.
90
-
91
- Version 4.2.0
92
- Firebase related automatic changes updated
93
-
94
- Version 4.1.9
95
- Added AdMob nextgen 1.7 validation/default support for "overlappingHeight", "bannerTypeAndroidLandscape", and "bannerTypeiOSLandscape".
96
-
97
- Version 4.1.8
98
- "consentDebug: false" is added
99
-
100
- Version 4.1.7
101
- admob configuration automatically added.
102
-
103
- Version 4.1.6
104
- "setup-baseline-profile.js" modification, duplicate validation error fixed
105
-
106
- Version 4.1.5
107
- While isTesting is true it is not validated from our new configuration admob file, now it is solved
108
-
109
- Version 4.1.4
110
- hardcoded version is removed for the admob-emi-nextgen
111
-
112
-
113
- Version 4.1.3
114
- "consentDebug": false automatically adds if not
115
-
116
- Version 4.1.2
117
- Speedup
118
-
119
- Version 4.1.1
120
- Auto admob integration updated
121
-
122
-
123
- version 4.0.9
124
- packageJson.scripts["ionic:serve"] = "cross-env NODE_ENV=development vite"; this line updated in "sync-files.js"
125
-
126
-
127
- version 4.0.8
128
- safearea plugin is checked and removed automatically
129
- Automatically added following in capacitor.config.json file
130
- "SystemBars": {
131
- "insetsHandling": "css"
132
- }
133
- patchFile() method is removed
134
-
135
-
136
-
137
-
138
- Version 4.0.6
139
- IAP related some automatic variable creation and validation
140
- Fetch from vite.config.json file
141
- 'import.meta.env.VITE_APP_UNIQUE_ID': JSON.stringify(APP_UNIQUE_ID),
142
- 'import.meta.env.VITE_ANDROID_ANALYTICS_ENABLED': JSON.stringify(ANDROID_ANALYTICS_ENABLED),
143
- 'import.meta.env.VITE_IOS_ANALYTICS_ENABLED': JSON.stringify(IOS_ANALYTICS_ENABLED),
144
- 'import.meta.env.VITE_IAP_DESIGN': JSON.stringify(IAP_DESIGN),
145
-
146
-
147
- Version 4.0.5
148
- In "files\buildCodeplay\packageidBaseModification-1.4.js" SCHEDULE_EXACT_ALARM permission added for the app unique id 2 (resume generator app)
149
-
150
-
151
- Version 4.0.4
152
- patchFile(); method is disabled, Due to "@capacitor/android:8.4.2" this update. I think it is realted to safearea issue fixed in this latest version, file in "SystemBars.java"
153
-
154
- Version 4.0.3
155
- Old admob check performs through plugin location, but not it is validated from capacitor.config.json
156
-
157
-
158
- Version: 4.0.2
159
- After check & install/download the latest version, the re-check is cancelled now
160
-
161
- Version: 4.0.1
162
- Base profile script added
163
-
164
-
165
- "version": "",
166
- Version : 4.0.0 (Previous version 3.2.19)
167
- 1) In here we are completly remove the admob-emi and use "capacitor-admob-nextgen"
168
- 2) Removed "modify-plugin-xml.js"
169
- 3)
1
+ # codeplay-common
2
+ Everything automatted in Capacitor apps, easy to maintain many apps in capacitor. It will reduce your 40% of work, with common file code.
3
+
4
+
5
+ Easy add splashscreen and set animation
6
+ Admob id automatically from capacitor.config.json file
7
+ Make three build file for different store as per our requirement
8
+ Based on store install various IAP plugins
9
+ Make it to ionic project
10
+
11
+ ## Platform builds and shared validation
12
+
13
+ Installing or updating `codeplay-common` updates the consuming project's `package.json`
14
+ to use the latest bundled pre-build script and adds these commands:
15
+
16
+ - `npm run build`: Android by default, including on macOS.
17
+ - `npm run build:ios`: sets `CODEPLAY_BUILD_PLATFORM=ios` and runs the same build pipeline.
18
+ - `npm run build-capacitor-android`: runs the shared checks and copies the web build to Android.
19
+
20
+ The pre-build script migrates direct `saveToGalleryAndSaveAnyFile` imports to
21
+ `@saveGallery` and sets the Vite alias to the matching Android or iOS helper.
22
+ Before changing source imports or the alias, it lists the build target, affected files,
23
+ and exact replacements. Press Enter or type `y` to continue; any other answer cancels.
24
+ Correct imports and alias targets continue without prompting. Missing helpers, mixed
25
+ versions and query/hash imports stop with an actionable error.
26
+
27
+ Source validation reuses a directory inventory and combines the gallery and editor
28
+ checks in one content pass. The inventory refreshes when generated or downloaded
29
+ files change the source tree.
30
+
31
+ Builds also keep `agent-temp/` ignored and remove existing `buildCodeplay/` ignore entries.
32
+ If `onesignal-cordova-plugin` is declared or installed, the pre-build script warns and
33
+ runs `npm uninstall onesignal-cordova-plugin`. It stops if removal fails or active
34
+ package imports remain. Legacy OneSignal patching and helper downloads are disabled.
35
+
36
+ ## Screenshot data
37
+
38
+ Shared screenshot helpers are installed into `scripts/screenshot/` and updated with
39
+ the package. App-specific data is not bundled with the package.
40
+ During an upgrade, cleanup removes only the two legacy helpers `frame-samples.js`
41
+ and `background-decorations.js` from `scripts-screenshot/screenshot/`, preserving
42
+ the folder, JSON data, and other app files.
43
+
44
+ `take-screen-image.js` creates `scripts-screenshot/screenshot/` and empty
45
+ `screenshot-copy.json` and `screenshot-info.json` files when needed. Existing files
46
+ are preserved during initialization, package installation, and cleanup. Capture
47
+ updates screenshot information; the AI text-generation workflow fills screenshot
48
+ copy. `--delete` removes matching records, and screenshot runs reconcile records
49
+ against the captured images (except dry runs and `--refresh-info`).
50
+
51
+ ## Agent instructions
52
+
53
+ Agent instructions are updated during `npm run build`, not during npm installation.
54
+ The build script reads the `agents` version from
55
+ `https://htmlcodeplay.com/code-play-plugin/versions.json` and downloads the matching
56
+ `agents-<version>.zip` archive when the project has no agent instructions or the
57
+ server version is newer.
58
+
59
+ The ZIP root must contain `AGENTS.md` and `AGENTS/`. These are copied directly to
60
+ the project root. The installed version is stored in `AGENTS/.codeplay-version`.
61
+ Existing files with matching names are replaced; project-only files with other
62
+ names inside `AGENTS/` are preserved.
63
+
64
+ For example, publish `agents-1.1.zip` and add this entry to the server's
65
+ `versions.json`:
66
+
67
+ ```json
68
+ "agents": "1.1"
69
+ ```
70
+
71
+ Donate to get full code including many common functions
72
+ https://ko-fi.com/codeplay
73
+
74
+ Version 4.6.1
75
+ Added automatic IAP startup integration for Framework7 home pages.
76
+ Updated minimum shared versions to IAP 4.2 and AdMob nextgen 2.5.
77
+
78
+ 4.2.8
79
+ baseline profile code modifications
80
+
81
+ Version 4.2.3
82
+ Added build warning confirmation when android.ORIENTATION is not "auto" or android.RESIZEABLE_ACTIVITY is not true.
83
+
84
+ Version 4.2.2
85
+ Added "bannerDisabledPages" property and its default value
86
+ The admob configuration default value priority is updated
87
+
88
+ Version 4.2.1
89
+ Updated AdMob nextgen file validation to match admob-emi-nextgen file names.
90
+
91
+ Version 4.2.0
92
+ Firebase related automatic changes updated
93
+
94
+ Version 4.1.9
95
+ Added AdMob nextgen 1.7 validation/default support for "overlappingHeight", "bannerTypeAndroidLandscape", and "bannerTypeiOSLandscape".
96
+
97
+ Version 4.1.8
98
+ "consentDebug: false" is added
99
+
100
+ Version 4.1.7
101
+ admob configuration automatically added.
102
+
103
+ Version 4.1.6
104
+ "setup-baseline-profile.js" modification, duplicate validation error fixed
105
+
106
+ Version 4.1.5
107
+ While isTesting is true it is not validated from our new configuration admob file, now it is solved
108
+
109
+ Version 4.1.4
110
+ hardcoded version is removed for the admob-emi-nextgen
111
+
112
+
113
+ Version 4.1.3
114
+ "consentDebug": false automatically adds if not
115
+
116
+ Version 4.1.2
117
+ Speedup
118
+
119
+ Version 4.1.1
120
+ Auto admob integration updated
121
+
122
+
123
+ version 4.0.9
124
+ packageJson.scripts["ionic:serve"] = "cross-env NODE_ENV=development vite"; this line updated in "sync-files.js"
125
+
126
+
127
+ version 4.0.8
128
+ safearea plugin is checked and removed automatically
129
+ Automatically added following in capacitor.config.json file
130
+ "SystemBars": {
131
+ "insetsHandling": "css"
132
+ }
133
+ patchFile() method is removed
134
+
135
+
136
+
137
+
138
+ Version 4.0.6
139
+ IAP related some automatic variable creation and validation
140
+ Fetch from vite.config.json file
141
+ 'import.meta.env.VITE_APP_UNIQUE_ID': JSON.stringify(APP_UNIQUE_ID),
142
+ 'import.meta.env.VITE_ANDROID_ANALYTICS_ENABLED': JSON.stringify(ANDROID_ANALYTICS_ENABLED),
143
+ 'import.meta.env.VITE_IOS_ANALYTICS_ENABLED': JSON.stringify(IOS_ANALYTICS_ENABLED),
144
+ 'import.meta.env.VITE_IAP_DESIGN': JSON.stringify(IAP_DESIGN),
145
+
146
+
147
+ Version 4.0.5
148
+ In "files\buildCodeplay\packageidBaseModification-1.4.js" SCHEDULE_EXACT_ALARM permission added for the app unique id 2 (resume generator app)
149
+
150
+
151
+ Version 4.0.4
152
+ patchFile(); method is disabled, Due to "@capacitor/android:8.4.2" this update. I think it is realted to safearea issue fixed in this latest version, file in "SystemBars.java"
153
+
154
+ Version 4.0.3
155
+ Old admob check performs through plugin location, but not it is validated from capacitor.config.json
156
+
157
+
158
+ Version: 4.0.2
159
+ After check & install/download the latest version, the re-check is cancelled now
160
+
161
+ Version: 4.0.1
162
+ Base profile script added
163
+
164
+
165
+ "version": "",
166
+ Version : 4.0.0 (Previous version 3.2.19)
167
+ 1) In here we are completly remove the admob-emi and use "capacitor-admob-nextgen"
168
+ 2) Removed "modify-plugin-xml.js"
169
+ 3)
@@ -1358,6 +1358,28 @@ const resourcesPath = path.join(process.cwd(), 'resources', 'res');
1358
1358
  const androidResPath = path.join(process.cwd(), 'android', 'app', 'src', 'main', 'res');
1359
1359
  const localNotificationsPluginPath = path.join(process.cwd(), 'node_modules', '@capacitor', 'local-notifications');
1360
1360
 
1361
+ function syncAndroidCodeOptimization() {
1362
+ if (buildPlatform !== 'android') return;
1363
+
1364
+ if (!fs.existsSync(androidAppBuildGradlePath)) {
1365
+ throw new Error(`Android app build.gradle not found: ${androidAppBuildGradlePath}`);
1366
+ }
1367
+
1368
+ const currentContent = fs.readFileSync(androidAppBuildGradlePath, 'utf8');
1369
+ const nextContent = currentContent.replace(
1370
+ /getDefaultProguardFile\(\s*(['"])proguard-android\.txt\1\s*\)/g,
1371
+ "getDefaultProguardFile('proguard-android-optimize.txt')"
1372
+ );
1373
+
1374
+ if (!/getDefaultProguardFile\(\s*(['"])proguard-android-optimize\.txt\1\s*\)/.test(nextContent)) {
1375
+ throw new Error('Android code optimisation setup failed: expected default ProGuard configuration was not found.');
1376
+ }
1377
+
1378
+ if (nextContent !== currentContent) {
1379
+ fs.writeFileSync(androidAppBuildGradlePath, nextContent, 'utf8');
1380
+ }
1381
+ }
1382
+
1361
1383
  function fileExists(filePath) {
1362
1384
  return fs.existsSync(filePath);
1363
1385
  }
@@ -4305,6 +4327,7 @@ async function main() {
4305
4327
  checkAndupdateDropInViteConfig();
4306
4328
  checkAdmobConfigurationProperty();
4307
4329
  syncAndroidAdIdPermission();
4330
+ syncAndroidCodeOptimization();
4308
4331
  }
4309
4332
 
4310
4333
  await main();
@@ -4320,6 +4343,7 @@ await main();
4320
4343
  Release Notes
4321
4344
 
4322
4345
  6.5
4346
+ Android builds use the optimisation-enabled default ProGuard rules without changing minification settings or custom keep rules.
4323
4347
  Kids ad configuration disables iOS ATT prompts and excludes Android AD_ID during builds.
4324
4348
  Non-kids apps retain tracking prompts and normal permission behavior.
4325
4349
  Ad configuration migration preserves newer local configuration versions.
@@ -1,4 +1,4 @@
1
- {
2
- "url": "https://htmlcodeplay.com/codeplay/api/v1/release/sync",
3
- "token": "b_TiY0Lu7q7Yb0Kx9djVxA6ST8k4CFiwFQNxgci7AAU"
4
- }
1
+ {
2
+ "url": "https://htmlcodeplay.com/codeplay/api/v1/release/sync",
3
+ "token": "b_TiY0Lu7q7Yb0Kx9djVxA6ST8k4CFiwFQNxgci7AAU"
4
+ }
@@ -742,6 +742,71 @@ function findGradleBlock(content, headerPattern) {
742
742
  return null;
743
743
  }
744
744
 
745
+ function ensureReleaseCodeOptimization() {
746
+ const currentContent = readFileSync(gradleFilePath, 'utf8');
747
+ const releaseBlock = findGradleBlock(currentContent, /buildTypes\s*\{[\s\S]*?\brelease\s*/);
748
+ if (!releaseBlock) throw new Error('Release build configuration was not found.');
749
+
750
+ const releaseContent = currentContent.slice(releaseBlock.start, releaseBlock.end);
751
+ const optimizedContent = releaseContent.replace(
752
+ /getDefaultProguardFile\(\s*(['"])proguard-android\.txt\1\s*\)/g,
753
+ "getDefaultProguardFile('proguard-android-optimize.txt')"
754
+ );
755
+ if (!/getDefaultProguardFile\(\s*(['"])proguard-android-optimize\.txt\1\s*\)/.test(optimizedContent)) {
756
+ throw new Error('Release build must use the optimisation-enabled default ProGuard rules.');
757
+ }
758
+ if (optimizedContent !== releaseContent) {
759
+ writeFileSync(gradleFilePath, currentContent.slice(0, releaseBlock.start)
760
+ + optimizedContent + currentContent.slice(releaseBlock.end), 'utf8');
761
+ }
762
+ }
763
+
764
+ function signReleaseBundleWithSha256() {
765
+ const buildOptions = readCapacitorConfig().android?.buildOptions;
766
+ if (!buildOptions?.keystorePath || !buildOptions.keystorePassword
767
+ || !buildOptions.keystoreAlias || !buildOptions.keystoreAliasPassword) {
768
+ throw new Error('Android AAB signing requires the existing keystore path, alias and passwords.');
769
+ }
770
+
771
+ const keystorePath = resolve(__dirname, 'android', buildOptions.keystorePath);
772
+ const bundleDirectory = join(__dirname, 'android', 'app', 'build', 'outputs', 'bundle', 'release');
773
+ const unsignedBundle = join(bundleDirectory, 'app-release.aab');
774
+ const signedBundle = join(bundleDirectory, 'app-release-signed.aab');
775
+ if (!existsSync(keystorePath) || !existsSync(unsignedBundle)) {
776
+ throw new Error('The configured upload keystore or release AAB was not found.');
777
+ }
778
+
779
+ const jarsigner = process.env.JAVA_HOME
780
+ ? join(process.env.JAVA_HOME, 'bin', process.platform === 'win32' ? 'jarsigner.exe' : 'jarsigner')
781
+ : 'jarsigner';
782
+ try {
783
+ // Keep passwords out of command arguments and error output.
784
+ execFileSync(jarsigner, [
785
+ '-sigalg', 'SHA256withRSA', '-digestalg', 'SHA-256',
786
+ '-keystore', keystorePath,
787
+ '-storepass:env', 'CODEPLAY_AAB_STORE_PASSWORD',
788
+ '-keypass:env', 'CODEPLAY_AAB_KEY_PASSWORD',
789
+ '-signedjar', signedBundle, unsignedBundle, buildOptions.keystoreAlias,
790
+ ], {
791
+ stdio: 'pipe',
792
+ env: {
793
+ ...process.env,
794
+ CODEPLAY_AAB_STORE_PASSWORD: buildOptions.keystorePassword,
795
+ CODEPLAY_AAB_KEY_PASSWORD: buildOptions.keystoreAliasPassword,
796
+ },
797
+ });
798
+ const verification = execFileSync(jarsigner, [
799
+ '-J-Duser.language=en', '-J-Duser.country=US', '-verify', signedBundle,
800
+ ], { encoding: 'utf8', stdio: 'pipe' });
801
+ if (!verification.includes('jar verified.') || verification.includes('treated as unsigned')) {
802
+ throw new Error('Signature verification failed.');
803
+ }
804
+ } catch {
805
+ throw new Error('SHA-256 AAB signing or verification failed. Check the configured upload key and JDK; release stopped.');
806
+ }
807
+ console.log('✅ Release AAB signed with SHA-256 using the existing upload key and signature verified.');
808
+ }
809
+
745
810
  const amazonWindowExtensionsDependency = 'implementation "androidx.window.extensions.core:core:1.0.0"';
746
811
  const amazonWindowExtensionsDependencyPattern = /^[ \t]*implementation\s+["']androidx\.window\.extensions\.core:core:[^"']+["'][ \t]*(?:\r?\n)?/gm;
747
812
 
@@ -1013,11 +1078,14 @@ rl.question('Enter new versionCode (press enter to keep current): ', (newVersion
1013
1078
 
1014
1079
  execSync('npx cap sync android', { stdio: 'inherit' });
1015
1080
 
1081
+ ensureReleaseCodeOptimization();
1082
+
1016
1083
  if (buildType === "APK") {
1017
1084
  console.log("📦 Using custom Node signing script for APK build...");
1018
1085
  execSync('node buildCodeplay/apk-store-builder.js', { stdio: 'inherit' });
1019
1086
  } else {
1020
1087
  execSync(`npx cap build android --androidreleasetype=${buildType}`, { stdio: 'inherit' });
1088
+ signReleaseBundleWithSha256();
1021
1089
  }
1022
1090
 
1023
1091
 
@@ -86,8 +86,8 @@ const analysisFrameDirectory = path.join(temporaryDirectory, 'ai-analysis');
86
86
  const endCardBannerPath = path.join(outputVideoDirectory, `${appFilePrefix}-ai-end-card-banner.png`);
87
87
  const promoCopySchemaPath = path.join(temporaryDirectory, 'promo-copy-schema.json');
88
88
  const promoCopyResultPath = path.join(temporaryDirectory, 'promo-copy-result.json');
89
- const ffmpegFallbackDirectory = String(process.env.FFMPEG_BIN || '').trim()
90
- || path.join(projectDirectory, 'tools', 'ffmpeg');
89
+ const ffmpegFallbackDirectory = String(process.env.FFMPEG_BIN || '').trim()
90
+ || path.join(projectDirectory, 'tools', 'ffmpeg');
91
91
  const minimumSceneCount = 7;
92
92
  const minimumSourceDuration = 12;
93
93
  let expectedDuration = 34;
@@ -209,15 +209,15 @@ async function ensureEndCardBanner() {
209
209
  + '- Keep all logos and badge text sharp, correctly proportioned, and completely visible.\n'
210
210
  + '- Match the background colors and visual style to the actual app icon.\n'
211
211
  + '- Create a polished, professional background related to the app’s purpose.\n'
212
- + '- Keep the background subtle so it does not compete with the icon, title, feature text, or download badges.\n'
212
+ + '- Keep the background subtle so it does not compete with the icon, title, feature text, or download badges.\n'
213
213
  + '- Use a balanced landscape composition:\n'
214
214
  + ' - Large actual app icon on the left.\n'
215
215
  + ' - App Store badge followed by Google Play badge on the right.\n'
216
216
  + ' - Maintain comfortable margins and clear space around every element.\n'
217
- + '- Add the application title prominently.\n'
218
- + '- Add concise promotional text describing the application’s actual features, presenting each feature one by one.\n'
219
- + '- Keep the title and feature text sharp, readable, accurate, and visually balanced with the icon and download badges.\n'
220
- + '- Do not invent unsupported features or add unrelated marketing text.\n'
217
+ + '- Add the application title prominently.\n'
218
+ + '- Add concise promotional text describing the application’s actual features, presenting each feature one by one.\n'
219
+ + '- Keep the title and feature text sharp, readable, accurate, and visually balanced with the icon and download badges.\n'
220
+ + '- Do not invent unsupported features or add unrelated marketing text.\n'
221
221
  + '- Do not add watermarks, fake UI, generated symbols, or unrelated decorations.\n'
222
222
  + '- Rounded corners and a subtle shadow may be applied around the app icon, but its internal artwork must remain unchanged.\n'
223
223
  + '- Use image generation only for the background.\n'
@@ -467,12 +467,12 @@ function commandExists(command) {
467
467
  return !result.error && result.status === 0;
468
468
  }
469
469
 
470
- function getExecutable(command) {
471
- const executableName = process.platform === 'win32' ? `${command}.exe` : command;
472
- const fallbackPath = path.join(ffmpegFallbackDirectory, executableName);
473
- if (fs.existsSync(fallbackPath)) return fallbackPath;
474
- return commandExists(command) ? command : '';
475
- }
470
+ function getExecutable(command) {
471
+ const executableName = process.platform === 'win32' ? `${command}.exe` : command;
472
+ const fallbackPath = path.join(ffmpegFallbackDirectory, executableName);
473
+ if (fs.existsSync(fallbackPath)) return fallbackPath;
474
+ return commandExists(command) ? command : '';
475
+ }
476
476
 
477
477
  function detectRedundantStaticRanges(ffmpegCommand, inputPath, sourceDuration) {
478
478
  const minimumStaticDuration = Math.max(2, Math.min(4, sourceDuration / 60));
@@ -640,7 +640,7 @@ function resolvePromoLayout(requestedLayout) {
640
640
  }
641
641
 
642
642
  function getPythonExecutable() {
643
- for (const candidate of ['py', 'python', 'python3']) {
643
+ for (const candidate of ['py', 'python', 'python3']) {
644
644
  const result = spawnSync(candidate, ['-m', 'edge_tts', '--version'], {
645
645
  encoding: 'utf8',
646
646
  windowsHide: true,
@@ -915,7 +915,7 @@ Rules:
915
915
  - footer_keywords must contain exactly 3 distinct, natural app-search phrases, each 2-24 characters.
916
916
  - Generate a YouTube upload title and description from the same verified features.
917
917
  - YouTube title: 40-100 characters, include ${JSON.stringify(appName)} and one strong natural search phrase, without clickbait.
918
- - YouTube description: 350-1500 characters with readable paragraphs. Put the clearest app summary and primary search phrase in the opening two lines, explain the demonstrated features, add a simple call to action, then insert a newline and finish with exactly 3 relevant hashtags on that separate final line. The hashtags must not be appended to the preceding paragraph.
918
+ - YouTube description: 350-1500 characters with readable paragraphs. Put the clearest app summary and primary search phrase in the opening two lines, explain the demonstrated features, add a simple call to action, then insert a newline and finish with exactly 3 relevant hashtags on that separate final line. The hashtags must not be appended to the preceding paragraph.
919
919
  - Do not add download links or URLs; the script will append the verified Google Play URL built from the configured package ID. Do not add chapter timestamps or unsupported availability claims.
920
920
  - Keep YouTube text natural and useful; do not repeat keywords unnaturally.
921
921
  - Avoid prices, ratings, awards, competitor names, unsupported superlatives, and words such as best, guaranteed, or free.
@@ -1025,14 +1025,14 @@ function validatePromoCopy(value) {
1025
1025
  throw new Error(`The final scene must mention the app name ${JSON.stringify(appName)}.`);
1026
1026
  }
1027
1027
 
1028
- const youtubeTitle = cleanGeneratedString(value.youtube.title);
1029
- let youtubeDescription = cleanGeneratedDescription(value.youtube.description);
1030
- const trailingHashtagGroup = youtubeDescription.match(
1031
- /(?:^|\s)(#[\p{L}\p{N}_]+\s+#[\p{L}\p{N}_]+\s+#[\p{L}\p{N}_]+)\s*$/u,
1032
- );
1033
- if (trailingHashtagGroup) {
1034
- youtubeDescription = `${youtubeDescription.slice(0, trailingHashtagGroup.index).trimEnd()}\n${trailingHashtagGroup[1]}`;
1035
- }
1028
+ const youtubeTitle = cleanGeneratedString(value.youtube.title);
1029
+ let youtubeDescription = cleanGeneratedDescription(value.youtube.description);
1030
+ const trailingHashtagGroup = youtubeDescription.match(
1031
+ /(?:^|\s)(#[\p{L}\p{N}_]+\s+#[\p{L}\p{N}_]+\s+#[\p{L}\p{N}_]+)\s*$/u,
1032
+ );
1033
+ if (trailingHashtagGroup) {
1034
+ youtubeDescription = `${youtubeDescription.slice(0, trailingHashtagGroup.index).trimEnd()}\n${trailingHashtagGroup[1]}`;
1035
+ }
1036
1036
  if (youtubeTitle.length < 40 || youtubeTitle.length > 100) {
1037
1037
  throw new Error('YouTube title must be 40-100 characters.');
1038
1038
  }