codeplay-common 4.11.7 → 4.11.9
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 +100 -96
- package/LICENSE +21 -21
- package/README.md +229 -229
- package/RELEASE_NOTES.md +21 -17
- package/files/buildCodeplay/add-splash-screen.js +255 -255
- package/files/buildCodeplay/apk-store-builder.js +97 -97
- package/files/buildCodeplay/codeplayBeforeBuild.js +42 -45
- package/files/buildCodeplay/ensure-current-build.cjs +42 -42
- package/files/buildCodeplay/fix-onesignal-plugin.js +96 -96
- package/files/buildCodeplay/ios-emi-admob-modification.js +49 -49
- package/files/buildCodeplay/manifestModification.js +38 -38
- package/files/buildCodeplay/newly added.txt +89 -89
- package/files/buildCodeplay/packageidBaseModification.js +445 -445
- package/files/buildCodeplay/project-scripts.cjs +62 -62
- package/files/buildCodeplay/release-sync.config.json +4 -4
- package/files/buildCodeplay/remove-force-kotlin-disable.js +43 -43
- package/files/buildCodeplay/setSplashAnimation.js +226 -226
- package/files/buildCodeplay/sync-admob-nextgen.js +219 -219
- package/files/buildCodeplay/versions.json +27 -27
- package/files/finalrelease +1246 -1246
- package/files/generate-ai-promo-video.js +23 -23
- package/files/ionic.config.json +6 -6
- package/files/scripts-common/generate-baseline-profile.js +46 -46
- 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-image.js +4382 -4382
- package/files/take-screen-video.js +644 -644
- package/package.json +27 -27
- package/scripts/ensure-current-build.test.cjs +76 -76
- package/scripts/sync-files.js +113 -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
|
});
|
|
@@ -228,7 +228,7 @@ const { execSync } = require("child_process");
|
|
|
228
228
|
const { readFileSync } = require("fs");
|
|
229
229
|
const readline = require('readline');
|
|
230
230
|
|
|
231
|
-
//
|
|
231
|
+
// Complete asynchronous preparation before continuing the remaining build steps.
|
|
232
232
|
(async () => {
|
|
233
233
|
|
|
234
234
|
// Standalone builds default to Android on every host OS.
|
|
@@ -342,8 +342,9 @@ const ROOT_DIR = path.join(process.cwd(), "src");
|
|
|
342
342
|
|
|
343
343
|
function requireOrInstall(packageName) {
|
|
344
344
|
try {
|
|
345
|
-
|
|
345
|
+
require.resolve(packageName);
|
|
346
346
|
} catch (err) {
|
|
347
|
+
if (err.code !== 'MODULE_NOT_FOUND') throw err;
|
|
347
348
|
|
|
348
349
|
console.log(`📦 "${packageName}" not found. Installing automatically...`);
|
|
349
350
|
|
|
@@ -355,9 +356,9 @@ function requireOrInstall(packageName) {
|
|
|
355
356
|
process.exit(1);
|
|
356
357
|
}
|
|
357
358
|
|
|
358
|
-
// Try loading again
|
|
359
|
-
return require(packageName);
|
|
360
359
|
}
|
|
360
|
+
// Loading errors in an installed package must not trigger another install.
|
|
361
|
+
return require(packageName);
|
|
361
362
|
}
|
|
362
363
|
|
|
363
364
|
const AdmZip = requireOrInstall("adm-zip");
|
|
@@ -988,7 +989,6 @@ else {
|
|
|
988
989
|
const saveToGalleryAndSaveFileCheck_iOS = async () => {
|
|
989
990
|
|
|
990
991
|
const SOURCE_ROOT = path.resolve(process.cwd(), 'src');
|
|
991
|
-
const EXCLUDED_DIR = path.join(SOURCE_ROOT, 'js', 'Ads');
|
|
992
992
|
const ANDROID_MANIFEST_PATH = path.resolve(process.cwd(), 'android/app/src/main/AndroidManifest.xml');
|
|
993
993
|
|
|
994
994
|
|
|
@@ -998,7 +998,7 @@ const saveToGalleryAndSaveFileCheck_iOS = async () => {
|
|
|
998
998
|
const SAVE_FILE_REGEX = /^(.*[\/\\])?(saveToGalleryAndSaveAnyFile-\d+(?:\.\d+)*)(-ios)?(\.js)?([?#].*)?$/;
|
|
999
999
|
const pendingChanges = [];
|
|
1000
1000
|
|
|
1001
|
-
const ALLOWED_EXTENSIONS = ['.js', '.mjs', '.ts', '.f7'];
|
|
1001
|
+
const ALLOWED_EXTENSIONS = ['.js', '.mjs', '.cjs', '.ts', '.tsx', '.jsx', '.f7'];
|
|
1002
1002
|
const referencedVersions = new Set();
|
|
1003
1003
|
let aliasImportFound = false;
|
|
1004
1004
|
let hasForbiddenEditorImport = false;
|
|
@@ -1047,11 +1047,7 @@ function scanSourceFile(dir) {
|
|
|
1047
1047
|
*/
|
|
1048
1048
|
|
|
1049
1049
|
const baseName = path.basename(dir);
|
|
1050
|
-
const
|
|
1051
|
-
dir.startsWith(path.join(SOURCE_ROOT, folder) + path.sep)
|
|
1052
|
-
) || dir === path.join(SOURCE_ROOT, 'app.f7');
|
|
1053
|
-
const shouldCheckGallery = isGalleryScope && !dir.startsWith(EXCLUDED_DIR + path.sep)
|
|
1054
|
-
&& !dir.split(path.sep).includes('node_modules') && !SKIP_FILES.includes(baseName)
|
|
1050
|
+
const shouldCheckGallery = !dir.split(path.sep).includes('node_modules') && !SKIP_FILES.includes(baseName)
|
|
1055
1051
|
&& ALLOWED_EXTENSIONS.some(ext => dir.endsWith(ext));
|
|
1056
1052
|
const shouldCheckEditor = /\.(js|ts|f7)$/.test(dir);
|
|
1057
1053
|
const shouldCheckOneSignal = /\.(js|mjs|cjs|ts|tsx|jsx|f7)$/.test(dir);
|
|
@@ -1072,7 +1068,21 @@ function scanSourceFile(dir) {
|
|
|
1072
1068
|
}
|
|
1073
1069
|
}
|
|
1074
1070
|
|
|
1075
|
-
|
|
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) =>
|
|
1076
1086
|
quote ? match : match.replace(/[^\r\n]/g, ' ')
|
|
1077
1087
|
);
|
|
1078
1088
|
const replacements = [];
|
|
@@ -1135,20 +1145,14 @@ if (referencedVersions.size || aliasImportFound) {
|
|
|
1135
1145
|
if (aliasImportFound && aliasMatch) {
|
|
1136
1146
|
const existingName = path.basename(aliasMatch[3]).match(SAVE_FILE_REGEX);
|
|
1137
1147
|
if (!existingName) throw new Error('❌ @saveGallery must point to a versioned saveToGalleryAndSaveAnyFile helper.');
|
|
1138
|
-
referencedVersions.add(existingName[2]);
|
|
1139
1148
|
}
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
}
|
|
1147
|
-
if (referencedVersions.size !== 1) {
|
|
1148
|
-
throw new Error(`❌ @saveGallery cannot represent multiple helper versions: ${[...referencedVersions].join(', ')}. Align them before building.`);
|
|
1149
|
-
}
|
|
1150
|
-
const baseName = [...referencedVersions][0];
|
|
1151
|
-
const targetRelativePath = `./src/js/${baseName}${isIOSBuild ? '-ios' : ''}.js`;
|
|
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}`;
|
|
1152
1156
|
const targetPath = path.resolve(path.dirname(viteConfigPath), targetRelativePath);
|
|
1153
1157
|
if (!fs.existsSync(targetPath)) throw new Error(`❌ Cannot configure @saveGallery: target file does not exist: ${targetPath}`);
|
|
1154
1158
|
const aliasEntry = `'@saveGallery': path.resolve(__dirname, '${targetRelativePath}')`;
|
|
@@ -1191,22 +1195,10 @@ if (pendingChanges.length) {
|
|
|
1191
1195
|
}
|
|
1192
1196
|
}
|
|
1193
1197
|
|
|
1194
|
-
|
|
1195
|
-
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
1196
|
-
rl.on('close', () => resolve(false));
|
|
1197
|
-
rl.on('SIGINT', () => { resolve(false); rl.close(); });
|
|
1198
|
-
rl.question('\nPress Enter or type y to apply these changes and continue; any other answer cancels: ', answer => {
|
|
1199
|
-
const normalizedAnswer = answer.trim().toLowerCase();
|
|
1200
|
-
resolve(normalizedAnswer === '' || normalizedAnswer === 'y');
|
|
1201
|
-
rl.close();
|
|
1202
|
-
});
|
|
1203
|
-
});
|
|
1204
|
-
if (!confirmed) throw new Error('❌ Build cancelled. No import filenames were changed.');
|
|
1205
|
-
|
|
1206
|
-
// Check every source again before writing so edits made while awaiting confirmation are preserved.
|
|
1198
|
+
// Validate all pending edits before applying the automatic migration.
|
|
1207
1199
|
for (const change of pendingChanges) {
|
|
1208
1200
|
if (fs.readFileSync(change.filePath, 'utf8') !== change.content) {
|
|
1209
|
-
throw new Error(`❌ Source changed
|
|
1201
|
+
throw new Error(`❌ Source changed during alias migration: ${change.filePath}. Build cancelled; run it again.`);
|
|
1210
1202
|
}
|
|
1211
1203
|
}
|
|
1212
1204
|
for (const change of pendingChanges) {
|
|
@@ -2479,6 +2471,7 @@ if (pluginDef.isFolder) {
|
|
|
2479
2471
|
updateImports(pluginInfo.name, `${baseName}-${latestVersion}`);
|
|
2480
2472
|
|
|
2481
2473
|
fs.rmSync(oldPath, { recursive: true, force: true });
|
|
2474
|
+
sourceFileInventory = null; // updateImports cached files from the removed folder.
|
|
2482
2475
|
// ✅ ADD THIS
|
|
2483
2476
|
writeUpdateLine(`${pluginInfo.name} -> ${baseName}-${latestVersion}`);
|
|
2484
2477
|
|
|
@@ -2554,6 +2547,7 @@ existingFiles.forEach(file => {
|
|
|
2554
2547
|
const oldPath = path.join(pluginDir, file);
|
|
2555
2548
|
|
|
2556
2549
|
fs.unlinkSync(oldPath);
|
|
2550
|
+
sourceFileInventory = null;
|
|
2557
2551
|
|
|
2558
2552
|
console.log(`🗑 Removed old file → ${file}`);
|
|
2559
2553
|
//writeUpdateLine(`Removed old file: ${file}`);
|
|
@@ -3185,8 +3179,7 @@ function ensureMandatoryCapacitorPlugins() {
|
|
|
3185
3179
|
];
|
|
3186
3180
|
|
|
3187
3181
|
for (const packageName of requiredPackages) {
|
|
3188
|
-
|
|
3189
|
-
if (isPackageAvailable(packageName) && fs.existsSync(installedPackagePath)) {
|
|
3182
|
+
if (getInstalledVersion(packageName)) {
|
|
3190
3183
|
console.log(`ℹ️ ${packageName} is already installed.`);
|
|
3191
3184
|
continue;
|
|
3192
3185
|
}
|
|
@@ -3211,7 +3204,7 @@ const syncCodeplaySystemBarsPackage = () => {
|
|
|
3211
3204
|
return;
|
|
3212
3205
|
}
|
|
3213
3206
|
|
|
3214
|
-
if (!
|
|
3207
|
+
if (!getInstalledVersion(CODEPLAY_SYSTEM_BARS_PLUGIN)) {
|
|
3215
3208
|
runNpmCommand(`npm install ${CODEPLAY_SYSTEM_BARS_PLUGIN}`);
|
|
3216
3209
|
return;
|
|
3217
3210
|
}
|
|
@@ -3388,7 +3381,7 @@ const syncAdmobNextgenPackage = () => {
|
|
|
3388
3381
|
console.log("ℹ️ emi-indo-cordova-plugin-admob is not installed.");
|
|
3389
3382
|
}
|
|
3390
3383
|
|
|
3391
|
-
if (!
|
|
3384
|
+
if (!getInstalledVersion("capacitor-admob-nextgen")) {
|
|
3392
3385
|
runNpmCommand("npm install capacitor-admob-nextgen");
|
|
3393
3386
|
} else {
|
|
3394
3387
|
console.log("ℹ️ capacitor-admob-nextgen is already installed.");
|
|
@@ -3677,7 +3670,9 @@ const syncFirebaseAnalyticsPackages = () => {
|
|
|
3677
3670
|
const analyticsConfig = getAnalyticsConfig();
|
|
3678
3671
|
|
|
3679
3672
|
if (analyticsConfig.enabled) {
|
|
3680
|
-
|
|
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")) {
|
|
3681
3676
|
runNpmCommand("npm install @capacitor-firebase/analytics");
|
|
3682
3677
|
} else {
|
|
3683
3678
|
console.log("ℹ️ Firebase Analytics packages already installed.");
|
|
@@ -4103,7 +4098,7 @@ const syncRevenueCatIapSetup = () => {
|
|
|
4103
4098
|
let packageChanged = false;
|
|
4104
4099
|
|
|
4105
4100
|
if (revenueCatEnabledForCurrentStore) {
|
|
4106
|
-
if (!
|
|
4101
|
+
if (!getInstalledVersion("@revenuecat/purchases-capacitor")) {
|
|
4107
4102
|
runNpmCommand("npm install @revenuecat/purchases-capacitor");
|
|
4108
4103
|
packageChanged = true;
|
|
4109
4104
|
} else {
|
|
@@ -4652,6 +4647,8 @@ async function main() {
|
|
|
4652
4647
|
await loadPluginVersions(); // 🔥 NEW
|
|
4653
4648
|
await syncAgentInstructions();
|
|
4654
4649
|
await checkPlugins();
|
|
4650
|
+
// Downloads may add a newer helper or source files containing legacy imports.
|
|
4651
|
+
await saveToGalleryAndSaveFileCheck_iOS();
|
|
4655
4652
|
|
|
4656
4653
|
await syncAdmobNextgenMigration();
|
|
4657
4654
|
syncCodeplaySystemBarsPackage();
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const { execSync, execFileSync } = require('child_process');
|
|
4
|
-
|
|
5
|
-
function findVersionedBuildFiles(projectRoot) {
|
|
6
|
-
const directory = path.join(projectRoot, 'buildCodeplay');
|
|
7
|
-
if (!fs.existsSync(directory)) return [];
|
|
8
|
-
return fs.readdirSync(directory, { withFileTypes: true })
|
|
9
|
-
.filter(entry => entry.isFile() && /-\d+(?:\.\d+)*(?:-beta-\d+)?\.[^.]+$/i.test(entry.name))
|
|
10
|
-
.map(entry => entry.name);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
function ensureCurrentBuild(options = {}) {
|
|
14
|
-
const projectRoot = path.resolve(options.projectRoot || process.cwd());
|
|
15
|
-
const legacyFiles = findVersionedBuildFiles(projectRoot);
|
|
16
|
-
if (!legacyFiles.length) return false;
|
|
17
|
-
|
|
18
|
-
console.log(`Legacy buildCodeplay files found: ${legacyFiles.join(', ')}. Reinstalling codeplay-common before continuing.`);
|
|
19
|
-
const runNpm = options.runNpm || (command => execSync(command, { cwd: projectRoot, stdio: 'inherit' }));
|
|
20
|
-
runNpm('npm uninstall codeplay-common');
|
|
21
|
-
runNpm('npm install codeplay-common');
|
|
22
|
-
|
|
23
|
-
// Postinstall replaces the scripts and removes recognized legacy files.
|
|
24
|
-
// Do not run stale code or retry indefinitely if migration did not finish.
|
|
25
|
-
const remaining = findVersionedBuildFiles(projectRoot);
|
|
26
|
-
if (remaining.length) {
|
|
27
|
-
throw new Error(`Legacy buildCodeplay files remain after reinstall: ${remaining.join(', ')}. Build stopped; migrate these files before retrying.`);
|
|
28
|
-
}
|
|
29
|
-
const entrypoint = path.join(projectRoot, 'buildCodeplay', 'codeplayBeforeBuild.js');
|
|
30
|
-
if (!fs.existsSync(entrypoint)) throw new Error('codeplayBeforeBuild.js is missing after reinstall. Build stopped.');
|
|
31
|
-
|
|
32
|
-
// The current process loaded the old templates. Finish preparation in a fresh
|
|
33
|
-
// process before the caller's remaining build commands are allowed to run.
|
|
34
|
-
const runBeforeBuild = options.runBeforeBuild || (script => execFileSync(process.execPath, [script, ...process.argv.slice(2)], {
|
|
35
|
-
cwd: projectRoot,
|
|
36
|
-
stdio: 'inherit',
|
|
37
|
-
}));
|
|
38
|
-
runBeforeBuild(entrypoint);
|
|
39
|
-
return true;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
module.exports = { ensureCurrentBuild, findVersionedBuildFiles };
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const { execSync, execFileSync } = require('child_process');
|
|
4
|
+
|
|
5
|
+
function findVersionedBuildFiles(projectRoot) {
|
|
6
|
+
const directory = path.join(projectRoot, 'buildCodeplay');
|
|
7
|
+
if (!fs.existsSync(directory)) return [];
|
|
8
|
+
return fs.readdirSync(directory, { withFileTypes: true })
|
|
9
|
+
.filter(entry => entry.isFile() && /-\d+(?:\.\d+)*(?:-beta-\d+)?\.[^.]+$/i.test(entry.name))
|
|
10
|
+
.map(entry => entry.name);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function ensureCurrentBuild(options = {}) {
|
|
14
|
+
const projectRoot = path.resolve(options.projectRoot || process.cwd());
|
|
15
|
+
const legacyFiles = findVersionedBuildFiles(projectRoot);
|
|
16
|
+
if (!legacyFiles.length) return false;
|
|
17
|
+
|
|
18
|
+
console.log(`Legacy buildCodeplay files found: ${legacyFiles.join(', ')}. Reinstalling codeplay-common before continuing.`);
|
|
19
|
+
const runNpm = options.runNpm || (command => execSync(command, { cwd: projectRoot, stdio: 'inherit' }));
|
|
20
|
+
runNpm('npm uninstall codeplay-common');
|
|
21
|
+
runNpm('npm install codeplay-common');
|
|
22
|
+
|
|
23
|
+
// Postinstall replaces the scripts and removes recognized legacy files.
|
|
24
|
+
// Do not run stale code or retry indefinitely if migration did not finish.
|
|
25
|
+
const remaining = findVersionedBuildFiles(projectRoot);
|
|
26
|
+
if (remaining.length) {
|
|
27
|
+
throw new Error(`Legacy buildCodeplay files remain after reinstall: ${remaining.join(', ')}. Build stopped; migrate these files before retrying.`);
|
|
28
|
+
}
|
|
29
|
+
const entrypoint = path.join(projectRoot, 'buildCodeplay', 'codeplayBeforeBuild.js');
|
|
30
|
+
if (!fs.existsSync(entrypoint)) throw new Error('codeplayBeforeBuild.js is missing after reinstall. Build stopped.');
|
|
31
|
+
|
|
32
|
+
// The current process loaded the old templates. Finish preparation in a fresh
|
|
33
|
+
// process before the caller's remaining build commands are allowed to run.
|
|
34
|
+
const runBeforeBuild = options.runBeforeBuild || (script => execFileSync(process.execPath, [script, ...process.argv.slice(2)], {
|
|
35
|
+
cwd: projectRoot,
|
|
36
|
+
stdio: 'inherit',
|
|
37
|
+
}));
|
|
38
|
+
runBeforeBuild(entrypoint);
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
module.exports = { ensureCurrentBuild, findVersionedBuildFiles };
|