codeplay-common 3.1.6 → 3.1.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.
@@ -325,46 +325,137 @@ checkAppUniqueId();
325
325
  //const path = require("path");
326
326
  //const { execSync } = require("child_process");
327
327
 
328
- const baseDir = path.join(__dirname, "..", "src", "js");
329
-
330
- // Step 1: Find highest versioned folder like `editor-1.6`
331
- const editorDirs = fs.readdirSync(baseDir)
332
- .filter(name => /^editor-\d+\.\d+$/.test(name))
333
- .sort((a, b) => {
334
- const getVersion = str => str.match(/(\d+)\.(\d+)/).slice(1).map(Number);
335
- const [aMajor, aMinor] = getVersion(a);
336
- const [bMajor, bMinor] = getVersion(b);
337
- return bMajor - aMajor || bMinor - aMinor;
338
- });
328
+ const jsDir = path.join(__dirname, "..", "src", "js");
339
329
 
340
- if (editorDirs.length === 0) {
341
-
342
- console.log("@Codemirror used editor(s) are not found")
343
- //console.error("❌ No editor-x.x folders found in src/js.");
344
- //process.exit(1);
330
+ // 🔍 Detect OLD structure
331
+ const oldEditorDirs = fs.readdirSync(jsDir)
332
+ .filter(name => /^editor-\d+\.\d+$/.test(name));
333
+
334
+ // 📁 New structure path (optional, not mandatory)
335
+ const newEditorBaseDir = path.join(jsDir, "editor");
336
+
337
+ // ======================================================
338
+ // ❌ CASE 1: OLD STRUCTURE FOUND → STOP
339
+ // ======================================================
340
+ if (oldEditorDirs.length > 0) {
341
+
342
+ console.error(`
343
+ ❌ OLD EDITOR STRUCTURE DETECTED
344
+
345
+ You are using outdated folder structure:
346
+ src/js/editor-x.x/
347
+
348
+ 🚨 This is no longer supported.
349
+
350
+ đŸ“Ļ Found folders:
351
+ ${oldEditorDirs.map(d => " - " + d).join("\n")}
352
+
353
+ 👉 Please move them manually:
354
+
355
+ src/js/editor-1.6
356
+ âŦ‡
357
+ src/js/editor/editor-1.6
358
+
359
+ âš ī¸ Also ensure:
360
+ src/js/editor/configuration.json exists
361
+
362
+ ❌ Build stopped.
363
+ `);
364
+
365
+ process.exit(1);
345
366
  }
346
- else
347
- {
367
+
368
+ // ======================================================
369
+ // ✅ CASE 2: NEW STRUCTURE EXISTS → VALIDATE
370
+ // ======================================================
371
+ if (fs.existsSync(newEditorBaseDir)) {
372
+
373
+ // 🔍 Find editor-x.x inside new folder
374
+ const editorDirs = fs.readdirSync(newEditorBaseDir)
375
+ .filter(name => /^editor-\d+\.\d+$/.test(name));
376
+
377
+ // 👉 If editor folder exists but no versions → skip safely
378
+ if (editorDirs.length === 0) {
379
+ console.log("â„šī¸ No editor-x.x folders found inside src/js/editor/");
380
+ return;
381
+ }
382
+
383
+ // ======================================================
384
+ // ✅ Validate configuration.json (NEW RULE)
385
+ // ======================================================
386
+
387
+ const editorConfigPath = path.join(newEditorBaseDir, "configuration.json");
388
+
389
+ // ❌ Missing config
390
+ if (!fs.existsSync(editorConfigPath)) {
391
+ console.error(`
392
+ ❌ MISSING EDITOR CONFIGURATION FILE
393
+
394
+ Required:
395
+ src/js/editor/configuration.json
396
+
397
+ ❌ Build stopped.
398
+ `);
399
+ process.exit(1);
400
+ }
401
+
402
+ // ❌ Check wrong placement
403
+ const invalidConfigs = [];
404
+
405
+ editorDirs.forEach(dir => {
406
+ const wrongPath = path.join(newEditorBaseDir, dir, "configuration.json");
407
+ if (fs.existsSync(wrongPath)) {
408
+ invalidConfigs.push(`src/js/editor/${dir}/configuration.json`);
409
+ }
410
+ });
411
+
412
+ if (invalidConfigs.length > 0) {
413
+ console.error(`
414
+ ❌ INVALID CONFIGURATION LOCATION
415
+
416
+ đŸšĢ configuration.json must NOT be inside version folders.
417
+
418
+ Found:
419
+ ${invalidConfigs.map(p => " - " + p).join("\n")}
420
+
421
+ ✅ Correct:
422
+ src/js/editor/configuration.json
423
+
424
+ ❌ Build stopped.
425
+ `);
426
+ process.exit(1);
427
+ }
428
+
429
+ console.log("✅ Editor structure validated.");
430
+
431
+ // ======================================================
432
+ // 🚀 Continue execution (run.js)
433
+ // ======================================================
348
434
 
349
435
  const latestEditorDir = editorDirs.sort((a, b) => {
350
- const versionA = parseFloat(a.split('-')[1]);
351
- const versionB = parseFloat(b.split('-')[1]);
352
- return versionB - versionA;
436
+ const vA = parseFloat(a.split('-')[1]);
437
+ const vB = parseFloat(b.split('-')[1]);
438
+ return vB - vA;
353
439
  })[0];
354
440
 
355
- //const latestEditorDir = editorDirs[editorDirs.length - 1];
356
- const runJsPath = path.join(baseDir, latestEditorDir, "run.js");
441
+ const runJsPath = path.join(newEditorBaseDir, latestEditorDir, "run.js");
357
442
 
358
443
  if (!fs.existsSync(runJsPath)) {
359
444
  console.error(`❌ run.js not found in ${latestEditorDir}`);
360
445
  process.exit(1);
361
446
  }
362
447
 
363
- // Step 2: Execute the run.js file
364
448
  console.log(`🚀 Executing ${runJsPath}...`);
365
449
  execSync(`node "${runJsPath}"`, { stdio: "inherit" });
366
450
  }
367
451
 
452
+ // ======================================================
453
+ // ✅ CASE 3: NOTHING EXISTS → DO NOTHING
454
+ // ======================================================
455
+ else {
456
+ console.log("â„šī¸ Editor not used in this project. Skipping...");
457
+ }
458
+
368
459
  //@Codemirror check and install/uninstall the packages END
369
460
 
370
461
 
@@ -1,21 +1,26 @@
1
1
  {
2
2
  "plugins":[
3
- {"name":"backbutton","pattern":"backbutton-(\\d+\\.\\d+)\\.js$","minVersion":"2.0","baseDir":"js","mandatoryUpdate":true},
4
- {"name":"common-js","pattern":"common-(\\d+\\.\\d+)(?:-beta-(\\d+))?\\.js$","minVersion":"6.0","baseDir":"js","mandatoryUpdate":true},
3
+ {"name":"backbutton","pattern":"backbutton-(\\d+\\.\\d+)\\.js$","minVersion":"2.1","baseDir":"js","mandatoryUpdate":true},
4
+ {"name":"common-js","pattern":"common-(\\d+\\.\\d+)(?:-beta-(\\d+))?\\.js$","minVersion":"6.2","baseDir":"js","mandatoryUpdate":true},
5
5
  {"name":"localization_settings","pattern":"localization_settings-(\\d+\\.\\d+)\\.js$","minVersion":"1.1","baseDir":"js","mandatoryUpdate":true},
6
6
  {"name":"localization","pattern":"localization-(\\d+\\.\\d+)\\.js$","minVersion":"1.5","baseDir":"js","mandatoryUpdate":true},
7
- {"name":"admob-emi","pattern":"Ads[\\\\/]admob-emi-(\\d+\\.\\d+)\\.js$","minVersion":"3.7","baseDir":"js","mandatoryUpdate":true},
7
+ {"name":"admob-emi","pattern":"Ads[\\\\/]admob-emi-(\\d+\\.\\d+)\\.js$","minVersion":"4.1","baseDir":"js","mandatoryUpdate":true},
8
8
  {"name":"video-player","pattern":"video-player-(\\d+\\.\\d+)\\.js$","minVersion":"1.6","baseDir":"js","mandatoryUpdate":true},
9
9
  {"name":"image-cropper","pattern":"image-cropper-(\\d+\\.\\d+)\\.js$","minVersion":"1.1","baseDir":"js","mandatoryUpdate":true},
10
- {"name":"editor","pattern":"editor-(\\d+\\.\\d+)$","minVersion":"1.9","baseDir":"js","mandatoryUpdate":true,"isFolder":true},
10
+
11
+ {"name":"beautify","pattern":"beautify-(\\d+\\.\\d+)\\.js$","minVersion":"1.1","baseDir":"js","mandatoryUpdate":true},
12
+
13
+
14
+ {"name":"editor","pattern":"editor-(\\d+\\.\\d+)$","minVersion":"2.0","baseDir":"js/editor","mandatoryUpdate":true,"isFolder":true},
15
+
11
16
  {"name":"ffmpeg","pattern":"ffmpeg-(\\d+\\.\\d+)$","minVersion":"1.6","baseDir":"js","mandatoryUpdate":true,"isFolder":true},
12
- {"name":"theme","pattern":"theme-(\\d+\\.\\d+)$","minVersion":"3.3","baseDir":"theme","destDir":"theme","mandatoryUpdate":true,"isFolder":true},
13
- {"name":"certificatejs","pattern":"certificatejs-(\\d+\\.\\d+)$","minVersion":"1.6","baseDir":"certificate","destDir":"certificate","mandatoryUpdate":true,"isFolder":true},
14
- {"name":"IAP","pattern":"IAP-(\\d+\\.\\d+)$","minVersion":"2.8","baseDir":"js/Ads","mandatoryUpdate":true,"isFolder":true},
15
- {"name":"common-less","pattern":"common-(\\d+\\.\\d+)\\.less$","minVersion":"1.7","baseDir":"assets/css","mandatoryUpdate":true},
17
+ {"name":"theme","pattern":"theme-(\\d+\\.\\d+)$","minVersion":"3.5","baseDir":"theme","destDir":"theme","mandatoryUpdate":true,"isFolder":true},
18
+ {"name":"certificatejs","pattern":"certificatejs-(\\d+\\.\\d+)$","minVersion":"1.9","baseDir":"certificate","destDir":"certificate","mandatoryUpdate":true,"isFolder":true},
19
+ {"name":"IAP","pattern":"IAP-(\\d+\\.\\d+)$","minVersion":"3.0","baseDir":"js/Ads","mandatoryUpdate":true,"isFolder":true},
20
+ {"name":"common-less","pattern":"common-(\\d+\\.\\d+)\\.less$","minVersion":"1.8","baseDir":"assets/css","mandatoryUpdate":true},
16
21
  {"name":"localNotification_AppSettings","pattern":"localNotification_AppSettings-(\\d+\\.\\d+)\\.js$","minVersion":"1.0","baseDir":"js","mandatoryUpdate":true},
17
22
  {"name":"localNotification","pattern":"localNotification-(\\d+\\.\\d+)\\.js$","minVersion":"2.2","baseDir":"js","mandatoryUpdate":true},
18
- {"name":"onesignal","pattern":"onesignal-(\\d+\\.\\d+)\\.js$","minVersion":"2.3","baseDir":"js","mandatoryUpdate":true},
23
+ {"name":"onesignal","pattern":"onesignal-(\\d+\\.\\d+)\\.js$","minVersion":"2.4","baseDir":"js","mandatoryUpdate":true},
19
24
  {"name":"saveToGalleryAndSaveAnyFile","pattern":"saveToGalleryAndSaveAnyFile-(\\d+\\.\\d+)(-ios)?\\.js$","minVersion":"3.1","baseDir":"js","mandatoryUpdate":true}
20
25
  ]
21
26
  }