codeplay-common 4.11.6 → 4.11.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/CHANGELOG.md +99 -96
- package/LICENSE +21 -21
- package/README.md +229 -229
- package/RELEASE_NOTES.md +20 -17
- package/files/buildCodeplay/add-splash-screen.js +255 -255
- package/files/buildCodeplay/apk-store-builder.js +97 -97
- package/files/buildCodeplay/codeplayBeforeBuild.js +40 -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 -4352
- 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) {
|
|
@@ -3185,8 +3177,7 @@ function ensureMandatoryCapacitorPlugins() {
|
|
|
3185
3177
|
];
|
|
3186
3178
|
|
|
3187
3179
|
for (const packageName of requiredPackages) {
|
|
3188
|
-
|
|
3189
|
-
if (isPackageAvailable(packageName) && fs.existsSync(installedPackagePath)) {
|
|
3180
|
+
if (getInstalledVersion(packageName)) {
|
|
3190
3181
|
console.log(`ℹ️ ${packageName} is already installed.`);
|
|
3191
3182
|
continue;
|
|
3192
3183
|
}
|
|
@@ -3211,7 +3202,7 @@ const syncCodeplaySystemBarsPackage = () => {
|
|
|
3211
3202
|
return;
|
|
3212
3203
|
}
|
|
3213
3204
|
|
|
3214
|
-
if (!
|
|
3205
|
+
if (!getInstalledVersion(CODEPLAY_SYSTEM_BARS_PLUGIN)) {
|
|
3215
3206
|
runNpmCommand(`npm install ${CODEPLAY_SYSTEM_BARS_PLUGIN}`);
|
|
3216
3207
|
return;
|
|
3217
3208
|
}
|
|
@@ -3388,7 +3379,7 @@ const syncAdmobNextgenPackage = () => {
|
|
|
3388
3379
|
console.log("ℹ️ emi-indo-cordova-plugin-admob is not installed.");
|
|
3389
3380
|
}
|
|
3390
3381
|
|
|
3391
|
-
if (!
|
|
3382
|
+
if (!getInstalledVersion("capacitor-admob-nextgen")) {
|
|
3392
3383
|
runNpmCommand("npm install capacitor-admob-nextgen");
|
|
3393
3384
|
} else {
|
|
3394
3385
|
console.log("ℹ️ capacitor-admob-nextgen is already installed.");
|
|
@@ -3677,7 +3668,9 @@ const syncFirebaseAnalyticsPackages = () => {
|
|
|
3677
3668
|
const analyticsConfig = getAnalyticsConfig();
|
|
3678
3669
|
|
|
3679
3670
|
if (analyticsConfig.enabled) {
|
|
3680
|
-
|
|
3671
|
+
// The native wrapper uses registerPlugin; Firebase's optional web SDK is
|
|
3672
|
+
// not required and its absence must not reinstall the native plugin.
|
|
3673
|
+
if (!getInstalledVersion("@capacitor-firebase/analytics")) {
|
|
3681
3674
|
runNpmCommand("npm install @capacitor-firebase/analytics");
|
|
3682
3675
|
} else {
|
|
3683
3676
|
console.log("ℹ️ Firebase Analytics packages already installed.");
|
|
@@ -4103,7 +4096,7 @@ const syncRevenueCatIapSetup = () => {
|
|
|
4103
4096
|
let packageChanged = false;
|
|
4104
4097
|
|
|
4105
4098
|
if (revenueCatEnabledForCurrentStore) {
|
|
4106
|
-
if (!
|
|
4099
|
+
if (!getInstalledVersion("@revenuecat/purchases-capacitor")) {
|
|
4107
4100
|
runNpmCommand("npm install @revenuecat/purchases-capacitor");
|
|
4108
4101
|
packageChanged = true;
|
|
4109
4102
|
} else {
|
|
@@ -4652,6 +4645,8 @@ async function main() {
|
|
|
4652
4645
|
await loadPluginVersions(); // 🔥 NEW
|
|
4653
4646
|
await syncAgentInstructions();
|
|
4654
4647
|
await checkPlugins();
|
|
4648
|
+
// Downloads may add a newer helper or source files containing legacy imports.
|
|
4649
|
+
await saveToGalleryAndSaveFileCheck_iOS();
|
|
4655
4650
|
|
|
4656
4651
|
await syncAdmobNextgenMigration();
|
|
4657
4652
|
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 };
|
|
@@ -1,97 +1,97 @@
|
|
|
1
|
-
const fs = require("fs");
|
|
2
|
-
const path = require("path");
|
|
3
|
-
|
|
4
|
-
const pluginPath = path.join(
|
|
5
|
-
__dirname,
|
|
6
|
-
"..",
|
|
7
|
-
"node_modules",
|
|
8
|
-
"onesignal-cordova-plugin",
|
|
9
|
-
"plugin.xml"
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
if (!fs.existsSync(pluginPath)) {
|
|
13
|
-
console.log("OneSignal plugin not found, skipping patch.");
|
|
14
|
-
process.exit(0);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
console.log("OneSignal plugin patch started.");
|
|
18
|
-
|
|
19
|
-
let content = fs.readFileSync(pluginPath, "utf8");
|
|
20
|
-
|
|
21
|
-
/* ---- Prevent running twice ---- */
|
|
22
|
-
if (content.includes("buildCodeplay/fix-onesignal-plugin.js")) {
|
|
23
|
-
console.log("OneSignal plugin already patched.");
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
else{
|
|
27
|
-
/* ---- Comment Kotlin dependency ---- */
|
|
28
|
-
content = content.replace(
|
|
29
|
-
'<framework src="org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.10" />',
|
|
30
|
-
`<!-- Disabled: causes Kotlin version conflict with modern Gradle/Kotlin -->
|
|
31
|
-
<!-- <framework src="org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.10" /> -->`
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
/* ---- Add dependencies ---- */
|
|
35
|
-
content = content.replace(
|
|
36
|
-
'<framework src="build-extras-onesignal.gradle" custom="true" type="gradleReference" />',
|
|
37
|
-
`<framework src="build-extras-onesignal.gradle" custom="true" type="gradleReference" />
|
|
38
|
-
|
|
39
|
-
<!--Newly added content through buildCodeplay/fix-onesignal-plugin.js Start-->
|
|
40
|
-
<framework src="com.fasterxml.jackson.core:jackson-core:2.17.2" />
|
|
41
|
-
<framework src="com.google.auto.value:auto-value-annotations:1.11.0" scope="provided" />
|
|
42
|
-
<!--Newly added content through buildCodeplay/fix-onesignal-plugin.js End-->`
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
fs.writeFileSync(pluginPath, content);
|
|
46
|
-
|
|
47
|
-
console.log("OneSignal plugin patched successfully.");
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
//#################### ADD THE PROPER ONESIGNAL PERMISSIN TO INFO.PLIST START ###########################
|
|
58
|
-
|
|
59
|
-
const iosPlistPath = path.join(
|
|
60
|
-
__dirname,
|
|
61
|
-
"..",
|
|
62
|
-
"ios",
|
|
63
|
-
"App",
|
|
64
|
-
"App",
|
|
65
|
-
"Info.plist"
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
console.log(iosPlistPath)
|
|
69
|
-
|
|
70
|
-
if (fs.existsSync(iosPlistPath)) {
|
|
71
|
-
|
|
72
|
-
let plist = fs.readFileSync(iosPlistPath, "utf8");
|
|
73
|
-
|
|
74
|
-
const insertBlock = `
|
|
75
|
-
<key>UIBackgroundModes</key>
|
|
76
|
-
<array>
|
|
77
|
-
<string>remote-notification</string>
|
|
78
|
-
</array>
|
|
79
|
-
`;
|
|
80
|
-
|
|
81
|
-
if (!plist.includes("UIBackgroundModes")) {
|
|
82
|
-
const lastIndex = plist.lastIndexOf("</dict>");
|
|
83
|
-
|
|
84
|
-
plist =
|
|
85
|
-
plist.slice(0, lastIndex) +
|
|
86
|
-
insertBlock +
|
|
87
|
-
"\n" +
|
|
88
|
-
plist.slice(lastIndex);
|
|
89
|
-
|
|
90
|
-
console.log("Inserted UIBackgroundModes correctly.");
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
fs.writeFileSync(iosPlistPath, plist);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
|
|
1
|
+
const fs = require("fs");
|
|
2
|
+
const path = require("path");
|
|
3
|
+
|
|
4
|
+
const pluginPath = path.join(
|
|
5
|
+
__dirname,
|
|
6
|
+
"..",
|
|
7
|
+
"node_modules",
|
|
8
|
+
"onesignal-cordova-plugin",
|
|
9
|
+
"plugin.xml"
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
if (!fs.existsSync(pluginPath)) {
|
|
13
|
+
console.log("OneSignal plugin not found, skipping patch.");
|
|
14
|
+
process.exit(0);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
console.log("OneSignal plugin patch started.");
|
|
18
|
+
|
|
19
|
+
let content = fs.readFileSync(pluginPath, "utf8");
|
|
20
|
+
|
|
21
|
+
/* ---- Prevent running twice ---- */
|
|
22
|
+
if (content.includes("buildCodeplay/fix-onesignal-plugin.js")) {
|
|
23
|
+
console.log("OneSignal plugin already patched.");
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
else{
|
|
27
|
+
/* ---- Comment Kotlin dependency ---- */
|
|
28
|
+
content = content.replace(
|
|
29
|
+
'<framework src="org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.10" />',
|
|
30
|
+
`<!-- Disabled: causes Kotlin version conflict with modern Gradle/Kotlin -->
|
|
31
|
+
<!-- <framework src="org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.7.10" /> -->`
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
/* ---- Add dependencies ---- */
|
|
35
|
+
content = content.replace(
|
|
36
|
+
'<framework src="build-extras-onesignal.gradle" custom="true" type="gradleReference" />',
|
|
37
|
+
`<framework src="build-extras-onesignal.gradle" custom="true" type="gradleReference" />
|
|
38
|
+
|
|
39
|
+
<!--Newly added content through buildCodeplay/fix-onesignal-plugin.js Start-->
|
|
40
|
+
<framework src="com.fasterxml.jackson.core:jackson-core:2.17.2" />
|
|
41
|
+
<framework src="com.google.auto.value:auto-value-annotations:1.11.0" scope="provided" />
|
|
42
|
+
<!--Newly added content through buildCodeplay/fix-onesignal-plugin.js End-->`
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
fs.writeFileSync(pluginPath, content);
|
|
46
|
+
|
|
47
|
+
console.log("OneSignal plugin patched successfully.");
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
//#################### ADD THE PROPER ONESIGNAL PERMISSIN TO INFO.PLIST START ###########################
|
|
58
|
+
|
|
59
|
+
const iosPlistPath = path.join(
|
|
60
|
+
__dirname,
|
|
61
|
+
"..",
|
|
62
|
+
"ios",
|
|
63
|
+
"App",
|
|
64
|
+
"App",
|
|
65
|
+
"Info.plist"
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
console.log(iosPlistPath)
|
|
69
|
+
|
|
70
|
+
if (fs.existsSync(iosPlistPath)) {
|
|
71
|
+
|
|
72
|
+
let plist = fs.readFileSync(iosPlistPath, "utf8");
|
|
73
|
+
|
|
74
|
+
const insertBlock = `
|
|
75
|
+
<key>UIBackgroundModes</key>
|
|
76
|
+
<array>
|
|
77
|
+
<string>remote-notification</string>
|
|
78
|
+
</array>
|
|
79
|
+
`;
|
|
80
|
+
|
|
81
|
+
if (!plist.includes("UIBackgroundModes")) {
|
|
82
|
+
const lastIndex = plist.lastIndexOf("</dict>");
|
|
83
|
+
|
|
84
|
+
plist =
|
|
85
|
+
plist.slice(0, lastIndex) +
|
|
86
|
+
insertBlock +
|
|
87
|
+
"\n" +
|
|
88
|
+
plist.slice(lastIndex);
|
|
89
|
+
|
|
90
|
+
console.log("Inserted UIBackgroundModes correctly.");
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
fs.writeFileSync(iosPlistPath, plist);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
|
|
97
97
|
//#################### ADD THE PROPER ONESIGNAL PERMISSIN TO INFO.PLIST END ###########################
|