codeplay-common 3.0.8 → 3.0.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.
@@ -1284,72 +1284,79 @@ async function autoUpdatePlugin(pluginDef, pluginInfo) {
1284
1284
 
1285
1285
  return true;
1286
1286
  }
1287
+ // ===============================
1288
+ // FILE PLUGIN UPDATE
1289
+ // ===============================
1287
1290
 
1288
- // ===============================
1289
- // FILE PLUGIN UPDATE
1290
- // ===============================
1291
+ const pluginDir = path.dirname(oldFullPath);
1291
1292
 
1292
- const pluginDir = path.dirname(oldFullPath);
1293
+ // Only this plugin has ios variant
1294
+ const IOS_VARIANT_PLUGINS = [
1295
+ "saveToGalleryAndSaveAnyFile"
1296
+ ];
1293
1297
 
1294
- const variants = [
1295
- `${baseName}-${latestVersion}.js`,
1296
- `${baseName}-${latestVersion}-ios.js`
1297
- ];
1298
+ let variants = [
1299
+ `${baseName}-${latestVersion}.js`
1300
+ ];
1298
1301
 
1299
- let downloaded = [];
1302
+ if (IOS_VARIANT_PLUGINS.includes(baseName)) {
1303
+ variants.push(`${baseName}-${latestVersion}-ios.js`);
1304
+ }
1300
1305
 
1301
- // Download new files first
1302
- for (const fileName of variants) {
1306
+ let downloaded = [];
1303
1307
 
1304
- const url = `https://htmlcodeplay.com/code-play-plugin/${fileName}`;
1308
+ // Download files
1309
+ for (const fileName of variants) {
1305
1310
 
1306
- console.log(`šŸ” Checking latest: ${fileName}`);
1311
+ const url = `https://htmlcodeplay.com/code-play-plugin/${fileName}`;
1307
1312
 
1308
- if (await urlExists(url)) {
1313
+ console.log(`šŸ” Checking latest: ${fileName}`);
1309
1314
 
1310
- const destPath = path.join(pluginDir, fileName);
1315
+ if (await urlExists(url)) {
1311
1316
 
1312
- await downloadFile(url, destPath);
1317
+ const destPath = path.join(pluginDir, fileName);
1313
1318
 
1314
- downloaded.push(fileName);
1319
+ await downloadFile(url, destPath);
1315
1320
 
1316
- console.log(`⬇ Downloaded → ${fileName}`);
1317
- }
1318
- }
1321
+ downloaded.push(fileName);
1319
1322
 
1320
- // If nothing downloaded → skip
1321
- if (downloaded.length === 0) {
1322
- console.log(`āŒ No files downloaded for ${baseName}`);
1323
- return false;
1323
+ console.log(`⬇ Downloaded → ${fileName}`);
1324
1324
  }
1325
+ }
1325
1326
 
1326
- // Remove old versions AFTER download
1327
- const existingFiles = fs.readdirSync(pluginDir);
1327
+ if (downloaded.length === 0) {
1328
+ console.log(`āŒ No files downloaded for ${baseName}`);
1329
+ return false;
1330
+ }
1328
1331
 
1329
- existingFiles.forEach(file => {
1332
+ // Remove ONLY versioned files (safe)
1333
+ const versionPattern = new RegExp(`^${baseName}-\\d+\\.\\d+(-ios)?\\.js$`);
1330
1334
 
1331
- if (
1332
- file.startsWith(baseName + "-") &&
1333
- file.endsWith(".js") &&
1334
- !downloaded.includes(file)
1335
- ) {
1335
+ const existingFiles = fs.readdirSync(pluginDir);
1336
1336
 
1337
- const oldPath = path.join(pluginDir, file);
1337
+ existingFiles.forEach(file => {
1338
1338
 
1339
- fs.unlinkSync(oldPath);
1339
+ if (
1340
+ versionPattern.test(file) &&
1341
+ !downloaded.includes(file)
1342
+ ) {
1340
1343
 
1341
- console.log(`šŸ—‘ Removed old file → ${file}`);
1342
- }
1344
+ const oldPath = path.join(pluginDir, file);
1343
1345
 
1344
- });
1346
+ fs.unlinkSync(oldPath);
1345
1347
 
1346
- const newFileName = `${baseName}-${latestVersion}.js`;
1348
+ console.log(`šŸ—‘ Removed old file → ${file}`);
1349
+ }
1347
1350
 
1348
- updateImports(oldFileName, newFileName);
1351
+ });
1349
1352
 
1350
- console.log(`āœ… Updated → ${newFileName}`);
1353
+ const newFileName = `${baseName}-${latestVersion}.js`;
1351
1354
 
1352
- return true;
1355
+ updateImports(oldFileName, newFileName);
1356
+
1357
+ console.log(`āœ… Updated → ${newFileName}`);
1358
+
1359
+ return true;
1353
1360
  }
1354
1361
 
1355
1362
 
@@ -1556,7 +1563,11 @@ if (hasMandatoryUpdate) {
1556
1563
  process.exit(1);
1557
1564
  }
1558
1565
 
1559
- console.log('\nšŸŽ‰ All mandatory plugins auto-updated!');
1566
+ console.log('\nšŸŽ‰ All mandatory plugins auto-updated! Rechecking plugins...\n');
1567
+
1568
+ // Re-run plugin check so outdated list becomes empty
1569
+ await checkPlugins();
1570
+ return;
1560
1571
  }
1561
1572
 
1562
1573
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codeplay-common",
3
- "version": "3.0.8",
3
+ "version": "3.0.9",
4
4
  "description": "Common build scripts and files",
5
5
  "scripts": {
6
6
  "postinstall": "node scripts/sync-files.js",