@qelos/plugins-cli 0.0.29 → 0.0.30
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/package.json +1 -1
- package/services/git-files.mjs +33 -0
package/package.json
CHANGED
package/services/git-files.mjs
CHANGED
|
@@ -446,6 +446,39 @@ export function prepareTempDirectories(classifiedFiles, tempDir) {
|
|
|
446
446
|
}
|
|
447
447
|
}
|
|
448
448
|
|
|
449
|
+
// If this is a config, check for $ref files and copy them too
|
|
450
|
+
if (type === 'configs' && file.endsWith('.config.json')) {
|
|
451
|
+
try {
|
|
452
|
+
const content = fs.readFileSync(dest, 'utf-8');
|
|
453
|
+
const config = JSON.parse(content);
|
|
454
|
+
const refs = findAllRefs(config);
|
|
455
|
+
|
|
456
|
+
for (const ref of refs) {
|
|
457
|
+
if (copiedRefs.has(ref)) continue;
|
|
458
|
+
|
|
459
|
+
// Resolve the ref path relative to the original file location
|
|
460
|
+
const originalDir = path.dirname(file);
|
|
461
|
+
const refSourcePath = path.resolve(originalDir, ref);
|
|
462
|
+
|
|
463
|
+
if (fs.existsSync(refSourcePath)) {
|
|
464
|
+
// Create the same directory structure in temp
|
|
465
|
+
// The ref is relative to the config file, so we need to copy it to the same relative path
|
|
466
|
+
const refDestPath = path.join(tempDir, 'configs', ref);
|
|
467
|
+
const refDestDir = path.dirname(refDestPath);
|
|
468
|
+
|
|
469
|
+
fs.mkdirSync(refDestDir, { recursive: true });
|
|
470
|
+
fs.copyFileSync(refSourcePath, refDestPath);
|
|
471
|
+
copiedRefs.add(ref);
|
|
472
|
+
logger.debug(`Copied referenced file ${ref} from ${refSourcePath} to ${refDestPath}`);
|
|
473
|
+
} else {
|
|
474
|
+
logger.debug(`Referenced file not found: ${refSourcePath}`);
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
} catch (error) {
|
|
478
|
+
logger.debug(`Failed to process refs for ${path.basename(file)}: ${error.message}`);
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
|
|
449
482
|
// If this is a plugin, check for micro-frontend HTML files and copy them too
|
|
450
483
|
if (type === 'plugins' && file.endsWith('.plugin.json')) {
|
|
451
484
|
try {
|