codeplay-common 4.1.0 → 4.1.2
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/README.md +3 -1
- package/files/buildCodeplay/codeplayBeforeBuild-6.2.js +351 -91
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,9 +14,12 @@ const { readFileSync } = require("fs");
|
|
|
14
14
|
const ENABLE_AUTO_UPDATE = true;
|
|
15
15
|
const USE_LIVE_SERVER_VERSION = true;
|
|
16
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");
|
|
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
|
+
const ADMOB_NEXTGEN_FILE = "admob-emi-nextgen-1.4.js";
|
|
21
|
+
const ADMOB_NEXTGEN_CONFIG = "admob-ad-configuration-nextgen.json";
|
|
22
|
+
const ADMOB_OLD_CONFIG = "admob-ad-configuration.json";
|
|
20
23
|
|
|
21
24
|
// Expected plugin list with minimum versions
|
|
22
25
|
/* const requiredPlugins = [
|
|
@@ -1216,7 +1219,7 @@ function checkAndCopyResources() {
|
|
|
1216
1219
|
|
|
1217
1220
|
|
|
1218
1221
|
|
|
1219
|
-
function getAdMobConfig() {
|
|
1222
|
+
function getAdMobConfig() {
|
|
1220
1223
|
if (!fileExists(configPath)) {
|
|
1221
1224
|
throw new Error('❌ capacitor.config.json not found. Ensure this is a Capacitor project.');
|
|
1222
1225
|
}
|
|
@@ -1226,8 +1229,9 @@ function getAdMobConfig() {
|
|
|
1226
1229
|
? JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'))
|
|
1227
1230
|
: {};
|
|
1228
1231
|
|
|
1229
|
-
const legacyAdmobConfig = capacitorConfig.plugins?.AdMob || {};
|
|
1230
|
-
const nextGenAdmobConfig = packageJson.admob || {};
|
|
1232
|
+
const legacyAdmobConfig = capacitorConfig.plugins?.AdMob || {};
|
|
1233
|
+
const nextGenAdmobConfig = packageJson.admob || {};
|
|
1234
|
+
const admobJsonAppIds = getAdmobJsonAppIds();
|
|
1231
1235
|
|
|
1232
1236
|
if (!legacyAdmobConfig && !nextGenAdmobConfig) {
|
|
1233
1237
|
throw new Error('❌ AdMob configuration is missing in package.json or capacitor.config.json.');
|
|
@@ -1241,8 +1245,8 @@ function getAdMobConfig() {
|
|
|
1241
1245
|
return { ADMOB_ENABLED: false };
|
|
1242
1246
|
}
|
|
1243
1247
|
|
|
1244
|
-
const androidAppId = nextGenAdmobConfig.androidAppId || legacyAdmobConfig.APP_ID_ANDROID;
|
|
1245
|
-
const iosAppId = nextGenAdmobConfig.iosAppId || legacyAdmobConfig.APP_ID_IOS;
|
|
1248
|
+
const androidAppId = admobJsonAppIds.androidAppId || nextGenAdmobConfig.androidAppId || legacyAdmobConfig.APP_ID_ANDROID;
|
|
1249
|
+
const iosAppId = admobJsonAppIds.iosAppId || nextGenAdmobConfig.iosAppId || legacyAdmobConfig.APP_ID_IOS;
|
|
1246
1250
|
const userTrackingDescription =
|
|
1247
1251
|
nextGenAdmobConfig.userTrackingDescription ||
|
|
1248
1252
|
legacyAdmobConfig.USER_TRACKING_DESCRIPTION ||
|
|
@@ -1261,17 +1265,18 @@ function getAdMobConfig() {
|
|
|
1261
1265
|
};
|
|
1262
1266
|
}
|
|
1263
1267
|
|
|
1264
|
-
function syncNextGenAdmobPackageJsonFromCapacitorConfig() {
|
|
1265
|
-
if (!fileExists(configPath) || !fileExists(packageJsonPath)) {
|
|
1266
|
-
return;
|
|
1267
|
-
}
|
|
1268
|
-
|
|
1269
|
-
const capacitorConfig = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
1270
|
-
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
1271
|
-
|
|
1272
|
-
const legacyAdmobConfig = capacitorConfig.plugins?.AdMob || {};
|
|
1273
|
-
const
|
|
1274
|
-
const
|
|
1268
|
+
function syncNextGenAdmobPackageJsonFromCapacitorConfig() {
|
|
1269
|
+
if (!fileExists(configPath) || !fileExists(packageJsonPath)) {
|
|
1270
|
+
return;
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
const capacitorConfig = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
1274
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
1275
|
+
|
|
1276
|
+
const legacyAdmobConfig = capacitorConfig.plugins?.AdMob || {};
|
|
1277
|
+
const admobJsonAppIds = getAdmobJsonAppIds();
|
|
1278
|
+
const androidAppId = admobJsonAppIds.androidAppId || legacyAdmobConfig.APP_ID_ANDROID;
|
|
1279
|
+
const iosAppId = admobJsonAppIds.iosAppId || legacyAdmobConfig.APP_ID_IOS;
|
|
1275
1280
|
|
|
1276
1281
|
if (!androidAppId || !iosAppId) {
|
|
1277
1282
|
return;
|
|
@@ -1319,9 +1324,11 @@ function syncNextGenAdmobPackageJsonFromCapacitorConfig() {
|
|
|
1319
1324
|
}
|
|
1320
1325
|
|
|
1321
1326
|
packageJson.admob = mergedAdmobConfig;
|
|
1322
|
-
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\n', 'utf8');
|
|
1323
|
-
console.log(
|
|
1324
|
-
|
|
1327
|
+
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + '\n', 'utf8');
|
|
1328
|
+
console.log(admobJsonAppIds.androidAppId || admobJsonAppIds.iosAppId
|
|
1329
|
+
? '✅ package.json AdMob settings synced from AdMob configuration JSON'
|
|
1330
|
+
: '✅ package.json AdMob settings synced from capacitor.config.json');
|
|
1331
|
+
}
|
|
1325
1332
|
|
|
1326
1333
|
function validateAndroidBuildOptions() {
|
|
1327
1334
|
|
|
@@ -1607,41 +1614,54 @@ const https = require("https");
|
|
|
1607
1614
|
/**
|
|
1608
1615
|
* Check if file exists on server using HEAD request
|
|
1609
1616
|
*/
|
|
1610
|
-
function urlExists(url) {
|
|
1611
|
-
return new Promise(resolve => {
|
|
1612
|
-
const req = https.request(url, { method: "HEAD" }, res => {
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
req.
|
|
1618
|
-
|
|
1619
|
-
|
|
1617
|
+
function urlExists(url) {
|
|
1618
|
+
return new Promise(resolve => {
|
|
1619
|
+
const req = https.request(url, { method: "HEAD" }, res => {
|
|
1620
|
+
res.resume();
|
|
1621
|
+
resolve(res.statusCode === 200);
|
|
1622
|
+
});
|
|
1623
|
+
|
|
1624
|
+
req.on("error", () => resolve(false));
|
|
1625
|
+
req.setTimeout(8000, () => {
|
|
1626
|
+
req.destroy();
|
|
1627
|
+
resolve(false);
|
|
1628
|
+
});
|
|
1629
|
+
req.end();
|
|
1630
|
+
});
|
|
1631
|
+
}
|
|
1620
1632
|
|
|
1621
1633
|
/**
|
|
1622
1634
|
* Download file from server
|
|
1623
1635
|
*/
|
|
1624
|
-
function downloadFile(url, dest) {
|
|
1625
|
-
return new Promise((resolve, reject) => {
|
|
1626
|
-
const file = fs.createWriteStream(dest);
|
|
1627
|
-
|
|
1628
|
-
https.get(url, response => {
|
|
1629
|
-
if (response.statusCode !== 200) {
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1636
|
+
function downloadFile(url, dest) {
|
|
1637
|
+
return new Promise((resolve, reject) => {
|
|
1638
|
+
const file = fs.createWriteStream(dest);
|
|
1639
|
+
|
|
1640
|
+
const req = https.get(url, response => {
|
|
1641
|
+
if (response.statusCode !== 200) {
|
|
1642
|
+
response.resume();
|
|
1643
|
+
file.close(() => fs.unlink(dest, () => {}));
|
|
1644
|
+
reject("Download failed");
|
|
1645
|
+
return;
|
|
1646
|
+
}
|
|
1647
|
+
|
|
1648
|
+
response.pipe(file);
|
|
1635
1649
|
|
|
1636
1650
|
file.on("finish", () => {
|
|
1637
1651
|
file.close(resolve);
|
|
1638
1652
|
});
|
|
1639
|
-
}).on("error", err => {
|
|
1640
|
-
fs.unlink(dest, () => {});
|
|
1641
|
-
reject(err);
|
|
1642
|
-
});
|
|
1643
|
-
|
|
1644
|
-
|
|
1653
|
+
}).on("error", err => {
|
|
1654
|
+
fs.unlink(dest, () => {});
|
|
1655
|
+
reject(err);
|
|
1656
|
+
});
|
|
1657
|
+
|
|
1658
|
+
req.setTimeout(30000, () => {
|
|
1659
|
+
req.destroy();
|
|
1660
|
+
file.close(() => fs.unlink(dest, () => {}));
|
|
1661
|
+
reject(new Error(`Download timed out: ${url}`));
|
|
1662
|
+
});
|
|
1663
|
+
});
|
|
1664
|
+
}
|
|
1645
1665
|
|
|
1646
1666
|
/**
|
|
1647
1667
|
* Update imports across src folder
|
|
@@ -2679,6 +2699,255 @@ const runNpmCommand = (command) => {
|
|
|
2679
2699
|
execSync(command, { stdio: "inherit" });
|
|
2680
2700
|
};
|
|
2681
2701
|
|
|
2702
|
+
const ADMOB_NEXTGEN_DEFAULTS = {
|
|
2703
|
+
VERSION: "1.6",
|
|
2704
|
+
ios: { nativeid: "" },
|
|
2705
|
+
android: { nativeid: "" },
|
|
2706
|
+
config: {
|
|
2707
|
+
bannerStartupDelayMs: "",
|
|
2708
|
+
interstitialStartupDelayMs: "",
|
|
2709
|
+
appOpenLoadOnColdStart: "",
|
|
2710
|
+
appOpenStartupDelayMs: "",
|
|
2711
|
+
useAndroidPreloadAds: true,
|
|
2712
|
+
useAndroidBannerPreloadAds: false,
|
|
2713
|
+
preloadBufferSize: 1
|
|
2714
|
+
},
|
|
2715
|
+
testid: {
|
|
2716
|
+
nativeid: "",
|
|
2717
|
+
nativeid_android: "ca-app-pub-3940256099942544/2247696110",
|
|
2718
|
+
nativeid_ios: "ca-app-pub-3940256099942544/3986624511"
|
|
2719
|
+
}
|
|
2720
|
+
};
|
|
2721
|
+
|
|
2722
|
+
function getAdmobJsonPath() {
|
|
2723
|
+
const adsDir = path.join(process.cwd(), "src", "js", "Ads");
|
|
2724
|
+
const possiblePaths = [
|
|
2725
|
+
path.join(adsDir, ADMOB_NEXTGEN_CONFIG),
|
|
2726
|
+
path.join(adsDir, ADMOB_OLD_CONFIG)
|
|
2727
|
+
];
|
|
2728
|
+
|
|
2729
|
+
return possiblePaths.find(fileExists);
|
|
2730
|
+
}
|
|
2731
|
+
|
|
2732
|
+
function readJsonSafe(filePath) {
|
|
2733
|
+
try {
|
|
2734
|
+
return filePath && fileExists(filePath)
|
|
2735
|
+
? JSON.parse(fs.readFileSync(filePath, "utf8"))
|
|
2736
|
+
: null;
|
|
2737
|
+
} catch {
|
|
2738
|
+
return null;
|
|
2739
|
+
}
|
|
2740
|
+
}
|
|
2741
|
+
|
|
2742
|
+
function pickFirstValue(...values) {
|
|
2743
|
+
return values.find(value => typeof value === "string" && value.trim() !== "") || "";
|
|
2744
|
+
}
|
|
2745
|
+
|
|
2746
|
+
function getAdmobJsonAppIds(config = readJsonSafe(getAdmobJsonPath())) {
|
|
2747
|
+
return {
|
|
2748
|
+
androidAppId: pickFirstValue(
|
|
2749
|
+
config?.androidAppId,
|
|
2750
|
+
config?.android_app_id,
|
|
2751
|
+
config?.android?.appId,
|
|
2752
|
+
config?.android?.appid,
|
|
2753
|
+
config?.android?.applicationId
|
|
2754
|
+
),
|
|
2755
|
+
iosAppId: pickFirstValue(
|
|
2756
|
+
config?.iosAppId,
|
|
2757
|
+
config?.ios_app_id,
|
|
2758
|
+
config?.ios?.appId,
|
|
2759
|
+
config?.ios?.appid,
|
|
2760
|
+
config?.ios?.applicationId
|
|
2761
|
+
)
|
|
2762
|
+
};
|
|
2763
|
+
}
|
|
2764
|
+
|
|
2765
|
+
const mergeObjects = (template, source) => {
|
|
2766
|
+
if (!template || typeof template !== "object" || Array.isArray(template)) {
|
|
2767
|
+
return source !== undefined ? source : template;
|
|
2768
|
+
}
|
|
2769
|
+
|
|
2770
|
+
const output = { ...template };
|
|
2771
|
+
|
|
2772
|
+
if (!source || typeof source !== "object" || Array.isArray(source)) {
|
|
2773
|
+
return output;
|
|
2774
|
+
}
|
|
2775
|
+
|
|
2776
|
+
Object.keys(source).forEach(key => {
|
|
2777
|
+
if (
|
|
2778
|
+
template[key] &&
|
|
2779
|
+
typeof template[key] === "object" &&
|
|
2780
|
+
!Array.isArray(template[key]) &&
|
|
2781
|
+
source[key] &&
|
|
2782
|
+
typeof source[key] === "object" &&
|
|
2783
|
+
!Array.isArray(source[key])
|
|
2784
|
+
) {
|
|
2785
|
+
output[key] = mergeObjects(template[key], source[key]);
|
|
2786
|
+
} else if (key !== "VERSION") {
|
|
2787
|
+
output[key] = source[key];
|
|
2788
|
+
}
|
|
2789
|
+
});
|
|
2790
|
+
|
|
2791
|
+
return output;
|
|
2792
|
+
};
|
|
2793
|
+
|
|
2794
|
+
const hasObjectKeys = (value) => {
|
|
2795
|
+
return value && typeof value === "object" && !Array.isArray(value) && Object.keys(value).length > 0;
|
|
2796
|
+
};
|
|
2797
|
+
|
|
2798
|
+
const buildNextgenAdmobConfigFromOldConfig = (templateConfig, existingNextgenConfig, oldConfig) => {
|
|
2799
|
+
const mergedConfig = mergeObjects(templateConfig, mergeObjects(existingNextgenConfig, oldConfig));
|
|
2800
|
+
|
|
2801
|
+
if (hasObjectKeys(oldConfig)) {
|
|
2802
|
+
if (hasObjectKeys(oldConfig.ios)) {
|
|
2803
|
+
mergedConfig.ios = mergeObjects(ADMOB_NEXTGEN_DEFAULTS.ios, oldConfig.ios);
|
|
2804
|
+
}
|
|
2805
|
+
|
|
2806
|
+
if (hasObjectKeys(oldConfig.android)) {
|
|
2807
|
+
mergedConfig.android = mergeObjects(ADMOB_NEXTGEN_DEFAULTS.android, oldConfig.android);
|
|
2808
|
+
}
|
|
2809
|
+
|
|
2810
|
+
if (hasObjectKeys(oldConfig.testid)) {
|
|
2811
|
+
mergedConfig.testid = mergeObjects(ADMOB_NEXTGEN_DEFAULTS.testid, oldConfig.testid);
|
|
2812
|
+
}
|
|
2813
|
+
|
|
2814
|
+
if (hasObjectKeys(oldConfig.IAP)) {
|
|
2815
|
+
mergedConfig.IAP = oldConfig.IAP;
|
|
2816
|
+
}
|
|
2817
|
+
|
|
2818
|
+
if (hasObjectKeys(oldConfig.config)) {
|
|
2819
|
+
const templateRuntimeConfig = mergeObjects(ADMOB_NEXTGEN_DEFAULTS.config, templateConfig.config || {});
|
|
2820
|
+
const existingRuntimeConfig = existingNextgenConfig.config || {};
|
|
2821
|
+
mergedConfig.config = mergeObjects(templateRuntimeConfig, mergeObjects(existingRuntimeConfig, oldConfig.config));
|
|
2822
|
+
}
|
|
2823
|
+
}
|
|
2824
|
+
|
|
2825
|
+
mergedConfig.VERSION = templateConfig.VERSION || ADMOB_NEXTGEN_DEFAULTS.VERSION;
|
|
2826
|
+
|
|
2827
|
+
return mergedConfig;
|
|
2828
|
+
};
|
|
2829
|
+
|
|
2830
|
+
const syncAdmobNextgenPackage = () => {
|
|
2831
|
+
if (!fs.existsSync(packageJsonPath)) {
|
|
2832
|
+
console.warn("⚠️ package.json not found. Skipping AdMob nextgen package sync.");
|
|
2833
|
+
return;
|
|
2834
|
+
}
|
|
2835
|
+
|
|
2836
|
+
if (isPackageAvailable("emi-indo-cordova-plugin-admob")) {
|
|
2837
|
+
runNpmCommand("npm uninstall emi-indo-cordova-plugin-admob");
|
|
2838
|
+
} else {
|
|
2839
|
+
console.log("ℹ️ emi-indo-cordova-plugin-admob is not installed.");
|
|
2840
|
+
}
|
|
2841
|
+
|
|
2842
|
+
if (!isPackageAvailable("capacitor-admob-nextgen")) {
|
|
2843
|
+
runNpmCommand("npm install capacitor-admob-nextgen");
|
|
2844
|
+
} else {
|
|
2845
|
+
console.log("ℹ️ capacitor-admob-nextgen is already installed.");
|
|
2846
|
+
}
|
|
2847
|
+
};
|
|
2848
|
+
|
|
2849
|
+
const downloadOptionalCodeplayFile = async (fileName, destPath) => {
|
|
2850
|
+
const url = `https://htmlcodeplay.com/code-play-plugin/${fileName}`;
|
|
2851
|
+
|
|
2852
|
+
if (!(await urlExists(url))) {
|
|
2853
|
+
return false;
|
|
2854
|
+
}
|
|
2855
|
+
|
|
2856
|
+
await downloadFile(url, destPath);
|
|
2857
|
+
console.log(`⬇ Downloaded → ${fileName}`);
|
|
2858
|
+
return true;
|
|
2859
|
+
};
|
|
2860
|
+
|
|
2861
|
+
const syncAdmobConfigImports = () => {
|
|
2862
|
+
const adsDir = path.join(process.cwd(), "src", "js", "Ads");
|
|
2863
|
+
if (!fs.existsSync(adsDir)) return;
|
|
2864
|
+
|
|
2865
|
+
const scan = (dir) => {
|
|
2866
|
+
fs.readdirSync(dir, { withFileTypes: true }).forEach(entry => {
|
|
2867
|
+
const fullPath = path.join(dir, entry.name);
|
|
2868
|
+
|
|
2869
|
+
if (entry.isDirectory()) {
|
|
2870
|
+
scan(fullPath);
|
|
2871
|
+
return;
|
|
2872
|
+
}
|
|
2873
|
+
|
|
2874
|
+
if (!/\.(js|mjs|ts|f7)$/.test(entry.name) || entry.name.endsWith(".min.js")) return;
|
|
2875
|
+
|
|
2876
|
+
let content = fs.readFileSync(fullPath, "utf8");
|
|
2877
|
+
if (!content.includes(ADMOB_OLD_CONFIG)) return;
|
|
2878
|
+
|
|
2879
|
+
content = content.split(ADMOB_OLD_CONFIG).join(ADMOB_NEXTGEN_CONFIG);
|
|
2880
|
+
fs.writeFileSync(fullPath, content, "utf8");
|
|
2881
|
+
console.log(`✏️ Updated AdMob config import in ${path.relative(process.cwd(), fullPath)}`);
|
|
2882
|
+
});
|
|
2883
|
+
};
|
|
2884
|
+
|
|
2885
|
+
scan(adsDir);
|
|
2886
|
+
};
|
|
2887
|
+
|
|
2888
|
+
const ensureAdmobNextgenFiles = async () => {
|
|
2889
|
+
const adsDir = path.join(process.cwd(), "src", "js", "Ads");
|
|
2890
|
+
if (!fs.existsSync(adsDir)) {
|
|
2891
|
+
console.log("ℹ️ Ads folder not found. Skipping AdMob nextgen file sync.");
|
|
2892
|
+
return;
|
|
2893
|
+
}
|
|
2894
|
+
|
|
2895
|
+
const nextgenPath = path.join(adsDir, ADMOB_NEXTGEN_FILE);
|
|
2896
|
+
const nextgenConfigPath = path.join(adsDir, ADMOB_NEXTGEN_CONFIG);
|
|
2897
|
+
const oldConfigPath = path.join(adsDir, ADMOB_OLD_CONFIG);
|
|
2898
|
+
const tempTemplatePath = path.join(adsDir, `${ADMOB_NEXTGEN_CONFIG}.template`);
|
|
2899
|
+
|
|
2900
|
+
if (!fs.existsSync(nextgenPath)) {
|
|
2901
|
+
const downloaded = await downloadOptionalCodeplayFile(ADMOB_NEXTGEN_FILE, nextgenPath);
|
|
2902
|
+
if (!downloaded) {
|
|
2903
|
+
console.error(`❌ ${ADMOB_NEXTGEN_FILE} missing and live download failed.`);
|
|
2904
|
+
process.exit(1);
|
|
2905
|
+
}
|
|
2906
|
+
}
|
|
2907
|
+
|
|
2908
|
+
let templateConfig = ADMOB_NEXTGEN_DEFAULTS;
|
|
2909
|
+
|
|
2910
|
+
if (await downloadOptionalCodeplayFile(ADMOB_NEXTGEN_CONFIG, tempTemplatePath)) {
|
|
2911
|
+
templateConfig = JSON.parse(fs.readFileSync(tempTemplatePath, "utf8"));
|
|
2912
|
+
fs.unlinkSync(tempTemplatePath);
|
|
2913
|
+
} else if (fs.existsSync(nextgenConfigPath)) {
|
|
2914
|
+
templateConfig = mergeObjects(ADMOB_NEXTGEN_DEFAULTS, JSON.parse(fs.readFileSync(nextgenConfigPath, "utf8")));
|
|
2915
|
+
}
|
|
2916
|
+
|
|
2917
|
+
const oldConfig = fs.existsSync(oldConfigPath)
|
|
2918
|
+
? JSON.parse(fs.readFileSync(oldConfigPath, "utf8"))
|
|
2919
|
+
: {};
|
|
2920
|
+
const existingNextgenConfig = fs.existsSync(nextgenConfigPath)
|
|
2921
|
+
? JSON.parse(fs.readFileSync(nextgenConfigPath, "utf8"))
|
|
2922
|
+
: {};
|
|
2923
|
+
|
|
2924
|
+
const mergedConfig = buildNextgenAdmobConfigFromOldConfig(templateConfig, existingNextgenConfig, oldConfig);
|
|
2925
|
+
|
|
2926
|
+
const capacitorConfig = readJsonSafe(configPath) || {};
|
|
2927
|
+
const legacyAdmobConfig = capacitorConfig.plugins?.AdMob || {};
|
|
2928
|
+
const mergedAppIds = getAdmobJsonAppIds(mergedConfig);
|
|
2929
|
+
const androidAppId = mergedAppIds.androidAppId || legacyAdmobConfig.APP_ID_ANDROID || "";
|
|
2930
|
+
const iosAppId = mergedAppIds.iosAppId || legacyAdmobConfig.APP_ID_IOS || "";
|
|
2931
|
+
|
|
2932
|
+
if (androidAppId && !mergedAppIds.androidAppId) {
|
|
2933
|
+
mergedConfig.androidAppId = androidAppId;
|
|
2934
|
+
}
|
|
2935
|
+
|
|
2936
|
+
if (iosAppId && !mergedAppIds.iosAppId) {
|
|
2937
|
+
mergedConfig.iosAppId = iosAppId;
|
|
2938
|
+
}
|
|
2939
|
+
|
|
2940
|
+
fs.writeFileSync(nextgenConfigPath, JSON.stringify(mergedConfig, null, 2) + "\n", "utf8");
|
|
2941
|
+
syncAdmobConfigImports();
|
|
2942
|
+
console.log("✅ AdMob nextgen files and configuration are ready.");
|
|
2943
|
+
};
|
|
2944
|
+
|
|
2945
|
+
const syncAdmobNextgenMigration = async () => {
|
|
2946
|
+
syncAdmobNextgenPackage();
|
|
2947
|
+
await ensureAdmobNextgenFiles();
|
|
2948
|
+
syncAdmobAliasInViteConfig();
|
|
2949
|
+
};
|
|
2950
|
+
|
|
2682
2951
|
const syncSystemBarsSafeAreaMigration = () => {
|
|
2683
2952
|
if (isPackageAvailable("@capacitor-community/safe-area")) {
|
|
2684
2953
|
runNpmCommand("npm uninstall @capacitor-community/safe-area");
|
|
@@ -3368,24 +3637,9 @@ function ensureGitignoreEntry(entry) {
|
|
|
3368
3637
|
ensureGitignoreEntry('buildCodeplay/');
|
|
3369
3638
|
|
|
3370
3639
|
|
|
3371
|
-
//
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
await loadPluginVersions(); // 🔥 NEW
|
|
3375
|
-
|
|
3376
|
-
syncSystemBarsSafeAreaMigration();
|
|
3377
|
-
await checkPlugins();
|
|
3378
|
-
syncRevenueCatIapSetup();
|
|
3379
|
-
syncFirebaseAnalyticsSetup();
|
|
3380
|
-
checkAndupdateDropInViteConfig();
|
|
3381
|
-
syncAdmobAliasInViteConfig();
|
|
3382
|
-
checkAdmobConfigurationProperty()
|
|
3383
|
-
})();
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
// ======================================================
|
|
3387
|
-
// Validate theme folder location (src/js/theme is NOT allowed)
|
|
3388
|
-
// ======================================================
|
|
3640
|
+
// ======================================================
|
|
3641
|
+
// Validate theme folder location (src/js/theme is NOT allowed)
|
|
3642
|
+
// ======================================================
|
|
3389
3643
|
|
|
3390
3644
|
function validateThemeFolderLocation() {
|
|
3391
3645
|
const oldThemePath = path.join(process.cwd(), 'src', 'js', 'theme');
|
|
@@ -3415,11 +3669,7 @@ function validateThemeFolderLocation() {
|
|
|
3415
3669
|
console.log('✅ Theme folder structure validated (src/theme).');
|
|
3416
3670
|
}
|
|
3417
3671
|
}
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
const validateAndRestoreSignDetails=()=>{
|
|
3672
|
+
const validateAndRestoreSignDetails=()=>{
|
|
3423
3673
|
|
|
3424
3674
|
// Read config file
|
|
3425
3675
|
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
@@ -3451,18 +3701,7 @@ const validateAndRestoreSignDetails=()=>{
|
|
|
3451
3701
|
|
|
3452
3702
|
}
|
|
3453
3703
|
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
execSync('node buildCodeplay/fix-onesignal-plugin.js', { stdio: 'inherit' });
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
//################################## SystemBars.java update for "@capacitor/android": "^8.3.0" plugin START ###############################
|
|
3704
|
+
//################################## SystemBars.java update for "@capacitor/android": "^8.3.0" plugin START ###############################
|
|
3466
3705
|
|
|
3467
3706
|
|
|
3468
3707
|
const filePath = path.join(
|
|
@@ -3568,13 +3807,34 @@ function patchFile() {
|
|
|
3568
3807
|
console.log("✅ SystemBars.java patched with Codeplay keyboard inset fix!");
|
|
3569
3808
|
}
|
|
3570
3809
|
|
|
3571
|
-
//patchFile();
|
|
3572
|
-
|
|
3573
|
-
//################################## SystemBars.java update for "@capacitor/android": "^8.3.0" plugin END ###############################
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3810
|
+
//patchFile();
|
|
3811
|
+
|
|
3812
|
+
//################################## SystemBars.java update for "@capacitor/android": "^8.3.0" plugin END ###############################
|
|
3813
|
+
|
|
3814
|
+
async function main() {
|
|
3815
|
+
validateThemeFolderLocation();
|
|
3816
|
+
validateAndRestoreSignDetails();
|
|
3817
|
+
execSync('node buildCodeplay/fix-onesignal-plugin.js', { stdio: 'inherit' });
|
|
3818
|
+
|
|
3819
|
+
await loadPluginVersions(); // 🔥 NEW
|
|
3820
|
+
|
|
3821
|
+
await syncAdmobNextgenMigration();
|
|
3822
|
+
syncSystemBarsSafeAreaMigration();
|
|
3823
|
+
await checkPlugins();
|
|
3824
|
+
syncRevenueCatIapSetup();
|
|
3825
|
+
syncFirebaseAnalyticsSetup();
|
|
3826
|
+
checkAndupdateDropInViteConfig();
|
|
3827
|
+
checkAdmobConfigurationProperty();
|
|
3828
|
+
}
|
|
3829
|
+
|
|
3830
|
+
main().catch(err => {
|
|
3831
|
+
console.error(err?.message || err);
|
|
3832
|
+
process.exit(1);
|
|
3833
|
+
});
|
|
3834
|
+
|
|
3835
|
+
|
|
3836
|
+
|
|
3837
|
+
|
|
3578
3838
|
/*
|
|
3579
3839
|
Release Notes
|
|
3580
3840
|
|