make-folder-txt 2.1.0 → 2.1.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/README.md CHANGED
@@ -24,8 +24,8 @@ Ever needed to share your entire project with ChatGPT, Claude, or a teammate —
24
24
  - ✅ Run it from any project directory — no arguments needed
25
25
  - ✅ Built-in help system with `--help` flag
26
26
  - ✅ **Built-in shell autocompletion** (installs automatically)
27
- - ✅ **File size control** with `--skip-large` and `--no-skip`
28
- - ✅ **Output splitting** by folders, files, or size
27
+ - ✅ File size control with `--skip-large` and `--no-skip`
28
+ - ✅ Output splitting by folders, files, or size
29
29
  - ✅ Copy to clipboard with `--copy` flag
30
30
  - ✅ Force include everything with `--force` flag
31
31
  - ✅ Generates a clean folder tree + every file's content
@@ -453,7 +453,7 @@ function splitBySize(treeLines, filePaths, rootName, splitSize, effectiveMaxSize
453
453
 
454
454
  const args = process.argv.slice(2);
455
455
 
456
- // Check if completion is already installed, install if not
456
+ // Check if completion is already installed, install if not (silent on subsequent runs)
457
457
  function checkAndInstallCompletion() {
458
458
  const { execSync } = require('child_process');
459
459
  const path = require('path');
@@ -464,108 +464,81 @@ function checkAndInstallCompletion() {
464
464
  const homeDir = os.homedir();
465
465
  const shell = process.env.SHELL || '';
466
466
  const platform = process.platform;
467
- let completionInstalled = false;
468
467
 
469
- if (platform === 'win32') {
470
- // Check PowerShell completion - try multiple profile locations
471
- const profilePaths = [
472
- path.join(homeDir, 'Documents', 'WindowsPowerShell', 'Microsoft.PowerShell_profile.ps1'),
473
- path.join(homeDir, 'Documents', 'PowerShell', 'Microsoft.PowerShell_profile.ps1'),
474
- path.join(homeDir, '.config', 'powershell', 'Microsoft.PowerShell_profile.ps1')
475
- ];
476
-
477
- for (const profilePath of profilePaths) {
478
- if (fs.existsSync(profilePath)) {
479
- const profileContent = fs.readFileSync(profilePath, 'utf8');
480
- if (profileContent.includes('make-folder-txt-completion')) {
481
- completionInstalled = true;
482
- break;
483
- }
484
- }
485
- }
486
- } else if (shell.includes('zsh')) {
487
- // Check zsh completion
488
- const zshrc = path.join(homeDir, '.zshrc');
489
- if (fs.existsSync(zshrc)) {
490
- const zshrcContent = fs.readFileSync(zshrc, 'utf8');
491
- if (zshrcContent.includes('make-folder-txt')) {
492
- completionInstalled = true;
493
- }
494
- }
495
- } else {
496
- // Check bash completion
497
- const bashrc = path.join(homeDir, '.bashrc');
498
- if (fs.existsSync(bashrc)) {
499
- const bashrcContent = fs.readFileSync(bashrc, 'utf8');
500
- if (bashrcContent.includes('make-folder-txt-completion')) {
501
- completionInstalled = true;
502
- }
503
- }
468
+ // Use a simple flag file to track installation
469
+ const flagFile = path.join(homeDir, '.make-folder-txt-completion-installed');
470
+
471
+ if (fs.existsSync(flagFile)) {
472
+ // Completion already installed
473
+ return;
504
474
  }
505
475
 
506
- // If completion is not installed, install it automatically
507
- if (!completionInstalled) {
508
- console.log('🔧 Installing shell autocompletion for make-folder-txt...');
476
+ // Install completion
477
+ console.log('🔧 Installing shell autocompletion for make-folder-txt...');
478
+
479
+ if (platform === 'win32') {
480
+ // Windows PowerShell
481
+ try {
482
+ execSync('powershell -Command "Get-Host"', { stdio: 'ignore' });
483
+ const installScript = path.join(__dirname, '..', 'completion', 'install-powershell-completion.ps1');
484
+ execSync(`powershell -ExecutionPolicy Bypass -File "${installScript}"`, { stdio: 'ignore' });
485
+ console.log('✅ PowerShell completion installed! Restart your terminal to enable autocompletion');
486
+ } catch (err) {
487
+ // Silent fail for PowerShell
488
+ }
509
489
 
510
- if (platform === 'win32') {
511
- // Windows PowerShell
512
- try {
513
- execSync('powershell -Command "Get-Host"', { stdio: 'ignore' });
514
- const installScript = path.join(__dirname, '..', 'completion', 'install-powershell-completion.ps1');
515
- execSync(`powershell -ExecutionPolicy Bypass -File "${installScript}"`, { stdio: 'ignore' });
516
- console.log(' PowerShell completion installed!');
517
- } catch (err) {
518
- // Silent fail for PowerShell
519
- }
520
- } else if (shell.includes('zsh')) {
521
- // zsh
490
+ } else if (shell.includes('zsh')) {
491
+ // zsh
492
+ try {
493
+ const zshrc = path.join(homeDir, '.zshrc');
494
+ const completionDir = path.join(homeDir, '.zsh', 'completions');
495
+ execSync(`mkdir -p "${completionDir}"`, { stdio: 'ignore' });
496
+ const completionPath = path.join(__dirname, '..', 'completion', 'make-folder-txt-completion.zsh');
497
+ execSync(`cp "${completionPath}" "${completionDir}/_make-folder-txt"`, { stdio: 'ignore' });
498
+
522
499
  try {
523
- const zshrc = path.join(homeDir, '.zshrc');
524
- const completionDir = path.join(homeDir, '.zsh', 'completions');
525
- execSync(`mkdir -p "${completionDir}"`, { stdio: 'ignore' });
526
- const completionPath = path.join(__dirname, '..', 'completion', 'make-folder-txt-completion.zsh');
527
- execSync(`cp "${completionPath}" "${completionDir}/_make-folder-txt"`, { stdio: 'ignore' });
528
-
529
- try {
530
- const zshrcContent = fs.readFileSync(zshrc, 'utf8');
531
- if (!zshrcContent.includes('fpath+=~/.zsh/completions')) {
532
- fs.appendFileSync(zshrc, '\n# make-folder-txt completion\nfpath+=~/.zsh/completions\nautoload -U compinit && compinit\n');
533
- }
534
- } catch (e) {
535
- fs.writeFileSync(zshrc, '# make-folder-txt completion\nfpath+=~/.zsh/completions\nautoload -U compinit && compinit\n');
500
+ const zshrcContent = fs.readFileSync(zshrc, 'utf8');
501
+ if (!zshrcContent.includes('fpath+=~/.zsh/completions')) {
502
+ fs.appendFileSync(zshrc, '\n# make-folder-txt completion\nfpath+=~/.zsh/completions\nautoload -U compinit && compinit\n');
536
503
  }
537
- console.log('✅ Zsh completion installed!');
538
- } catch (err) {
539
- // Silent fail for zsh
504
+ } catch (e) {
505
+ fs.writeFileSync(zshrc, '# make-folder-txt completion\nfpath+=~/.zsh/completions\nautoload -U compinit && compinit\n');
540
506
  }
541
- } else {
542
- // bash
507
+ console.log('✅ Zsh completion installed! Restart your terminal or run: source ~/.zshrc');
508
+ } catch (err) {
509
+ // Silent fail for zsh
510
+ }
511
+
512
+ } else {
513
+ // bash
514
+ try {
515
+ const bashrc = path.join(homeDir, '.bashrc');
516
+ const completionPath = path.join(__dirname, '..', 'completion', 'make-folder-txt-completion.bash');
543
517
  try {
544
- const bashrc = path.join(homeDir, '.bashrc');
545
- const completionPath = path.join(__dirname, '..', 'completion', 'make-folder-txt-completion.bash');
546
- try {
547
- const bashrcContent = fs.readFileSync(bashrc, 'utf8');
548
- if (!bashrcContent.includes('make-folder-txt-completion.bash')) {
549
- fs.appendFileSync(bashrc, `\n# make-folder-txt completion\nsource "${completionPath}"\n`);
550
- }
551
- } catch (e) {
552
- fs.writeFileSync(bashrc, `# make-folder-txt completion\nsource "${completionPath}"\n`);
518
+ const bashrcContent = fs.readFileSync(bashrc, 'utf8');
519
+ if (!bashrcContent.includes('make-folder-txt-completion.bash')) {
520
+ fs.appendFileSync(bashrc, `\n# make-folder-txt completion\nsource "${completionPath}"\n`);
553
521
  }
554
- console.log('✅ Bash completion installed!');
555
- } catch (err) {
556
- // Silent fail for bash
522
+ } catch (e) {
523
+ fs.writeFileSync(bashrc, `# make-folder-txt completion\nsource "${completionPath}"\n`);
557
524
  }
525
+ console.log('✅ Bash completion installed! Restart your terminal or run: source ~/.bashrc');
526
+ } catch (err) {
527
+ // Silent fail for bash
558
528
  }
559
-
560
- console.log('💡 Restart your terminal to enable autocompletion');
561
- console.log('');
562
529
  }
530
+
531
+ // Create flag file to prevent re-installation
532
+ fs.writeFileSync(flagFile, 'installed');
533
+ console.log('💡 Restart your terminal to enable autocompletion');
534
+ console.log('');
535
+
563
536
  } catch (err) {
564
537
  // Silent fail - don't interrupt the main functionality
565
538
  }
566
539
  }
567
540
 
568
- // Run completion check on first run (but not for help/version commands)
541
+ // Run completion check on first run (but not for help/version/install-completion commands)
569
542
  if (!args.includes("--help") && !args.includes("-h") &&
570
543
  !args.includes("--version") && !args.includes("-v") &&
571
544
  !args.includes("--install-completion")) {
@@ -592,7 +565,8 @@ if (args.includes("--install-completion")) {
592
565
  const installScript = path.join(__dirname, '..', 'completion', 'install-powershell-completion.ps1');
593
566
 
594
567
  // Run the PowerShell installation script
595
- execSync(`powershell -ExecutionPolicy Bypass -File "${installScript}"`, { stdio: 'inherit' });
568
+ execSync(`powershell -ExecutionPolicy Bypass -File "${installScript}"`, { stdio: 'ignore' });
569
+ console.log('✅ PowerShell completion installed! Restart your terminal to enable autocompletion');
596
570
 
597
571
  } catch (err) {
598
572
  console.error('❌ Failed to install PowerShell completion:', err.message);
@@ -21,7 +21,7 @@ FILE: /package.json
21
21
  --------------------------------------------------------------------------------
22
22
  {
23
23
  "name": "make-folder-txt",
24
- "version": "2.0.1",
24
+ "version": "2.1.1",
25
25
  "description": "Generate a single .txt file containing the full folder structure and file contents of any project, ignoring node_modules and other junk.",
26
26
  "main": "bin/make-folder-txt.js",
27
27
  "bin": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "make-folder-txt",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "description": "Generate a single .txt file containing the full folder structure and file contents of any project, ignoring node_modules and other junk.",
5
5
  "main": "bin/make-folder-txt.js",
6
6
  "bin": {