codeplay-common 3.1.7 â 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.
|
@@ -327,13 +327,16 @@ checkAppUniqueId();
|
|
|
327
327
|
|
|
328
328
|
const jsDir = path.join(__dirname, "..", "src", "js");
|
|
329
329
|
|
|
330
|
-
//
|
|
330
|
+
// đ Detect OLD structure
|
|
331
331
|
const oldEditorDirs = fs.readdirSync(jsDir)
|
|
332
332
|
.filter(name => /^editor-\d+\.\d+$/.test(name));
|
|
333
333
|
|
|
334
|
-
//
|
|
334
|
+
// đ New structure path (optional, not mandatory)
|
|
335
335
|
const newEditorBaseDir = path.join(jsDir, "editor");
|
|
336
336
|
|
|
337
|
+
// ======================================================
|
|
338
|
+
// â CASE 1: OLD STRUCTURE FOUND â STOP
|
|
339
|
+
// ======================================================
|
|
337
340
|
if (oldEditorDirs.length > 0) {
|
|
338
341
|
|
|
339
342
|
console.error(`
|
|
@@ -342,127 +345,98 @@ if (oldEditorDirs.length > 0) {
|
|
|
342
345
|
You are using outdated folder structure:
|
|
343
346
|
src/js/editor-x.x/
|
|
344
347
|
|
|
345
|
-
đ¨ This
|
|
348
|
+
đ¨ This is no longer supported.
|
|
346
349
|
|
|
347
|
-
|
|
348
|
-
src/js/editor/editor-x.x/
|
|
349
|
-
|
|
350
|
-
đĻ Your existing folders:
|
|
350
|
+
đĻ Found folders:
|
|
351
351
|
${oldEditorDirs.map(d => " - " + d).join("\n")}
|
|
352
352
|
|
|
353
|
-
đ Please move them manually
|
|
353
|
+
đ Please move them manually:
|
|
354
354
|
|
|
355
355
|
src/js/editor-1.6
|
|
356
|
-
âŦ
|
|
356
|
+
âŦ
|
|
357
357
|
src/js/editor/editor-1.6
|
|
358
358
|
|
|
359
|
-
â ī¸
|
|
359
|
+
â ī¸ Also ensure:
|
|
360
|
+
src/js/editor/configuration.json exists
|
|
360
361
|
|
|
361
|
-
â Build stopped
|
|
362
|
+
â Build stopped.
|
|
362
363
|
`);
|
|
363
364
|
|
|
364
365
|
process.exit(1);
|
|
365
366
|
}
|
|
366
367
|
|
|
367
|
-
//
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
â MISSING EDITOR DIRECTORY
|
|
372
|
-
|
|
373
|
-
Expected path:
|
|
374
|
-
src/js/editor/
|
|
375
|
-
|
|
376
|
-
But it was not found.
|
|
377
|
-
|
|
378
|
-
đ Please create the folder and move editor-x.x inside it.
|
|
379
|
-
|
|
380
|
-
Example:
|
|
381
|
-
src/js/editor/editor-1.6/
|
|
382
|
-
`);
|
|
383
|
-
|
|
384
|
-
process.exit(1);
|
|
385
|
-
}
|
|
368
|
+
// ======================================================
|
|
369
|
+
// â
CASE 2: NEW STRUCTURE EXISTS â VALIDATE
|
|
370
|
+
// ======================================================
|
|
371
|
+
if (fs.existsSync(newEditorBaseDir)) {
|
|
386
372
|
|
|
373
|
+
// đ Find editor-x.x inside new folder
|
|
374
|
+
const editorDirs = fs.readdirSync(newEditorBaseDir)
|
|
375
|
+
.filter(name => /^editor-\d+\.\d+$/.test(name));
|
|
387
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
|
+
}
|
|
388
382
|
|
|
389
|
-
// ======================================================
|
|
390
|
-
// Validate
|
|
391
|
-
// ======================================================
|
|
383
|
+
// ======================================================
|
|
384
|
+
// â
Validate configuration.json (NEW RULE)
|
|
385
|
+
// ======================================================
|
|
392
386
|
|
|
393
|
-
const editorConfigPath = path.join(newEditorBaseDir, "configuration.json");
|
|
387
|
+
const editorConfigPath = path.join(newEditorBaseDir, "configuration.json");
|
|
394
388
|
|
|
395
|
-
// â
|
|
396
|
-
if (!fs.existsSync(editorConfigPath)) {
|
|
397
|
-
|
|
389
|
+
// â Missing config
|
|
390
|
+
if (!fs.existsSync(editorConfigPath)) {
|
|
391
|
+
console.error(`
|
|
398
392
|
â MISSING EDITOR CONFIGURATION FILE
|
|
399
393
|
|
|
400
|
-
Required
|
|
394
|
+
Required:
|
|
401
395
|
src/js/editor/configuration.json
|
|
402
396
|
|
|
403
|
-
đ This file is mandatory in new editor structure.
|
|
404
|
-
|
|
405
|
-
đĻ Please ensure:
|
|
406
|
-
src/js/editor/configuration.json exists
|
|
407
|
-
|
|
408
397
|
â Build stopped.
|
|
409
398
|
`);
|
|
410
|
-
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
// â Check for OLD structure mistake inside version folders
|
|
414
|
-
const invalidConfigLocations = [];
|
|
415
|
-
|
|
416
|
-
const editorSubDirs = fs.readdirSync(newEditorBaseDir)
|
|
417
|
-
.filter(name => /^editor-\d+\.\d+$/.test(name));
|
|
399
|
+
process.exit(1);
|
|
400
|
+
}
|
|
418
401
|
|
|
419
|
-
|
|
420
|
-
const
|
|
402
|
+
// â Check wrong placement
|
|
403
|
+
const invalidConfigs = [];
|
|
421
404
|
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
});
|
|
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
|
+
});
|
|
426
411
|
|
|
427
|
-
if (
|
|
428
|
-
|
|
429
|
-
â INVALID
|
|
412
|
+
if (invalidConfigs.length > 0) {
|
|
413
|
+
console.error(`
|
|
414
|
+
â INVALID CONFIGURATION LOCATION
|
|
430
415
|
|
|
431
416
|
đĢ configuration.json must NOT be inside version folders.
|
|
432
417
|
|
|
433
|
-
Found
|
|
434
|
-
${
|
|
418
|
+
Found:
|
|
419
|
+
${invalidConfigs.map(p => " - " + p).join("\n")}
|
|
435
420
|
|
|
436
|
-
â
Correct
|
|
421
|
+
â
Correct:
|
|
437
422
|
src/js/editor/configuration.json
|
|
438
423
|
|
|
439
|
-
đ Please MOVE or DELETE the above files.
|
|
440
|
-
|
|
441
424
|
â Build stopped.
|
|
442
425
|
`);
|
|
443
|
-
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
console.log("â
Editor configuration structure validated.");
|
|
447
|
-
|
|
426
|
+
process.exit(1);
|
|
427
|
+
}
|
|
448
428
|
|
|
429
|
+
console.log("â
Editor structure validated.");
|
|
449
430
|
|
|
431
|
+
// ======================================================
|
|
432
|
+
// đ Continue execution (run.js)
|
|
433
|
+
// ======================================================
|
|
450
434
|
|
|
451
|
-
|
|
452
|
-
const
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
const [aMajor, aMinor] = getVersion(a);
|
|
457
|
-
const [bMajor, bMinor] = getVersion(b);
|
|
458
|
-
return bMajor - aMajor || bMinor - aMinor;
|
|
459
|
-
});
|
|
460
|
-
|
|
461
|
-
if (editorDirs.length === 0) {
|
|
462
|
-
console.log("@Codemirror editor(s) not found inside src/js/editor/");
|
|
463
|
-
} else {
|
|
464
|
-
|
|
465
|
-
const latestEditorDir = editorDirs[0];
|
|
435
|
+
const latestEditorDir = editorDirs.sort((a, b) => {
|
|
436
|
+
const vA = parseFloat(a.split('-')[1]);
|
|
437
|
+
const vB = parseFloat(b.split('-')[1]);
|
|
438
|
+
return vB - vA;
|
|
439
|
+
})[0];
|
|
466
440
|
|
|
467
441
|
const runJsPath = path.join(newEditorBaseDir, latestEditorDir, "run.js");
|
|
468
442
|
|
|
@@ -475,6 +449,13 @@ if (editorDirs.length === 0) {
|
|
|
475
449
|
execSync(`node "${runJsPath}"`, { stdio: "inherit" });
|
|
476
450
|
}
|
|
477
451
|
|
|
452
|
+
// ======================================================
|
|
453
|
+
// â
CASE 3: NOTHING EXISTS â DO NOTHING
|
|
454
|
+
// ======================================================
|
|
455
|
+
else {
|
|
456
|
+
console.log("âšī¸ Editor not used in this project. Skipping...");
|
|
457
|
+
}
|
|
458
|
+
|
|
478
459
|
//@Codemirror check and install/uninstall the packages END
|
|
479
460
|
|
|
480
461
|
|