codeplay-common 4.0.2 → 4.0.3
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 +2 -2
- package/LICENSE +21 -21
- package/README.md +29 -25
- package/files/buildCodeplay/codeplayBeforeBuild-6.1.js +292 -292
- package/files/buildCodeplay/ios-emi-admob-modification.js +25 -25
- package/files/buildCodeplay/manifestModification.js +12 -12
- package/files/buildCodeplay/newly added.txt +89 -89
- package/files/buildCodeplay/remove-force-kotlin-disable.js +43 -43
- package/files/buildCodeplay/versions.json +2 -2
- package/files/finalrelease +944 -951
- package/files/iap-install-2.js +145 -145
- package/files/ionic.config.json +6 -6
- package/files/scripts/setup-baseline-profile.js +241 -241
- package/package.json +16 -16
- package/scripts/sync-files.js +105 -105
- package/scripts/uninstall.js +104 -104
|
@@ -11,12 +11,12 @@ const { execSync } = require("child_process");
|
|
|
11
11
|
|
|
12
12
|
const { readFileSync } = require("fs");
|
|
13
13
|
|
|
14
|
-
const ENABLE_AUTO_UPDATE = true;
|
|
15
|
-
const USE_LIVE_SERVER_VERSION = true;
|
|
16
|
-
|
|
17
|
-
const configPath = path.join(process.cwd(), 'capacitor.config.json');
|
|
18
|
-
const packageJsonPath = path.join(process.cwd(), 'package.json');
|
|
19
|
-
const updateLogFile = path.join(process.cwd(), "", "plugin-update-log.txt");
|
|
14
|
+
const ENABLE_AUTO_UPDATE = true;
|
|
15
|
+
const USE_LIVE_SERVER_VERSION = true;
|
|
16
|
+
|
|
17
|
+
const configPath = path.join(process.cwd(), 'capacitor.config.json');
|
|
18
|
+
const packageJsonPath = path.join(process.cwd(), 'package.json');
|
|
19
|
+
const updateLogFile = path.join(process.cwd(), "", "plugin-update-log.txt");
|
|
20
20
|
|
|
21
21
|
// Expected plugin list with minimum versions
|
|
22
22
|
/* const requiredPlugins = [
|
|
@@ -1107,10 +1107,10 @@ let _admobConfig;
|
|
|
1107
1107
|
|
|
1108
1108
|
|
|
1109
1109
|
|
|
1110
|
-
const androidPlatformPath = path.join(process.cwd(), 'android');
|
|
1111
|
-
const iosPlatformPath = path.join(process.cwd(), 'ios');
|
|
1112
|
-
const androidManifestPath = path.join(process.cwd(), 'android', 'app', 'src', 'main', 'AndroidManifest.xml');
|
|
1113
|
-
const infoPlistPath = path.join(process.cwd(), 'ios', 'App', 'App', 'Info.plist');
|
|
1110
|
+
const androidPlatformPath = path.join(process.cwd(), 'android');
|
|
1111
|
+
const iosPlatformPath = path.join(process.cwd(), 'ios');
|
|
1112
|
+
const androidManifestPath = path.join(process.cwd(), 'android', 'app', 'src', 'main', 'AndroidManifest.xml');
|
|
1113
|
+
const infoPlistPath = path.join(process.cwd(), 'ios', 'App', 'App', 'Info.plist');
|
|
1114
1114
|
const resourcesPath = path.join(process.cwd(), 'resources', 'res');
|
|
1115
1115
|
const androidResPath = path.join(process.cwd(), 'android', 'app', 'src', 'main', 'res');
|
|
1116
1116
|
const localNotificationsPluginPath = path.join(process.cwd(), 'node_modules', '@capacitor', 'local-notifications');
|
|
@@ -1156,112 +1156,112 @@ function checkAndCopyResources() {
|
|
|
1156
1156
|
|
|
1157
1157
|
|
|
1158
1158
|
|
|
1159
|
-
function getAdMobConfig() {
|
|
1160
|
-
if (!fileExists(configPath)) {
|
|
1161
|
-
throw new Error('❌ capacitor.config.json not found. Ensure this is a Capacitor project.');
|
|
1162
|
-
}
|
|
1163
|
-
|
|
1164
|
-
const capacitorConfig = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
1165
|
-
const packageJson = fileExists(packageJsonPath)
|
|
1166
|
-
? JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'))
|
|
1167
|
-
: {};
|
|
1168
|
-
|
|
1169
|
-
const legacyAdmobConfig = capacitorConfig.plugins?.AdMob || {};
|
|
1170
|
-
const nextGenAdmobConfig = packageJson.admob || {};
|
|
1171
|
-
|
|
1172
|
-
if (!legacyAdmobConfig && !nextGenAdmobConfig) {
|
|
1173
|
-
throw new Error('❌ AdMob configuration is missing in package.json or capacitor.config.json.');
|
|
1174
|
-
}
|
|
1175
|
-
|
|
1176
|
-
const isEnabled =
|
|
1177
|
-
nextGenAdmobConfig.enabled !== false &&
|
|
1178
|
-
legacyAdmobConfig.ADMOB_ENABLED !== false;
|
|
1179
|
-
|
|
1180
|
-
if (!isEnabled) {
|
|
1181
|
-
return { ADMOB_ENABLED: false };
|
|
1182
|
-
}
|
|
1183
|
-
|
|
1184
|
-
const androidAppId = nextGenAdmobConfig.androidAppId || legacyAdmobConfig.APP_ID_ANDROID;
|
|
1185
|
-
const iosAppId = nextGenAdmobConfig.iosAppId || legacyAdmobConfig.APP_ID_IOS;
|
|
1186
|
-
const userTrackingDescription =
|
|
1187
|
-
nextGenAdmobConfig.userTrackingDescription ||
|
|
1188
|
-
legacyAdmobConfig.USER_TRACKING_DESCRIPTION ||
|
|
1189
|
-
'This identifier will be used to deliver personalized ads to you.';
|
|
1190
|
-
|
|
1191
|
-
if (!androidAppId || !iosAppId) {
|
|
1192
|
-
throw new Error(' ❌ AdMob configuration is incomplete. Ensure androidAppId/iosAppId or APP_ID_ANDROID/APP_ID_IOS are defined.');
|
|
1193
|
-
}
|
|
1194
|
-
|
|
1195
|
-
return {
|
|
1196
|
-
ADMOB_ENABLED: true,
|
|
1197
|
-
APP_ID_ANDROID: androidAppId,
|
|
1198
|
-
APP_ID_IOS: iosAppId,
|
|
1199
|
-
USER_TRACKING_DESCRIPTION: userTrackingDescription,
|
|
1200
|
-
USE_LITE_ADS: legacyAdmobConfig.USE_LITE_ADS === "lite",
|
|
1201
|
-
};
|
|
1202
|
-
}
|
|
1203
|
-
|
|
1204
|
-
function syncNextGenAdmobPackageJsonFromCapacitorConfig() {
|
|
1205
|
-
if (!fileExists(configPath) || !fileExists(packageJsonPath)) {
|
|
1206
|
-
return;
|
|
1207
|
-
}
|
|
1208
|
-
|
|
1209
|
-
const capacitorConfig = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
1210
|
-
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
1211
|
-
|
|
1212
|
-
const legacyAdmobConfig = capacitorConfig.plugins?.AdMob || {};
|
|
1213
|
-
const androidAppId = legacyAdmobConfig.APP_ID_ANDROID;
|
|
1214
|
-
const iosAppId = legacyAdmobConfig.APP_ID_IOS;
|
|
1215
|
-
|
|
1216
|
-
if (!androidAppId || !iosAppId) {
|
|
1217
|
-
return;
|
|
1218
|
-
}
|
|
1219
|
-
|
|
1220
|
-
const desiredAdmobConfig = {
|
|
1221
|
-
androidAppId,
|
|
1222
|
-
iosAppId,
|
|
1223
|
-
enableNativeAds: {
|
|
1224
|
-
ios: packageJson.admob?.enableNativeAds?.ios ?? true,
|
|
1225
|
-
android: packageJson.admob?.enableNativeAds?.android ?? true,
|
|
1226
|
-
},
|
|
1227
|
-
userTrackingDescription:
|
|
1228
|
-
packageJson.admob?.userTrackingDescription ||
|
|
1229
|
-
'This identifier will be used to deliver personalized ads to you.',
|
|
1230
|
-
};
|
|
1231
|
-
|
|
1232
|
-
const existingAdmobConfig = packageJson.admob || {};
|
|
1233
|
-
const mergedAdmobConfig = { ...existingAdmobConfig };
|
|
1234
|
-
let updated = false;
|
|
1235
|
-
|
|
1236
|
-
const syncKeyByKey = (target, source) => {
|
|
1237
|
-
for (const [key, value] of Object.entries(source)) {
|
|
1238
|
-
if (value && typeof value === 'object' && !Array.isArray(value)) {
|
|
1239
|
-
if (!target[key] || typeof target[key] !== 'object' || Array.isArray(target[key])) {
|
|
1240
|
-
target[key] = {};
|
|
1241
|
-
updated = true;
|
|
1242
|
-
}
|
|
1243
|
-
|
|
1244
|
-
syncKeyByKey(target[key], value);
|
|
1245
|
-
continue;
|
|
1246
|
-
}
|
|
1247
|
-
|
|
1248
|
-
if (target[key] !== value) {
|
|
1249
|
-
target[key] = value;
|
|
1250
|
-
updated = true;
|
|
1251
|
-
}
|
|
1252
|
-
}
|
|
1253
|
-
};
|
|
1254
|
-
|
|
1255
|
-
syncKeyByKey(mergedAdmobConfig, desiredAdmobConfig);
|
|
1256
|
-
|
|
1257
|
-
if (!updated) {
|
|
1258
|
-
return;
|
|
1259
|
-
}
|
|
1260
|
-
|
|
1261
|
-
packageJson.admob = mergedAdmobConfig;
|
|
1262
|
-
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\n', 'utf8');
|
|
1263
|
-
console.log('✅ package.json AdMob settings synced from capacitor.config.json');
|
|
1264
|
-
}
|
|
1159
|
+
function getAdMobConfig() {
|
|
1160
|
+
if (!fileExists(configPath)) {
|
|
1161
|
+
throw new Error('❌ capacitor.config.json not found. Ensure this is a Capacitor project.');
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
const capacitorConfig = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
1165
|
+
const packageJson = fileExists(packageJsonPath)
|
|
1166
|
+
? JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'))
|
|
1167
|
+
: {};
|
|
1168
|
+
|
|
1169
|
+
const legacyAdmobConfig = capacitorConfig.plugins?.AdMob || {};
|
|
1170
|
+
const nextGenAdmobConfig = packageJson.admob || {};
|
|
1171
|
+
|
|
1172
|
+
if (!legacyAdmobConfig && !nextGenAdmobConfig) {
|
|
1173
|
+
throw new Error('❌ AdMob configuration is missing in package.json or capacitor.config.json.');
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
const isEnabled =
|
|
1177
|
+
nextGenAdmobConfig.enabled !== false &&
|
|
1178
|
+
legacyAdmobConfig.ADMOB_ENABLED !== false;
|
|
1179
|
+
|
|
1180
|
+
if (!isEnabled) {
|
|
1181
|
+
return { ADMOB_ENABLED: false };
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1184
|
+
const androidAppId = nextGenAdmobConfig.androidAppId || legacyAdmobConfig.APP_ID_ANDROID;
|
|
1185
|
+
const iosAppId = nextGenAdmobConfig.iosAppId || legacyAdmobConfig.APP_ID_IOS;
|
|
1186
|
+
const userTrackingDescription =
|
|
1187
|
+
nextGenAdmobConfig.userTrackingDescription ||
|
|
1188
|
+
legacyAdmobConfig.USER_TRACKING_DESCRIPTION ||
|
|
1189
|
+
'This identifier will be used to deliver personalized ads to you.';
|
|
1190
|
+
|
|
1191
|
+
if (!androidAppId || !iosAppId) {
|
|
1192
|
+
throw new Error(' ❌ AdMob configuration is incomplete. Ensure androidAppId/iosAppId or APP_ID_ANDROID/APP_ID_IOS are defined.');
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1195
|
+
return {
|
|
1196
|
+
ADMOB_ENABLED: true,
|
|
1197
|
+
APP_ID_ANDROID: androidAppId,
|
|
1198
|
+
APP_ID_IOS: iosAppId,
|
|
1199
|
+
USER_TRACKING_DESCRIPTION: userTrackingDescription,
|
|
1200
|
+
USE_LITE_ADS: legacyAdmobConfig.USE_LITE_ADS === "lite",
|
|
1201
|
+
};
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
function syncNextGenAdmobPackageJsonFromCapacitorConfig() {
|
|
1205
|
+
if (!fileExists(configPath) || !fileExists(packageJsonPath)) {
|
|
1206
|
+
return;
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
const capacitorConfig = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
1210
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
1211
|
+
|
|
1212
|
+
const legacyAdmobConfig = capacitorConfig.plugins?.AdMob || {};
|
|
1213
|
+
const androidAppId = legacyAdmobConfig.APP_ID_ANDROID;
|
|
1214
|
+
const iosAppId = legacyAdmobConfig.APP_ID_IOS;
|
|
1215
|
+
|
|
1216
|
+
if (!androidAppId || !iosAppId) {
|
|
1217
|
+
return;
|
|
1218
|
+
}
|
|
1219
|
+
|
|
1220
|
+
const desiredAdmobConfig = {
|
|
1221
|
+
androidAppId,
|
|
1222
|
+
iosAppId,
|
|
1223
|
+
enableNativeAds: {
|
|
1224
|
+
ios: packageJson.admob?.enableNativeAds?.ios ?? true,
|
|
1225
|
+
android: packageJson.admob?.enableNativeAds?.android ?? true,
|
|
1226
|
+
},
|
|
1227
|
+
userTrackingDescription:
|
|
1228
|
+
packageJson.admob?.userTrackingDescription ||
|
|
1229
|
+
'This identifier will be used to deliver personalized ads to you.',
|
|
1230
|
+
};
|
|
1231
|
+
|
|
1232
|
+
const existingAdmobConfig = packageJson.admob || {};
|
|
1233
|
+
const mergedAdmobConfig = { ...existingAdmobConfig };
|
|
1234
|
+
let updated = false;
|
|
1235
|
+
|
|
1236
|
+
const syncKeyByKey = (target, source) => {
|
|
1237
|
+
for (const [key, value] of Object.entries(source)) {
|
|
1238
|
+
if (value && typeof value === 'object' && !Array.isArray(value)) {
|
|
1239
|
+
if (!target[key] || typeof target[key] !== 'object' || Array.isArray(target[key])) {
|
|
1240
|
+
target[key] = {};
|
|
1241
|
+
updated = true;
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1244
|
+
syncKeyByKey(target[key], value);
|
|
1245
|
+
continue;
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
if (target[key] !== value) {
|
|
1249
|
+
target[key] = value;
|
|
1250
|
+
updated = true;
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
};
|
|
1254
|
+
|
|
1255
|
+
syncKeyByKey(mergedAdmobConfig, desiredAdmobConfig);
|
|
1256
|
+
|
|
1257
|
+
if (!updated) {
|
|
1258
|
+
return;
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1261
|
+
packageJson.admob = mergedAdmobConfig;
|
|
1262
|
+
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\n', 'utf8');
|
|
1263
|
+
console.log('✅ package.json AdMob settings synced from capacitor.config.json');
|
|
1264
|
+
}
|
|
1265
1265
|
|
|
1266
1266
|
function validateAndroidBuildOptions() {
|
|
1267
1267
|
|
|
@@ -1341,30 +1341,30 @@ function validateAndroidBuildOptions() {
|
|
|
1341
1341
|
//return buildOptions;
|
|
1342
1342
|
}
|
|
1343
1343
|
|
|
1344
|
-
function updateAndroidManifest(admobConfig) {
|
|
1345
|
-
if (!fileExists(androidManifestPath)) {
|
|
1346
|
-
console.error(' ❌ AndroidManifest.xml not found. Ensure the Android platform is added.');
|
|
1347
|
-
return;
|
|
1348
|
-
}
|
|
1349
|
-
|
|
1350
|
-
let manifestContent = fs.readFileSync(androidManifestPath, 'utf8');
|
|
1351
|
-
const metaDataTag = `<meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="${admobConfig.APP_ID_ANDROID}" />`;
|
|
1352
|
-
|
|
1353
|
-
if (/com\.google\.android\.gms\.ads\.APPLICATION_ID/.test(manifestContent)) {
|
|
1354
|
-
manifestContent = manifestContent.replace(
|
|
1355
|
-
/<meta-data\s+android:name="com\.google\.android\.gms\.ads\.APPLICATION_ID"\s+android:value=".*?"\s*\/>/,
|
|
1356
|
-
metaDataTag
|
|
1357
|
-
);
|
|
1358
|
-
} else {
|
|
1359
|
-
manifestContent = manifestContent.replace(
|
|
1360
|
-
/<application\b([^>]*)>/,
|
|
1361
|
-
`<application$1>\n ${metaDataTag}`
|
|
1362
|
-
);
|
|
1363
|
-
}
|
|
1364
|
-
|
|
1365
|
-
fs.writeFileSync(androidManifestPath, manifestContent, 'utf8');
|
|
1366
|
-
console.log('✅ AdMob Android App ID successfully updated in AndroidManifest.xml');
|
|
1367
|
-
}
|
|
1344
|
+
function updateAndroidManifest(admobConfig) {
|
|
1345
|
+
if (!fileExists(androidManifestPath)) {
|
|
1346
|
+
console.error(' ❌ AndroidManifest.xml not found. Ensure the Android platform is added.');
|
|
1347
|
+
return;
|
|
1348
|
+
}
|
|
1349
|
+
|
|
1350
|
+
let manifestContent = fs.readFileSync(androidManifestPath, 'utf8');
|
|
1351
|
+
const metaDataTag = `<meta-data android:name="com.google.android.gms.ads.APPLICATION_ID" android:value="${admobConfig.APP_ID_ANDROID}" />`;
|
|
1352
|
+
|
|
1353
|
+
if (/com\.google\.android\.gms\.ads\.APPLICATION_ID/.test(manifestContent)) {
|
|
1354
|
+
manifestContent = manifestContent.replace(
|
|
1355
|
+
/<meta-data\s+android:name="com\.google\.android\.gms\.ads\.APPLICATION_ID"\s+android:value=".*?"\s*\/>/,
|
|
1356
|
+
metaDataTag
|
|
1357
|
+
);
|
|
1358
|
+
} else {
|
|
1359
|
+
manifestContent = manifestContent.replace(
|
|
1360
|
+
/<application\b([^>]*)>/,
|
|
1361
|
+
`<application$1>\n ${metaDataTag}`
|
|
1362
|
+
);
|
|
1363
|
+
}
|
|
1364
|
+
|
|
1365
|
+
fs.writeFileSync(androidManifestPath, manifestContent, 'utf8');
|
|
1366
|
+
console.log('✅ AdMob Android App ID successfully updated in AndroidManifest.xml');
|
|
1367
|
+
}
|
|
1368
1368
|
|
|
1369
1369
|
function updateInfoPlist(admobConfig) {
|
|
1370
1370
|
if (!fileExists(infoPlistPath)) {
|
|
@@ -1376,7 +1376,7 @@ function updateInfoPlist(admobConfig) {
|
|
|
1376
1376
|
const plistData = plist.parse(plistContent);
|
|
1377
1377
|
|
|
1378
1378
|
plistData.GADApplicationIdentifier = admobConfig.APP_ID_IOS;
|
|
1379
|
-
plistData.NSUserTrackingUsageDescription = admobConfig.USER_TRACKING_DESCRIPTION;
|
|
1379
|
+
plistData.NSUserTrackingUsageDescription = admobConfig.USER_TRACKING_DESCRIPTION;
|
|
1380
1380
|
plistData.GADDelayAppMeasurementInit = true;
|
|
1381
1381
|
|
|
1382
1382
|
// https://developers.google.com/admob/ios/quick-start
|
|
@@ -1438,24 +1438,24 @@ try {
|
|
|
1438
1438
|
|
|
1439
1439
|
if (!fileExists(androidPlatformPath) && !fileExists(iosPlatformPath)) {
|
|
1440
1440
|
throw new Error('Neither Android nor iOS platforms are found. Ensure platforms are added to your Capacitor project.');
|
|
1441
|
-
}
|
|
1442
|
-
|
|
1443
|
-
checkAndCopyResources();
|
|
1444
|
-
|
|
1445
|
-
syncNextGenAdmobPackageJsonFromCapacitorConfig();
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
_admobConfig = getAdMobConfig();
|
|
1441
|
+
}
|
|
1442
|
+
|
|
1443
|
+
checkAndCopyResources();
|
|
1444
|
+
|
|
1445
|
+
syncNextGenAdmobPackageJsonFromCapacitorConfig();
|
|
1446
|
+
|
|
1447
|
+
|
|
1448
|
+
_admobConfig = getAdMobConfig();
|
|
1449
1449
|
|
|
1450
1450
|
|
|
1451
1451
|
|
|
1452
1452
|
|
|
1453
1453
|
|
|
1454
|
-
// Proceed only if ADMOB_ENABLED is true
|
|
1455
|
-
if (_admobConfig.ADMOB_ENABLED) {
|
|
1456
|
-
if (fileExists(androidPlatformPath)) {
|
|
1457
|
-
updateAndroidManifest(_admobConfig);
|
|
1458
|
-
}
|
|
1454
|
+
// Proceed only if ADMOB_ENABLED is true
|
|
1455
|
+
if (_admobConfig.ADMOB_ENABLED) {
|
|
1456
|
+
if (fileExists(androidPlatformPath)) {
|
|
1457
|
+
updateAndroidManifest(_admobConfig);
|
|
1458
|
+
}
|
|
1459
1459
|
|
|
1460
1460
|
if (fileExists(iosPlatformPath)) {
|
|
1461
1461
|
updateInfoPlist(_admobConfig);
|
|
@@ -1592,15 +1592,15 @@ function downloadFile(url, dest) {
|
|
|
1592
1592
|
* Replaces old filename → new filename
|
|
1593
1593
|
*/
|
|
1594
1594
|
|
|
1595
|
-
const VITE_ALIAS_ONLY = [
|
|
1596
|
-
"common",
|
|
1597
|
-
"admob-emi",
|
|
1598
|
-
"admob-emi-nextgen",
|
|
1599
|
-
"localization",
|
|
1600
|
-
"theme",
|
|
1601
|
-
"certificatejs",
|
|
1602
|
-
"ffmpeg"
|
|
1603
|
-
];
|
|
1595
|
+
const VITE_ALIAS_ONLY = [
|
|
1596
|
+
"common",
|
|
1597
|
+
"admob-emi",
|
|
1598
|
+
"admob-emi-nextgen",
|
|
1599
|
+
"localization",
|
|
1600
|
+
"theme",
|
|
1601
|
+
"certificatejs",
|
|
1602
|
+
"ffmpeg"
|
|
1603
|
+
];
|
|
1604
1604
|
|
|
1605
1605
|
function updateImports(oldName, newName) {
|
|
1606
1606
|
|
|
@@ -2084,11 +2084,11 @@ if (hasMandatoryUpdate) {
|
|
|
2084
2084
|
process.exit(1);
|
|
2085
2085
|
}
|
|
2086
2086
|
|
|
2087
|
-
console.log('\n🎉 All mandatory plugins auto-updated! Skipping recheck for speed.\n');
|
|
2088
|
-
|
|
2089
|
-
saveUpdateLogs();
|
|
2090
|
-
resolve();
|
|
2091
|
-
return;
|
|
2087
|
+
console.log('\n🎉 All mandatory plugins auto-updated! Skipping recheck for speed.\n');
|
|
2088
|
+
|
|
2089
|
+
saveUpdateLogs();
|
|
2090
|
+
resolve();
|
|
2091
|
+
return;
|
|
2092
2092
|
}
|
|
2093
2093
|
|
|
2094
2094
|
|
|
@@ -2387,7 +2387,7 @@ if (hasError) {
|
|
|
2387
2387
|
|
|
2388
2388
|
|
|
2389
2389
|
|
|
2390
|
-
const checkAndupdateDropInViteConfig = () => {
|
|
2390
|
+
const checkAndupdateDropInViteConfig = () => {
|
|
2391
2391
|
|
|
2392
2392
|
const possibleFiles = [
|
|
2393
2393
|
"vite.config.js",
|
|
@@ -2452,72 +2452,72 @@ const checkAndupdateDropInViteConfig = () => {
|
|
|
2452
2452
|
);
|
|
2453
2453
|
}
|
|
2454
2454
|
|
|
2455
|
-
fs.writeFileSync(viteConfigPath, viteContent, "utf8");
|
|
2456
|
-
console.log("✅ vite.config.(m)js Updated successfully.");
|
|
2457
|
-
};
|
|
2458
|
-
|
|
2459
|
-
const syncAdmobAliasInViteConfig = () => {
|
|
2460
|
-
const possibleFiles = [
|
|
2461
|
-
"vite.config.mjs",
|
|
2462
|
-
"vite.config.js"
|
|
2463
|
-
];
|
|
2464
|
-
|
|
2465
|
-
const viteConfigPath = possibleFiles
|
|
2466
|
-
.map(file => path.join(process.cwd(), file))
|
|
2467
|
-
.find(filePath => fs.existsSync(filePath));
|
|
2468
|
-
|
|
2469
|
-
if (!viteConfigPath) {
|
|
2470
|
-
console.warn("⚠️ No vite config found. Skipping AdMob alias sync.");
|
|
2471
|
-
return;
|
|
2472
|
-
}
|
|
2473
|
-
|
|
2474
|
-
const adsDir = path.join(process.cwd(), "src", "js", "Ads");
|
|
2475
|
-
|
|
2476
|
-
if (!fs.existsSync(adsDir)) {
|
|
2477
|
-
console.log("ℹ️ Ads folder not found. Keeping existing @admob alias.");
|
|
2478
|
-
return;
|
|
2479
|
-
}
|
|
2480
|
-
|
|
2481
|
-
const nextGenFiles = fs.readdirSync(adsDir)
|
|
2482
|
-
.filter(name => /^admob-emi-nextgen-\d+(\.\d+)*\.js$/.test(name))
|
|
2483
|
-
.sort((a, b) => {
|
|
2484
|
-
const versionA = a.match(/(\d+(?:\.\d+)*)/)[1].split(".").map(Number);
|
|
2485
|
-
const versionB = b.match(/(\d+(?:\.\d+)*)/)[1].split(".").map(Number);
|
|
2486
|
-
|
|
2487
|
-
for (let i = 0; i < Math.max(versionA.length, versionB.length); i++) {
|
|
2488
|
-
const diff = (versionB[i] || 0) - (versionA[i] || 0);
|
|
2489
|
-
if (diff !== 0) return diff;
|
|
2490
|
-
}
|
|
2491
|
-
|
|
2492
|
-
return 0;
|
|
2493
|
-
});
|
|
2494
|
-
|
|
2495
|
-
if (nextGenFiles.length === 0) {
|
|
2496
|
-
console.log("ℹ️ No admob-emi-nextgen-x.x.js file found. Keeping existing @admob alias.");
|
|
2497
|
-
return;
|
|
2498
|
-
}
|
|
2499
|
-
|
|
2500
|
-
const nextGenFile = nextGenFiles[0];
|
|
2501
|
-
const nextGenRelativePath = `./src/js/Ads/${nextGenFile}`;
|
|
2502
|
-
|
|
2503
|
-
let viteContent = fs.readFileSync(viteConfigPath, "utf8");
|
|
2504
|
-
const nextGenAliasLine = ` '@admob': path.resolve(__dirname, '${nextGenRelativePath}'),`;
|
|
2505
|
-
const aliasLineRegex = /[ \t]*['"]@admob['"]:\s*path\.resolve\(__dirname,\s*['"][^'"]+['"]\),/;
|
|
2506
|
-
|
|
2507
|
-
if (aliasLineRegex.test(viteContent) && viteContent.includes(nextGenAliasLine)) {
|
|
2508
|
-
console.log(`ℹ️ @admob already points to ${nextGenRelativePath}.`);
|
|
2509
|
-
return;
|
|
2510
|
-
}
|
|
2511
|
-
|
|
2512
|
-
if (!aliasLineRegex.test(viteContent)) {
|
|
2513
|
-
console.warn("⚠️ @admob alias line not found in vite config. Skipping alias sync.");
|
|
2514
|
-
return;
|
|
2515
|
-
}
|
|
2516
|
-
|
|
2517
|
-
viteContent = viteContent.replace(aliasLineRegex, nextGenAliasLine);
|
|
2518
|
-
fs.writeFileSync(viteConfigPath, viteContent, "utf8");
|
|
2519
|
-
console.log(`✅ @admob alias updated to ${nextGenRelativePath}`);
|
|
2520
|
-
};
|
|
2455
|
+
fs.writeFileSync(viteConfigPath, viteContent, "utf8");
|
|
2456
|
+
console.log("✅ vite.config.(m)js Updated successfully.");
|
|
2457
|
+
};
|
|
2458
|
+
|
|
2459
|
+
const syncAdmobAliasInViteConfig = () => {
|
|
2460
|
+
const possibleFiles = [
|
|
2461
|
+
"vite.config.mjs",
|
|
2462
|
+
"vite.config.js"
|
|
2463
|
+
];
|
|
2464
|
+
|
|
2465
|
+
const viteConfigPath = possibleFiles
|
|
2466
|
+
.map(file => path.join(process.cwd(), file))
|
|
2467
|
+
.find(filePath => fs.existsSync(filePath));
|
|
2468
|
+
|
|
2469
|
+
if (!viteConfigPath) {
|
|
2470
|
+
console.warn("⚠️ No vite config found. Skipping AdMob alias sync.");
|
|
2471
|
+
return;
|
|
2472
|
+
}
|
|
2473
|
+
|
|
2474
|
+
const adsDir = path.join(process.cwd(), "src", "js", "Ads");
|
|
2475
|
+
|
|
2476
|
+
if (!fs.existsSync(adsDir)) {
|
|
2477
|
+
console.log("ℹ️ Ads folder not found. Keeping existing @admob alias.");
|
|
2478
|
+
return;
|
|
2479
|
+
}
|
|
2480
|
+
|
|
2481
|
+
const nextGenFiles = fs.readdirSync(adsDir)
|
|
2482
|
+
.filter(name => /^admob-emi-nextgen-\d+(\.\d+)*\.js$/.test(name))
|
|
2483
|
+
.sort((a, b) => {
|
|
2484
|
+
const versionA = a.match(/(\d+(?:\.\d+)*)/)[1].split(".").map(Number);
|
|
2485
|
+
const versionB = b.match(/(\d+(?:\.\d+)*)/)[1].split(".").map(Number);
|
|
2486
|
+
|
|
2487
|
+
for (let i = 0; i < Math.max(versionA.length, versionB.length); i++) {
|
|
2488
|
+
const diff = (versionB[i] || 0) - (versionA[i] || 0);
|
|
2489
|
+
if (diff !== 0) return diff;
|
|
2490
|
+
}
|
|
2491
|
+
|
|
2492
|
+
return 0;
|
|
2493
|
+
});
|
|
2494
|
+
|
|
2495
|
+
if (nextGenFiles.length === 0) {
|
|
2496
|
+
console.log("ℹ️ No admob-emi-nextgen-x.x.js file found. Keeping existing @admob alias.");
|
|
2497
|
+
return;
|
|
2498
|
+
}
|
|
2499
|
+
|
|
2500
|
+
const nextGenFile = nextGenFiles[0];
|
|
2501
|
+
const nextGenRelativePath = `./src/js/Ads/${nextGenFile}`;
|
|
2502
|
+
|
|
2503
|
+
let viteContent = fs.readFileSync(viteConfigPath, "utf8");
|
|
2504
|
+
const nextGenAliasLine = ` '@admob': path.resolve(__dirname, '${nextGenRelativePath}'),`;
|
|
2505
|
+
const aliasLineRegex = /[ \t]*['"]@admob['"]:\s*path\.resolve\(__dirname,\s*['"][^'"]+['"]\),/;
|
|
2506
|
+
|
|
2507
|
+
if (aliasLineRegex.test(viteContent) && viteContent.includes(nextGenAliasLine)) {
|
|
2508
|
+
console.log(`ℹ️ @admob already points to ${nextGenRelativePath}.`);
|
|
2509
|
+
return;
|
|
2510
|
+
}
|
|
2511
|
+
|
|
2512
|
+
if (!aliasLineRegex.test(viteContent)) {
|
|
2513
|
+
console.warn("⚠️ @admob alias line not found in vite config. Skipping alias sync.");
|
|
2514
|
+
return;
|
|
2515
|
+
}
|
|
2516
|
+
|
|
2517
|
+
viteContent = viteContent.replace(aliasLineRegex, nextGenAliasLine);
|
|
2518
|
+
fs.writeFileSync(viteConfigPath, viteContent, "utf8");
|
|
2519
|
+
console.log(`✅ @admob alias updated to ${nextGenRelativePath}`);
|
|
2520
|
+
};
|
|
2521
2521
|
|
|
2522
2522
|
|
|
2523
2523
|
|
|
@@ -2550,26 +2550,26 @@ const compareVersion = (v1, v2) => {
|
|
|
2550
2550
|
|
|
2551
2551
|
|
|
2552
2552
|
|
|
2553
|
-
const admobConfigPaths = [
|
|
2554
|
-
path.join('src', 'js', 'Ads', 'admob-ad-configuration-nextgen.json'),
|
|
2555
|
-
path.join('src', 'js', 'Ads', 'admob-ad-configuration.json')
|
|
2556
|
-
];
|
|
2557
|
-
|
|
2558
|
-
const checkAdmobConfigurationProperty=()=>{
|
|
2553
|
+
const admobConfigPaths = [
|
|
2554
|
+
path.join('src', 'js', 'Ads', 'admob-ad-configuration-nextgen.json'),
|
|
2555
|
+
path.join('src', 'js', 'Ads', 'admob-ad-configuration.json')
|
|
2556
|
+
];
|
|
2557
|
+
|
|
2558
|
+
const checkAdmobConfigurationProperty=()=>{
|
|
2559
|
+
|
|
2560
|
+
|
|
2561
|
+
if (!_admobConfig.ADMOB_ENABLED)
|
|
2562
|
+
{
|
|
2563
|
+
console.log("ℹ️ Admob is not enabled so ad configuration checking is skipping...");
|
|
2564
|
+
return;
|
|
2565
|
+
}
|
|
2559
2566
|
|
|
2567
|
+
const admobConfigPath = admobConfigPaths.find(fileExists);
|
|
2560
2568
|
|
|
2561
|
-
if (!
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
}
|
|
2566
|
-
|
|
2567
|
-
const admobConfigPath = admobConfigPaths.find(fileExists);
|
|
2568
|
-
|
|
2569
|
-
if (!admobConfigPath) {
|
|
2570
|
-
console.error("❌ Failed to find AdMob configuration JSON. Checked admob-ad-configuration-nextgen.json and admob-ad-configuration.json");
|
|
2571
|
-
process.exit(1);
|
|
2572
|
-
}
|
|
2569
|
+
if (!admobConfigPath) {
|
|
2570
|
+
console.error("❌ Failed to find AdMob configuration JSON. Checked admob-ad-configuration-nextgen.json and admob-ad-configuration.json");
|
|
2571
|
+
process.exit(1);
|
|
2572
|
+
}
|
|
2573
2573
|
|
|
2574
2574
|
|
|
2575
2575
|
const REQUIRED_CONFIG_KEYS = [
|
|
@@ -2608,26 +2608,26 @@ const REQUIRED_CONFIG_KEYS = [
|
|
|
2608
2608
|
|
|
2609
2609
|
let admobConfigInJson;
|
|
2610
2610
|
|
|
2611
|
-
try {
|
|
2612
|
-
admobConfigInJson = JSON.parse(readFileSync(admobConfigPath, "utf8"));
|
|
2613
|
-
} catch (err) {
|
|
2614
|
-
console.error(`❌ Failed to read ${admobConfigPath}`, err);
|
|
2615
|
-
process.exit(1);
|
|
2616
|
-
}
|
|
2617
|
-
|
|
2618
|
-
// ✅ Validate config object exists
|
|
2619
|
-
if (!admobConfigInJson.config) {
|
|
2620
|
-
console.error(`❌ "config" object is missing in ${admobConfigPath}`);
|
|
2621
|
-
process.exit(1);
|
|
2622
|
-
}
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
const admobConfigMinVersion="1.0"
|
|
2626
|
-
|
|
2627
|
-
if (compareVersion(admobConfigInJson.VERSION, admobConfigMinVersion) < 0) {
|
|
2628
|
-
console.error(`❌ Please use at-least version ${admobConfigMinVersion} in "${admobConfigPath}"`);
|
|
2629
|
-
process.exit(1);
|
|
2630
|
-
}
|
|
2611
|
+
try {
|
|
2612
|
+
admobConfigInJson = JSON.parse(readFileSync(admobConfigPath, "utf8"));
|
|
2613
|
+
} catch (err) {
|
|
2614
|
+
console.error(`❌ Failed to read ${admobConfigPath}`, err);
|
|
2615
|
+
process.exit(1);
|
|
2616
|
+
}
|
|
2617
|
+
|
|
2618
|
+
// ✅ Validate config object exists
|
|
2619
|
+
if (!admobConfigInJson.config) {
|
|
2620
|
+
console.error(`❌ "config" object is missing in ${admobConfigPath}`);
|
|
2621
|
+
process.exit(1);
|
|
2622
|
+
}
|
|
2623
|
+
|
|
2624
|
+
|
|
2625
|
+
const admobConfigMinVersion="1.0"
|
|
2626
|
+
|
|
2627
|
+
if (compareVersion(admobConfigInJson.VERSION, admobConfigMinVersion) < 0) {
|
|
2628
|
+
console.error(`❌ Please use at-least version ${admobConfigMinVersion} in "${admobConfigPath}"`);
|
|
2629
|
+
process.exit(1);
|
|
2630
|
+
}
|
|
2631
2631
|
|
|
2632
2632
|
|
|
2633
2633
|
const config = admobConfigInJson.config;
|
|
@@ -2638,17 +2638,17 @@ if (compareVersion(admobConfigInJson.VERSION, admobConfigMinVersion) < 0) {
|
|
|
2638
2638
|
);
|
|
2639
2639
|
|
|
2640
2640
|
|
|
2641
|
-
|
|
2642
|
-
if (missingKeys.length > 0) {
|
|
2643
|
-
console.error(`❌ Missing required configuration keys. Please check it in '${admobConfigPath}'`);
|
|
2644
|
-
|
|
2645
|
-
missingKeys.forEach(k => console.error(" - " + k));
|
|
2646
|
-
process.exit(1);
|
|
2647
|
-
}
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
console.log(`✅ All keys exist in "${admobConfigPath}". Configuration looks good.`);
|
|
2651
|
-
}
|
|
2641
|
+
|
|
2642
|
+
if (missingKeys.length > 0) {
|
|
2643
|
+
console.error(`❌ Missing required configuration keys. Please check it in '${admobConfigPath}'`);
|
|
2644
|
+
|
|
2645
|
+
missingKeys.forEach(k => console.error(" - " + k));
|
|
2646
|
+
process.exit(1);
|
|
2647
|
+
}
|
|
2648
|
+
|
|
2649
|
+
|
|
2650
|
+
console.log(`✅ All keys exist in "${admobConfigPath}". Configuration looks good.`);
|
|
2651
|
+
}
|
|
2652
2652
|
|
|
2653
2653
|
|
|
2654
2654
|
|
|
@@ -2694,13 +2694,13 @@ ensureGitignoreEntry('buildCodeplay/');
|
|
|
2694
2694
|
// Run the validation
|
|
2695
2695
|
(async () => {
|
|
2696
2696
|
|
|
2697
|
-
await loadPluginVersions(); // 🔥 NEW
|
|
2698
|
-
|
|
2699
|
-
await checkPlugins();
|
|
2700
|
-
checkAndupdateDropInViteConfig();
|
|
2701
|
-
syncAdmobAliasInViteConfig();
|
|
2702
|
-
checkAdmobConfigurationProperty()
|
|
2703
|
-
})();
|
|
2697
|
+
await loadPluginVersions(); // 🔥 NEW
|
|
2698
|
+
|
|
2699
|
+
await checkPlugins();
|
|
2700
|
+
checkAndupdateDropInViteConfig();
|
|
2701
|
+
syncAdmobAliasInViteConfig();
|
|
2702
|
+
checkAdmobConfigurationProperty()
|
|
2703
|
+
})();
|
|
2704
2704
|
|
|
2705
2705
|
|
|
2706
2706
|
// ======================================================
|
|
@@ -2892,4 +2892,4 @@ Release Notes
|
|
|
2892
2892
|
5.1
|
|
2893
2893
|
Kotlin version update is commented. Previously admob is not worked if not update the kotlin version to higher version
|
|
2894
2894
|
|
|
2895
|
-
*/
|
|
2895
|
+
*/
|