create-nexu 1.1.7 → 1.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.
Files changed (2) hide show
  1. package/dist/index.js +32 -0
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -590,6 +590,9 @@ function collectFileChanges(srcDir, destDir, category, basePath = "", checkDelet
590
590
  const srcPath = path4.join(srcDir, entry.name);
591
591
  const destPath = path4.join(destDir, entry.name);
592
592
  const relativePath = basePath ? path4.join(basePath, entry.name) : entry.name;
593
+ if (shouldExcludeFromDeletion(entry.name, relativePath)) {
594
+ continue;
595
+ }
593
596
  if (fs4.existsSync(srcPath)) continue;
594
597
  if (entry.isDirectory()) {
595
598
  changes.push(...collectDeletedFiles(destPath, category, relativePath));
@@ -600,6 +603,32 @@ function collectFileChanges(srcDir, destDir, category, basePath = "", checkDelet
600
603
  }
601
604
  return changes;
602
605
  }
606
+ var EXCLUDE_FROM_DELETION = [
607
+ "node_modules",
608
+ ".git",
609
+ ".turbo",
610
+ "dist",
611
+ "build",
612
+ ".next",
613
+ "coverage",
614
+ ".husky/_",
615
+ // Husky internal files
616
+ ".DS_Store"
617
+ ];
618
+ function shouldExcludeFromDeletion(name, relativePath) {
619
+ if (EXCLUDE_FROM_DELETION.includes(name)) {
620
+ return true;
621
+ }
622
+ for (const pattern of EXCLUDE_FROM_DELETION) {
623
+ if (relativePath.startsWith(pattern + "/") || relativePath.startsWith(pattern + path4.sep)) {
624
+ return true;
625
+ }
626
+ if (relativePath === pattern) {
627
+ return true;
628
+ }
629
+ }
630
+ return false;
631
+ }
603
632
  function collectDeletedFiles(destDir, category, basePath) {
604
633
  const changes = [];
605
634
  if (!fs4.existsSync(destDir)) return changes;
@@ -607,6 +636,9 @@ function collectDeletedFiles(destDir, category, basePath) {
607
636
  for (const entry of entries) {
608
637
  const destPath = path4.join(destDir, entry.name);
609
638
  const relativePath = path4.join(basePath, entry.name);
639
+ if (shouldExcludeFromDeletion(entry.name, relativePath)) {
640
+ continue;
641
+ }
610
642
  if (entry.isDirectory()) {
611
643
  changes.push(...collectDeletedFiles(destPath, category, relativePath));
612
644
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-nexu",
3
- "version": "1.1.7",
3
+ "version": "1.1.8",
4
4
  "description": "CLI to create and update Nexu monorepo projects",
5
5
  "author": "Nexu Team",
6
6
  "license": "MIT",