codeplay-common 1.4.0 → 1.4.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.
|
@@ -308,6 +308,44 @@ if (updated) {
|
|
|
308
308
|
|
|
309
309
|
|
|
310
310
|
|
|
311
|
+
// To resolve the kotlin version issue, we need to update the kotlin version in the build.gradle file START
|
|
312
|
+
|
|
313
|
+
// Build the path dynamically like you requested
|
|
314
|
+
const gradlePath = path.join(
|
|
315
|
+
process.cwd(),
|
|
316
|
+
'android',
|
|
317
|
+
'build.gradle'
|
|
318
|
+
);
|
|
319
|
+
|
|
320
|
+
// Read the existing build.gradle
|
|
321
|
+
let gradleContent = fs.readFileSync(gradlePath, 'utf8');
|
|
322
|
+
|
|
323
|
+
// Add `ext.kotlin_version` if it's not already there
|
|
324
|
+
if (!gradleContent.includes('ext.kotlin_version')) {
|
|
325
|
+
gradleContent = gradleContent.replace(
|
|
326
|
+
/buildscript\s*{/,
|
|
327
|
+
`buildscript {\n ext.kotlin_version = '2.1.0'`
|
|
328
|
+
);
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
// Add Kotlin classpath if it's not already there
|
|
332
|
+
if (!gradleContent.includes('org.jetbrains.kotlin:kotlin-gradle-plugin')) {
|
|
333
|
+
gradleContent = gradleContent.replace(
|
|
334
|
+
/dependencies\s*{([\s\S]*?)classpath 'com.android.tools.build:gradle:8.7.2'/,
|
|
335
|
+
`dependencies {\n classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version")\n$1classpath 'com.android.tools.build:gradle:8.7.2'`
|
|
336
|
+
);
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
// Write back the modified content
|
|
340
|
+
fs.writeFileSync(gradlePath, gradleContent, 'utf8');
|
|
341
|
+
|
|
342
|
+
console.log('✅ Kotlin version updated in build.gradle.');
|
|
343
|
+
|
|
344
|
+
// To resolve the kotlin version issue, we need to update the kotlin version in the build.gradle file END
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
|
|
311
349
|
|
|
312
350
|
|
|
313
351
|
|
|
@@ -10,6 +10,8 @@ const storeNames = {
|
|
|
10
10
|
"7": "AmazonStore"
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
+
const amazonMinSdkVersion=23;
|
|
14
|
+
|
|
13
15
|
const androidManifestPath = path.join("android", "app", "src", "main", "AndroidManifest.xml");
|
|
14
16
|
|
|
15
17
|
|
|
@@ -259,11 +261,11 @@ const rl = readline.createInterface({
|
|
|
259
261
|
|
|
260
262
|
// Ask for new versionCode
|
|
261
263
|
rl.question('Enter new versionCode (press enter to keep current): ', (newVersionCode) => {
|
|
262
|
-
const finalVersionCode =
|
|
264
|
+
const finalVersionCode = versionCode; // Use existing if no input
|
|
263
265
|
|
|
264
266
|
// Ask for new versionName
|
|
265
267
|
rl.question('Enter new versionName (press enter to keep current): ', (newVersionName) => {
|
|
266
|
-
const finalVersionName =
|
|
268
|
+
const finalVersionName = versionName; // Use existing if no input
|
|
267
269
|
|
|
268
270
|
// Log the final version details
|
|
269
271
|
console.log(`📦 Final versionCode: ${finalVersionCode}`);
|
|
@@ -325,7 +327,7 @@ rl.question('Enter new versionCode (press enter to keep current): ', (newVersion
|
|
|
325
327
|
|
|
326
328
|
// Conditionally set the new file name
|
|
327
329
|
let newFileName;
|
|
328
|
-
|
|
330
|
+
let storeName = storeNames[id];
|
|
329
331
|
|
|
330
332
|
managePackages(storeName);
|
|
331
333
|
|
|
@@ -337,6 +339,7 @@ rl.question('Enter new versionCode (press enter to keep current): ', (newVersion
|
|
|
337
339
|
newFileName = `app-release-signed-${storeName}-b${finalVersionCode}-v${finalVersionName}.aab`;
|
|
338
340
|
}
|
|
339
341
|
|
|
342
|
+
//storeName="amazon"
|
|
340
343
|
const checkFullPath = path.join("AAB", newFileName); // Update to point to the new AAB directory
|
|
341
344
|
|
|
342
345
|
// Modify minSdkVersion in variables.gradle for SamsungStore
|
|
@@ -361,13 +364,15 @@ rl.question('Enter new versionCode (press enter to keep current): ', (newVersion
|
|
|
361
364
|
}
|
|
362
365
|
} else {
|
|
363
366
|
// For PlayStore and AmazonStore, ensure minSdkVersion is originalMinSdkVersion
|
|
364
|
-
if (currentMinSdkVersion !== originalMinSdkVersion) {
|
|
365
|
-
variablesGradleContent = variablesGradleContent.replace(/minSdkVersion\s*=\s*\d+/, `minSdkVersion = ${
|
|
366
|
-
console.log(`minSdkVersion reverted to ${
|
|
367
|
+
//if (currentMinSdkVersion !== originalMinSdkVersion) {
|
|
368
|
+
variablesGradleContent = variablesGradleContent.replace(/minSdkVersion\s*=\s*\d+/, `minSdkVersion = ${amazonMinSdkVersion}`);
|
|
369
|
+
console.log(`minSdkVersion reverted to ${amazonMinSdkVersion} for ${storeName}`);
|
|
367
370
|
fs.writeFileSync(variablesGradleFilePath, variablesGradleContent);
|
|
368
|
-
}
|
|
371
|
+
//}
|
|
369
372
|
}
|
|
370
373
|
|
|
374
|
+
|
|
375
|
+
|
|
371
376
|
// Run the Node.js script to modify plugin.xml
|
|
372
377
|
if (isAdmobFound) {
|
|
373
378
|
child_process.execSync('node buildCodeplay/modify-plugin-xml.js', { stdio: 'inherit' });
|
|
@@ -396,6 +401,12 @@ rl.question('Enter new versionCode (press enter to keep current): ', (newVersion
|
|
|
396
401
|
child_process.execSync('npx cap build android --androidreleasetype=AAB', { stdio: 'inherit' });
|
|
397
402
|
|
|
398
403
|
|
|
404
|
+
|
|
405
|
+
variablesGradleContent = variablesGradleContent.replace(/minSdkVersion\s*=\s*\d+/, 'minSdkVersion = 24');
|
|
406
|
+
console.log('minSdkVersion revert to 24 (default)');
|
|
407
|
+
fs.writeFileSync(variablesGradleFilePath, variablesGradleContent);
|
|
408
|
+
|
|
409
|
+
|
|
399
410
|
// Rename the output AAB file
|
|
400
411
|
const oldFilePath = path.join(aabDirectory, "app-release-signed.aab");
|
|
401
412
|
if (fs.existsSync(oldFilePath)) {
|