mega-brain-ai 1.2.0 → 1.2.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.
- package/bin/lib/installer.js +15 -2
- package/package.json +1 -1
package/bin/lib/installer.js
CHANGED
|
@@ -299,12 +299,15 @@ async function fetchPremiumContent(targetDir, token, spinner) {
|
|
|
299
299
|
|
|
300
300
|
// Copy premium content over the shell (merge, not replace)
|
|
301
301
|
const excludeDirs = ['.git', 'node_modules', 'bin', '.layer-sync'];
|
|
302
|
+
const normalizedTemp = resolve(tempDir);
|
|
302
303
|
cpSync(tempDir, targetDir, {
|
|
303
304
|
recursive: true,
|
|
304
305
|
force: true,
|
|
305
306
|
filter: (src) => {
|
|
307
|
+
const rel = resolve(src).slice(normalizedTemp.length);
|
|
306
308
|
for (const exclude of excludeDirs) {
|
|
307
|
-
if (
|
|
309
|
+
if (rel.includes(`/${exclude}/`) || rel.includes(`\\${exclude}\\`)
|
|
310
|
+
|| rel.endsWith(`/${exclude}`) || rel.endsWith(`\\${exclude}`)) {
|
|
308
311
|
return false;
|
|
309
312
|
}
|
|
310
313
|
}
|
|
@@ -366,12 +369,22 @@ function showPostInstallCommunity() {
|
|
|
366
369
|
}
|
|
367
370
|
|
|
368
371
|
function copyTemplateFiles(source, target, excludeDirs) {
|
|
372
|
+
// Normalize source path for reliable relative path computation
|
|
373
|
+
const normalizedSource = resolve(source);
|
|
374
|
+
|
|
369
375
|
try {
|
|
370
376
|
cpSync(source, target, {
|
|
371
377
|
recursive: true,
|
|
372
378
|
filter: (src) => {
|
|
379
|
+
// Get the path RELATIVE to the source root.
|
|
380
|
+
// This is critical because when running via npx, the absolute path
|
|
381
|
+
// contains "node_modules/" which would match the exclude filter
|
|
382
|
+
// and block ALL files from being copied.
|
|
383
|
+
const relativePath = resolve(src).slice(normalizedSource.length);
|
|
384
|
+
|
|
373
385
|
for (const exclude of excludeDirs) {
|
|
374
|
-
if (
|
|
386
|
+
if (relativePath.includes(`/${exclude}/`) || relativePath.includes(`\\${exclude}\\`)
|
|
387
|
+
|| relativePath.endsWith(`/${exclude}`) || relativePath.endsWith(`\\${exclude}`)) {
|
|
375
388
|
return false;
|
|
376
389
|
}
|
|
377
390
|
}
|