codeplay-common 4.11.12 → 4.11.15
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/CHANGELOG.md +114 -101
- package/LICENSE +21 -21
- package/README.md +274 -229
- package/RELEASE_NOTES.md +110 -97
- package/files/buildCodeplay/add-splash-screen.js +256 -255
- package/files/buildCodeplay/apk-store-builder.js +97 -97
- package/files/buildCodeplay/codeplayBeforeBuild.js +98 -52
- package/files/buildCodeplay/fix-onesignal-plugin.js +96 -96
- package/files/buildCodeplay/fix-optimize-builld/android-r8-rules.cjs +31 -31
- package/files/buildCodeplay/fix-optimize-builld/ffmpeg-jni-rules.cjs +28 -28
- package/files/buildCodeplay/fix-optimize-builld/fix-optimize-build.gradle +9 -9
- package/files/buildCodeplay/fix-optimize-builld/restore-android-r8-rules.cjs +30 -30
- package/files/buildCodeplay/ios-emi-admob-modification.js +24 -24
- package/files/buildCodeplay/manifestModification.js +38 -38
- package/files/buildCodeplay/release-sync.config.json +4 -4
- package/files/buildCodeplay/setSplashAnimation.js +228 -226
- package/files/buildCodeplay/splash-setup.cjs +88 -0
- package/files/buildCodeplay/splashxml/codeplay_splashScreen.xml +1 -1
- package/files/buildCodeplay/sync-admob-nextgen.js +219 -219
- package/files/buildCodeplay/versions.json +27 -27
- package/files/finalrelease +1263 -1263
- package/files/generate-ai-promo-video.js +23 -23
- package/files/ionic.config.json +6 -6
- package/files/scripts-common/run-codeplay-sync-after.js +21 -21
- package/files/scripts-common/screenshot/background-decorations.js +120 -120
- package/files/scripts-common/screenshot/frame-samples.js +117 -117
- package/files/scripts-common/setup-baseline-profile.js +291 -291
- package/files/take-screen-video.js +644 -644
- package/package.json +28 -27
- package/runtime/splash-ready.mjs +52 -0
- package/scripts/splash-setup.test.cjs +142 -0
- package/scripts/sync-files.js +114 -113
- package/scripts/uninstall.js +2 -2
|
@@ -1,98 +1,98 @@
|
|
|
1
|
-
const { spawn } = require("child_process");
|
|
2
|
-
const path = require("path");
|
|
3
|
-
const fs = require("fs");
|
|
4
|
-
|
|
5
|
-
// Paths
|
|
6
|
-
//const projectRoot = path.join(__dirname, "..");
|
|
7
|
-
const projectRoot = process.cwd();
|
|
8
|
-
const androidPath = path.join(projectRoot, "android");
|
|
9
|
-
const capacitorConfigPath = path.join(projectRoot, "capacitor.config.json");
|
|
10
|
-
|
|
11
|
-
// Read capacitor.config.json
|
|
12
|
-
if (!fs.existsSync(capacitorConfigPath)) {
|
|
13
|
-
console.error("❌ capacitor.config.json not found!");
|
|
14
|
-
process.exit(1);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const config = JSON.parse(fs.readFileSync(capacitorConfigPath, "utf8"));
|
|
18
|
-
|
|
19
|
-
const buildOptions = config.android?.buildOptions;
|
|
20
|
-
|
|
21
|
-
if (!buildOptions) {
|
|
22
|
-
console.error("❌ android.buildOptions not found in capacitor.config.json");
|
|
23
|
-
process.exit(1);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// Resolve keystore path (relative → absolute)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const storePassword = buildOptions.keystorePassword;
|
|
30
|
-
const keyAlias = buildOptions.keystoreAlias;
|
|
31
|
-
const keyPassword = buildOptions.keystoreAliasPassword;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const rawKeystorePath = buildOptions.keystorePath;
|
|
39
|
-
|
|
40
|
-
// First try normal resolve
|
|
41
|
-
let keystorePath = path.resolve(projectRoot, rawKeystorePath);
|
|
42
|
-
|
|
43
|
-
// If not found, try trimming one "../"
|
|
44
|
-
if (!fs.existsSync(keystorePath)) {
|
|
45
|
-
console.log("⚠️ Keystore not found, attempting path correction...");
|
|
46
|
-
|
|
47
|
-
const trimmedPath = rawKeystorePath.replace(/^\.\.\//, "");
|
|
48
|
-
keystorePath = path.resolve(projectRoot, trimmedPath);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// Final validation
|
|
52
|
-
if (!fs.existsSync(keystorePath)) {
|
|
53
|
-
console.error("❌ Keystore file not found even after correction:", keystorePath);
|
|
54
|
-
process.exit(1);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
console.log("🔐 Using keystore:", keystorePath);
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
// Gradle args
|
|
69
|
-
const isWindows = process.platform === "win32";
|
|
70
|
-
const command = isWindows ? "cmd.exe" : "sh";
|
|
71
|
-
const args = [
|
|
72
|
-
...(isWindows ? ["/c", "gradlew.bat"] : ["./gradlew"]),
|
|
73
|
-
"assembleRelease",
|
|
74
|
-
`-Pandroid.injected.signing.store.file=${keystorePath}`,
|
|
75
|
-
`-Pandroid.injected.signing.store.password=${storePassword}`,
|
|
76
|
-
`-Pandroid.injected.signing.key.alias=${keyAlias}`,
|
|
77
|
-
`-Pandroid.injected.signing.key.password=${keyPassword}`,
|
|
78
|
-
];
|
|
79
|
-
|
|
80
|
-
// Run Gradle
|
|
81
|
-
const gradle = spawn(command, args, {
|
|
82
|
-
cwd: androidPath,
|
|
83
|
-
stdio: "inherit",
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
gradle.on("error", (error) => {
|
|
87
|
-
console.error("❌ Could not start Gradle:", error.message);
|
|
88
|
-
process.exit(1);
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
gradle.on("close", (code) => {
|
|
92
|
-
if (code === 0) {
|
|
93
|
-
console.log("\n✅ Signed APK Generated Successfully!");
|
|
94
|
-
} else {
|
|
95
|
-
console.log("\n❌ Build Failed with code:", code);
|
|
96
|
-
process.exit(code ?? 1);
|
|
97
|
-
}
|
|
1
|
+
const { spawn } = require("child_process");
|
|
2
|
+
const path = require("path");
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
|
|
5
|
+
// Paths
|
|
6
|
+
//const projectRoot = path.join(__dirname, "..");
|
|
7
|
+
const projectRoot = process.cwd();
|
|
8
|
+
const androidPath = path.join(projectRoot, "android");
|
|
9
|
+
const capacitorConfigPath = path.join(projectRoot, "capacitor.config.json");
|
|
10
|
+
|
|
11
|
+
// Read capacitor.config.json
|
|
12
|
+
if (!fs.existsSync(capacitorConfigPath)) {
|
|
13
|
+
console.error("❌ capacitor.config.json not found!");
|
|
14
|
+
process.exit(1);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const config = JSON.parse(fs.readFileSync(capacitorConfigPath, "utf8"));
|
|
18
|
+
|
|
19
|
+
const buildOptions = config.android?.buildOptions;
|
|
20
|
+
|
|
21
|
+
if (!buildOptions) {
|
|
22
|
+
console.error("❌ android.buildOptions not found in capacitor.config.json");
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// Resolve keystore path (relative → absolute)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
const storePassword = buildOptions.keystorePassword;
|
|
30
|
+
const keyAlias = buildOptions.keystoreAlias;
|
|
31
|
+
const keyPassword = buildOptions.keystoreAliasPassword;
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
const rawKeystorePath = buildOptions.keystorePath;
|
|
39
|
+
|
|
40
|
+
// First try normal resolve
|
|
41
|
+
let keystorePath = path.resolve(projectRoot, rawKeystorePath);
|
|
42
|
+
|
|
43
|
+
// If not found, try trimming one "../"
|
|
44
|
+
if (!fs.existsSync(keystorePath)) {
|
|
45
|
+
console.log("⚠️ Keystore not found, attempting path correction...");
|
|
46
|
+
|
|
47
|
+
const trimmedPath = rawKeystorePath.replace(/^\.\.\//, "");
|
|
48
|
+
keystorePath = path.resolve(projectRoot, trimmedPath);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Final validation
|
|
52
|
+
if (!fs.existsSync(keystorePath)) {
|
|
53
|
+
console.error("❌ Keystore file not found even after correction:", keystorePath);
|
|
54
|
+
process.exit(1);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
console.log("🔐 Using keystore:", keystorePath);
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
// Gradle args
|
|
69
|
+
const isWindows = process.platform === "win32";
|
|
70
|
+
const command = isWindows ? "cmd.exe" : "sh";
|
|
71
|
+
const args = [
|
|
72
|
+
...(isWindows ? ["/c", "gradlew.bat"] : ["./gradlew"]),
|
|
73
|
+
"assembleRelease",
|
|
74
|
+
`-Pandroid.injected.signing.store.file=${keystorePath}`,
|
|
75
|
+
`-Pandroid.injected.signing.store.password=${storePassword}`,
|
|
76
|
+
`-Pandroid.injected.signing.key.alias=${keyAlias}`,
|
|
77
|
+
`-Pandroid.injected.signing.key.password=${keyPassword}`,
|
|
78
|
+
];
|
|
79
|
+
|
|
80
|
+
// Run Gradle
|
|
81
|
+
const gradle = spawn(command, args, {
|
|
82
|
+
cwd: androidPath,
|
|
83
|
+
stdio: "inherit",
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
gradle.on("error", (error) => {
|
|
87
|
+
console.error("❌ Could not start Gradle:", error.message);
|
|
88
|
+
process.exit(1);
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
gradle.on("close", (code) => {
|
|
92
|
+
if (code === 0) {
|
|
93
|
+
console.log("\n✅ Signed APK Generated Successfully!");
|
|
94
|
+
} else {
|
|
95
|
+
console.log("\n❌ Build Failed with code:", code);
|
|
96
|
+
process.exit(code ?? 1);
|
|
97
|
+
}
|
|
98
98
|
});
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
// Version
|
|
1
|
+
// Version 7.1: require confirmation before continuing with local versions when the server check fails.
|
|
2
|
+
// Version 7.0: prepare shared splash readiness and migrate the legacy splash theme.
|
|
3
|
+
// Version 6.9: preserve configured notification icons during Android resource shrinking.
|
|
2
4
|
// Version 6.8: preserve Capacitor permission annotations for Love Calculator Android builds.
|
|
3
5
|
// Version 6.7: deferred IAP startup, ownership-safe ads, and unified store preparation.
|
|
4
6
|
// Version 6.7: migrate AdMob files to ZIP-distributed folder packages.
|
|
@@ -228,7 +230,7 @@ const { execSync } = require("child_process");
|
|
|
228
230
|
const { readFileSync } = require("fs");
|
|
229
231
|
const readline = require('readline');
|
|
230
232
|
|
|
231
|
-
// Complete asynchronous preparation before continuing the remaining build steps.
|
|
233
|
+
// Complete asynchronous preparation before continuing the remaining build steps.
|
|
232
234
|
(async () => {
|
|
233
235
|
|
|
234
236
|
// Standalone builds default to Android on every host OS.
|
|
@@ -342,9 +344,9 @@ const ROOT_DIR = path.join(process.cwd(), "src");
|
|
|
342
344
|
|
|
343
345
|
function requireOrInstall(packageName) {
|
|
344
346
|
try {
|
|
345
|
-
require.resolve(packageName);
|
|
347
|
+
require.resolve(packageName);
|
|
346
348
|
} catch (err) {
|
|
347
|
-
if (err.code !== 'MODULE_NOT_FOUND') throw err;
|
|
349
|
+
if (err.code !== 'MODULE_NOT_FOUND') throw err;
|
|
348
350
|
|
|
349
351
|
console.log(`📦 "${packageName}" not found. Installing automatically...`);
|
|
350
352
|
|
|
@@ -357,8 +359,8 @@ function requireOrInstall(packageName) {
|
|
|
357
359
|
}
|
|
358
360
|
|
|
359
361
|
}
|
|
360
|
-
// Loading errors in an installed package must not trigger another install.
|
|
361
|
-
return require(packageName);
|
|
362
|
+
// Loading errors in an installed package must not trigger another install.
|
|
363
|
+
return require(packageName);
|
|
362
364
|
}
|
|
363
365
|
|
|
364
366
|
const AdmZip = requireOrInstall("adm-zip");
|
|
@@ -998,7 +1000,7 @@ const saveToGalleryAndSaveFileCheck_iOS = async () => {
|
|
|
998
1000
|
const SAVE_FILE_REGEX = /^(.*[\/\\])?(saveToGalleryAndSaveAnyFile-\d+(?:\.\d+)*)(-ios)?(\.js)?([?#].*)?$/;
|
|
999
1001
|
const pendingChanges = [];
|
|
1000
1002
|
|
|
1001
|
-
const ALLOWED_EXTENSIONS = ['.js', '.mjs', '.cjs', '.ts', '.tsx', '.jsx', '.f7'];
|
|
1003
|
+
const ALLOWED_EXTENSIONS = ['.js', '.mjs', '.cjs', '.ts', '.tsx', '.jsx', '.f7'];
|
|
1002
1004
|
const referencedVersions = new Set();
|
|
1003
1005
|
let aliasImportFound = false;
|
|
1004
1006
|
let hasForbiddenEditorImport = false;
|
|
@@ -1047,7 +1049,7 @@ function scanSourceFile(dir) {
|
|
|
1047
1049
|
*/
|
|
1048
1050
|
|
|
1049
1051
|
const baseName = path.basename(dir);
|
|
1050
|
-
const shouldCheckGallery = !dir.split(path.sep).includes('node_modules') && !SKIP_FILES.includes(baseName)
|
|
1052
|
+
const shouldCheckGallery = !dir.split(path.sep).includes('node_modules') && !SKIP_FILES.includes(baseName)
|
|
1051
1053
|
&& ALLOWED_EXTENSIONS.some(ext => dir.endsWith(ext));
|
|
1052
1054
|
const shouldCheckEditor = /\.(js|ts|f7)$/.test(dir);
|
|
1053
1055
|
const shouldCheckOneSignal = /\.(js|mjs|cjs|ts|tsx|jsx|f7)$/.test(dir);
|
|
@@ -1068,21 +1070,21 @@ function scanSourceFile(dir) {
|
|
|
1068
1070
|
}
|
|
1069
1071
|
}
|
|
1070
1072
|
|
|
1071
|
-
// Framework7 templates contain HTML quotes and expressions, not JavaScript.
|
|
1072
|
-
// Mask everything outside <script> while retaining original edit offsets.
|
|
1073
|
-
let scriptContent = content;
|
|
1074
|
-
if (dir.endsWith('.f7')) {
|
|
1075
|
-
const script = /<script\b[^>]*>([\s\S]*?)<\/script\s*>/i.exec(content);
|
|
1076
|
-
if (script) {
|
|
1077
|
-
const start = script.index + script[0].indexOf('>') + 1;
|
|
1078
|
-
const end = start + script[1].length;
|
|
1079
|
-
scriptContent = content.slice(0, start).replace(/[^\r\n]/g, ' ')
|
|
1080
|
-
+ script[1] + content.slice(end).replace(/[^\r\n]/g, ' ');
|
|
1081
|
-
} else {
|
|
1082
|
-
scriptContent = content.replace(/[^\r\n]/g, ' ');
|
|
1083
|
-
}
|
|
1084
|
-
}
|
|
1085
|
-
const code = scriptContent.replace(COMMENT_OR_STRING_REGEX, (match, quote) =>
|
|
1073
|
+
// Framework7 templates contain HTML quotes and expressions, not JavaScript.
|
|
1074
|
+
// Mask everything outside <script> while retaining original edit offsets.
|
|
1075
|
+
let scriptContent = content;
|
|
1076
|
+
if (dir.endsWith('.f7')) {
|
|
1077
|
+
const script = /<script\b[^>]*>([\s\S]*?)<\/script\s*>/i.exec(content);
|
|
1078
|
+
if (script) {
|
|
1079
|
+
const start = script.index + script[0].indexOf('>') + 1;
|
|
1080
|
+
const end = start + script[1].length;
|
|
1081
|
+
scriptContent = content.slice(0, start).replace(/[^\r\n]/g, ' ')
|
|
1082
|
+
+ script[1] + content.slice(end).replace(/[^\r\n]/g, ' ');
|
|
1083
|
+
} else {
|
|
1084
|
+
scriptContent = content.replace(/[^\r\n]/g, ' ');
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
const code = scriptContent.replace(COMMENT_OR_STRING_REGEX, (match, quote) =>
|
|
1086
1088
|
quote ? match : match.replace(/[^\r\n]/g, ' ')
|
|
1087
1089
|
);
|
|
1088
1090
|
const replacements = [];
|
|
@@ -1146,13 +1148,13 @@ if (referencedVersions.size || aliasImportFound) {
|
|
|
1146
1148
|
const existingName = path.basename(aliasMatch[3]).match(SAVE_FILE_REGEX);
|
|
1147
1149
|
if (!existingName) throw new Error('❌ @saveGallery must point to a versioned saveToGalleryAndSaveAnyFile helper.');
|
|
1148
1150
|
}
|
|
1149
|
-
// Imports can still mention deleted versions after a plugin update. Resolve the
|
|
1150
|
-
// alias from installed files instead, using only the selected platform variant.
|
|
1151
|
-
const jsDir = path.join(SOURCE_ROOT, 'js');
|
|
1152
|
-
const pattern = isIOSBuild ? /^saveToGalleryAndSaveAnyFile-\d+(?:\.\d+)*-ios\.js$/ : /^saveToGalleryAndSaveAnyFile-\d+(?:\.\d+)*\.js$/;
|
|
1153
|
-
const latestFile = getLatestVersionedFileName(jsDir, pattern);
|
|
1154
|
-
if (!latestFile) throw new Error(`❌ No ${buildPlatform} save-gallery helper found in src/js.`);
|
|
1155
|
-
const targetRelativePath = `./src/js/${latestFile}`;
|
|
1151
|
+
// Imports can still mention deleted versions after a plugin update. Resolve the
|
|
1152
|
+
// alias from installed files instead, using only the selected platform variant.
|
|
1153
|
+
const jsDir = path.join(SOURCE_ROOT, 'js');
|
|
1154
|
+
const pattern = isIOSBuild ? /^saveToGalleryAndSaveAnyFile-\d+(?:\.\d+)*-ios\.js$/ : /^saveToGalleryAndSaveAnyFile-\d+(?:\.\d+)*\.js$/;
|
|
1155
|
+
const latestFile = getLatestVersionedFileName(jsDir, pattern);
|
|
1156
|
+
if (!latestFile) throw new Error(`❌ No ${buildPlatform} save-gallery helper found in src/js.`);
|
|
1157
|
+
const targetRelativePath = `./src/js/${latestFile}`;
|
|
1156
1158
|
const targetPath = path.resolve(path.dirname(viteConfigPath), targetRelativePath);
|
|
1157
1159
|
if (!fs.existsSync(targetPath)) throw new Error(`❌ Cannot configure @saveGallery: target file does not exist: ${targetPath}`);
|
|
1158
1160
|
const aliasEntry = `'@saveGallery': path.resolve(__dirname, '${targetRelativePath}')`;
|
|
@@ -1195,10 +1197,10 @@ if (pendingChanges.length) {
|
|
|
1195
1197
|
}
|
|
1196
1198
|
}
|
|
1197
1199
|
|
|
1198
|
-
// Validate all pending edits before applying the automatic migration.
|
|
1200
|
+
// Validate all pending edits before applying the automatic migration.
|
|
1199
1201
|
for (const change of pendingChanges) {
|
|
1200
1202
|
if (fs.readFileSync(change.filePath, 'utf8') !== change.content) {
|
|
1201
|
-
throw new Error(`❌ Source changed during alias migration: ${change.filePath}. Build cancelled; run it again.`);
|
|
1203
|
+
throw new Error(`❌ Source changed during alias migration: ${change.filePath}. Build cancelled; run it again.`);
|
|
1202
1204
|
}
|
|
1203
1205
|
}
|
|
1204
1206
|
for (const change of pendingChanges) {
|
|
@@ -2244,17 +2246,28 @@ function updateImports(oldName, newName) {
|
|
|
2244
2246
|
|
|
2245
2247
|
|
|
2246
2248
|
let _serverVersions = null;
|
|
2249
|
+
let _versionsFetchAttempted = false;
|
|
2250
|
+
let _versionsFetchError = '';
|
|
2251
|
+
let skipOnlineVersionChecks = false;
|
|
2247
2252
|
async function fetchVersions() {
|
|
2248
2253
|
|
|
2249
|
-
if (
|
|
2254
|
+
if (skipOnlineVersionChecks || _versionsFetchAttempted) return _serverVersions;
|
|
2255
|
+
_versionsFetchAttempted = true;
|
|
2250
2256
|
|
|
2251
2257
|
return new Promise((resolve) => {
|
|
2252
2258
|
|
|
2253
|
-
https.get(
|
|
2259
|
+
const request = https.get(
|
|
2254
2260
|
"https://htmlcodeplay.com/code-play-plugin/versions.json",
|
|
2255
2261
|
{ timeout: 5000 },
|
|
2256
2262
|
res => {
|
|
2257
2263
|
|
|
2264
|
+
if (res.statusCode !== 200) {
|
|
2265
|
+
_versionsFetchError = `Server returned HTTP ${res.statusCode}.`;
|
|
2266
|
+
res.resume();
|
|
2267
|
+
resolve(null);
|
|
2268
|
+
return;
|
|
2269
|
+
}
|
|
2270
|
+
|
|
2258
2271
|
let data = "";
|
|
2259
2272
|
|
|
2260
2273
|
res.on("data", chunk => data += chunk);
|
|
@@ -2263,21 +2276,34 @@ async function fetchVersions() {
|
|
|
2263
2276
|
|
|
2264
2277
|
try {
|
|
2265
2278
|
|
|
2266
|
-
|
|
2279
|
+
const versions = JSON.parse(data);
|
|
2280
|
+
if (!versions || typeof versions !== 'object' || Array.isArray(versions)) {
|
|
2281
|
+
throw new Error('Expected a JSON object in versions.json.');
|
|
2282
|
+
}
|
|
2283
|
+
_serverVersions = versions;
|
|
2267
2284
|
|
|
2268
2285
|
resolve(_serverVersions);
|
|
2269
2286
|
|
|
2270
|
-
} catch {
|
|
2271
|
-
|
|
2287
|
+
} catch (error) {
|
|
2288
|
+
_versionsFetchError = `Invalid versions.json: ${error.message}`;
|
|
2272
2289
|
resolve(null);
|
|
2273
2290
|
|
|
2274
2291
|
}
|
|
2275
2292
|
|
|
2276
2293
|
});
|
|
2277
2294
|
|
|
2295
|
+
res.on('error', error => {
|
|
2296
|
+
_versionsFetchError = error.message;
|
|
2297
|
+
resolve(null);
|
|
2298
|
+
});
|
|
2278
2299
|
}
|
|
2279
2300
|
|
|
2280
|
-
)
|
|
2301
|
+
);
|
|
2302
|
+
request.on('timeout', () => request.destroy(new Error('versions.json request timed out after 5 seconds.')));
|
|
2303
|
+
request.on('error', error => {
|
|
2304
|
+
_versionsFetchError = error.message;
|
|
2305
|
+
resolve(null);
|
|
2306
|
+
});
|
|
2281
2307
|
|
|
2282
2308
|
});
|
|
2283
2309
|
|
|
@@ -2337,6 +2363,7 @@ function readInstalledAgentInstructionsVersion(projectRoot) {
|
|
|
2337
2363
|
}
|
|
2338
2364
|
|
|
2339
2365
|
async function syncAgentInstructions() {
|
|
2366
|
+
if (skipOnlineVersionChecks) return;
|
|
2340
2367
|
const projectRoot = process.cwd();
|
|
2341
2368
|
const targetAgentFile = path.join(projectRoot, AGENT_INSTRUCTIONS_FILE);
|
|
2342
2369
|
const targetAgentDir = path.join(projectRoot, AGENT_INSTRUCTIONS_DIR);
|
|
@@ -2471,7 +2498,7 @@ if (pluginDef.isFolder) {
|
|
|
2471
2498
|
updateImports(pluginInfo.name, `${baseName}-${latestVersion}`);
|
|
2472
2499
|
|
|
2473
2500
|
fs.rmSync(oldPath, { recursive: true, force: true });
|
|
2474
|
-
sourceFileInventory = null; // updateImports cached files from the removed folder.
|
|
2501
|
+
sourceFileInventory = null; // updateImports cached files from the removed folder.
|
|
2475
2502
|
// ✅ ADD THIS
|
|
2476
2503
|
writeUpdateLine(`${pluginInfo.name} -> ${baseName}-${latestVersion}`);
|
|
2477
2504
|
|
|
@@ -2547,7 +2574,7 @@ existingFiles.forEach(file => {
|
|
|
2547
2574
|
const oldPath = path.join(pluginDir, file);
|
|
2548
2575
|
|
|
2549
2576
|
fs.unlinkSync(oldPath);
|
|
2550
|
-
sourceFileInventory = null;
|
|
2577
|
+
sourceFileInventory = null;
|
|
2551
2578
|
|
|
2552
2579
|
console.log(`🗑 Removed old file → ${file}`);
|
|
2553
2580
|
//writeUpdateLine(`Removed old file: ${file}`);
|
|
@@ -2603,8 +2630,26 @@ async function loadPluginVersions() {
|
|
|
2603
2630
|
|
|
2604
2631
|
const versions = await fetchVersions();
|
|
2605
2632
|
|
|
2606
|
-
if (!versions ||
|
|
2607
|
-
|
|
2633
|
+
if (!versions || !/^\d+(?:\.\d+)*$/.test(String(versions[AGENT_INSTRUCTIONS_VERSION_KEY] || '').trim())) {
|
|
2634
|
+
const details = _versionsFetchError || 'versions.json is missing a valid agent instructions version.';
|
|
2635
|
+
const cancelledMessage = `Build cancelled: online version checks could not be completed. ${details}\nCheck your internet connection and https://htmlcodeplay.com/code-play-plugin/versions.json, then retry. Choose Yes at the confirmation prompt only if you want to use local versions without online checks.`;
|
|
2636
|
+
console.warn(`\n⚠️ Could not check versions.json. There might be an internet connection or server issue.\nDetails: ${details}\nContinuing will use only local plugin versions and agent instructions, without checking for online updates.`);
|
|
2637
|
+
await new Promise((resolve, reject) => {
|
|
2638
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
2639
|
+
rl.on('close', () => reject(new Error(cancelledMessage)));
|
|
2640
|
+
rl.question('\nAre you sure you want to continue with local versions only? (yes/no, default: no): ', answer => {
|
|
2641
|
+
const confirmed = /^(y|yes)$/i.test(answer.trim());
|
|
2642
|
+
if (confirmed) {
|
|
2643
|
+
skipOnlineVersionChecks = true;
|
|
2644
|
+
_serverVersions = null;
|
|
2645
|
+
resolve();
|
|
2646
|
+
} else {
|
|
2647
|
+
reject(new Error(cancelledMessage));
|
|
2648
|
+
}
|
|
2649
|
+
rl.close();
|
|
2650
|
+
});
|
|
2651
|
+
});
|
|
2652
|
+
console.log('✅ Continuing build with local versions only. Online plugin and agent-instruction version checks skipped.');
|
|
2608
2653
|
return;
|
|
2609
2654
|
}
|
|
2610
2655
|
|
|
@@ -3179,7 +3224,7 @@ function ensureMandatoryCapacitorPlugins() {
|
|
|
3179
3224
|
];
|
|
3180
3225
|
|
|
3181
3226
|
for (const packageName of requiredPackages) {
|
|
3182
|
-
if (getInstalledVersion(packageName)) {
|
|
3227
|
+
if (getInstalledVersion(packageName)) {
|
|
3183
3228
|
console.log(`ℹ️ ${packageName} is already installed.`);
|
|
3184
3229
|
continue;
|
|
3185
3230
|
}
|
|
@@ -3204,7 +3249,7 @@ const syncCodeplaySystemBarsPackage = () => {
|
|
|
3204
3249
|
return;
|
|
3205
3250
|
}
|
|
3206
3251
|
|
|
3207
|
-
if (!getInstalledVersion(CODEPLAY_SYSTEM_BARS_PLUGIN)) {
|
|
3252
|
+
if (!getInstalledVersion(CODEPLAY_SYSTEM_BARS_PLUGIN)) {
|
|
3208
3253
|
runNpmCommand(`npm install ${CODEPLAY_SYSTEM_BARS_PLUGIN}`);
|
|
3209
3254
|
return;
|
|
3210
3255
|
}
|
|
@@ -3381,7 +3426,7 @@ const syncAdmobNextgenPackage = () => {
|
|
|
3381
3426
|
console.log("ℹ️ emi-indo-cordova-plugin-admob is not installed.");
|
|
3382
3427
|
}
|
|
3383
3428
|
|
|
3384
|
-
if (!getInstalledVersion("capacitor-admob-nextgen")) {
|
|
3429
|
+
if (!getInstalledVersion("capacitor-admob-nextgen")) {
|
|
3385
3430
|
runNpmCommand("npm install capacitor-admob-nextgen");
|
|
3386
3431
|
} else {
|
|
3387
3432
|
console.log("ℹ️ capacitor-admob-nextgen is already installed.");
|
|
@@ -3670,9 +3715,9 @@ const syncFirebaseAnalyticsPackages = () => {
|
|
|
3670
3715
|
const analyticsConfig = getAnalyticsConfig();
|
|
3671
3716
|
|
|
3672
3717
|
if (analyticsConfig.enabled) {
|
|
3673
|
-
// The native wrapper uses registerPlugin; Firebase's optional web SDK is
|
|
3674
|
-
// not required and its absence must not reinstall the native plugin.
|
|
3675
|
-
if (!getInstalledVersion("@capacitor-firebase/analytics")) {
|
|
3718
|
+
// The native wrapper uses registerPlugin; Firebase's optional web SDK is
|
|
3719
|
+
// not required and its absence must not reinstall the native plugin.
|
|
3720
|
+
if (!getInstalledVersion("@capacitor-firebase/analytics")) {
|
|
3676
3721
|
runNpmCommand("npm install @capacitor-firebase/analytics");
|
|
3677
3722
|
} else {
|
|
3678
3723
|
console.log("ℹ️ Firebase Analytics packages already installed.");
|
|
@@ -4098,7 +4143,7 @@ const syncRevenueCatIapSetup = () => {
|
|
|
4098
4143
|
let packageChanged = false;
|
|
4099
4144
|
|
|
4100
4145
|
if (revenueCatEnabledForCurrentStore) {
|
|
4101
|
-
if (!getInstalledVersion("@revenuecat/purchases-capacitor")) {
|
|
4146
|
+
if (!getInstalledVersion("@revenuecat/purchases-capacitor")) {
|
|
4102
4147
|
runNpmCommand("npm install @revenuecat/purchases-capacitor");
|
|
4103
4148
|
packageChanged = true;
|
|
4104
4149
|
} else {
|
|
@@ -4640,15 +4685,16 @@ async function main() {
|
|
|
4640
4685
|
buildPackage.scripts = buildScripts;
|
|
4641
4686
|
fs.writeFileSync(packageJsonPath, JSON.stringify(buildPackage, null, 2) + '\n');
|
|
4642
4687
|
}
|
|
4688
|
+
require('./splash-setup.cjs').syncSplashSetup(process.cwd());
|
|
4643
4689
|
validateThemeFolderLocation();
|
|
4644
4690
|
validateAndRestoreSignDetails();
|
|
4645
4691
|
ensureMandatoryCapacitorPlugins();
|
|
4646
4692
|
|
|
4647
4693
|
await loadPluginVersions(); // 🔥 NEW
|
|
4648
4694
|
await syncAgentInstructions();
|
|
4649
|
-
await checkPlugins();
|
|
4650
|
-
// Downloads may add a newer helper or source files containing legacy imports.
|
|
4651
|
-
await saveToGalleryAndSaveFileCheck_iOS();
|
|
4695
|
+
if (!skipOnlineVersionChecks) await checkPlugins();
|
|
4696
|
+
// Downloads may add a newer helper or source files containing legacy imports.
|
|
4697
|
+
await saveToGalleryAndSaveFileCheck_iOS();
|
|
4652
4698
|
|
|
4653
4699
|
await syncAdmobNextgenMigration();
|
|
4654
4700
|
syncCodeplaySystemBarsPackage();
|