project-to-text 1.0.2 → 1.0.4

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
@@ -3,10 +3,8 @@
3
3
  [![npm version](https://img.shields.io/npm/v/project-to-text.svg)](https://www.npmjs.com/package/project-to-text)
4
4
  [![license](https://img.shields.io/npm/l/project-to-text.svg)](https://github.com/IrbadAbdeldjelil/project-to-text/blob/main/LICENSE)
5
5
  [![downloads](https://img.shields.io/npm/dt/project-to-text.svg)](https://www.npmjs.com/package/project-to-text)
6
-
7
6
  A powerful tool that converts your entire project into a single text file, making it easy to share with AI assistants for code review, analysis, and feedback.
8
7
 
9
-
10
8
  ## Installation
11
9
 
12
10
  ```bash
@@ -20,22 +18,19 @@ cd your-project
20
18
  project-to-text
21
19
  ```
22
20
 
23
- Creates `thisProject.txt` with your project content.
21
+ This creates `thisProject.txt` with your entire project content.
24
22
 
25
- ## Usage
23
+ ## Usage Examples
26
24
 
27
25
  ### Command Line
28
26
  ```bash
29
- #install it globally
30
- npm install -g project-to-text
31
-
32
27
  # Basic usage
33
28
  project-to-text
34
29
 
35
30
  # Ignore specific files
36
- project-to-text --ignore "dist/**,*.log"
31
+ project-to-text --ignore "dist/**,*.log,coverage/**"
37
32
 
38
- # Using npx
33
+ # Using npx (no installation required)
39
34
  npx project-to-text
40
35
  ```
41
36
 
@@ -47,30 +42,23 @@ const exporter = require('project-to-text');
47
42
  await exporter();
48
43
 
49
44
  // With custom ignore patterns
50
- await exporter('current-file.js', ['dist/**', '*.log']);
45
+ await exporter('current-file.js', ['dist/**', '*.log', 'temp/**']);
51
46
  ```
52
- ## API
53
47
 
54
- ### `exporter(thisFile?, customIgnore?)`
48
+ ## Key Features
55
49
 
56
- - `thisFile` - Current file name to exclude (optional)
57
- - `customIgnore` - Array of ignore patterns (optional)
50
+ - **Smart File Ignoring** - Automatically excludes node_modules, build files, media files
51
+ - **Git Integration** - Reads your .gitignore patterns automatically
52
+ - ✅ **Clean Output** - Well-formatted text file perfect for AI analysis
53
+ - ✅ **Fast & Lightweight** - Processes projects in seconds
54
+ - ✅ **Flexible** - Custom ignore patterns and programmatic API
58
55
 
59
- ## Features
56
+ ## Perfect For
60
57
 
61
- - Scans entire project structure
62
- - Smart ignoring of node_modules, build files, etc.
63
- - Custom ignore patterns
64
- - Clean formatted output
65
- - Fast and lightweight
66
-
67
- ## Default Ignored Files
68
-
69
- - `node_modules/**`
70
- - `.git/**`
71
- - `dist/`, `build/`, `coverage/`
72
- - `*.log`
73
- - `package-lock.json`
58
+ - 🤖 **AI Analysis** - Share projects with ChatGPT, Claude, and other AI assistants
59
+ - 🔍 **Code Reviews** - Get detailed project analysis and feedback
60
+ - 📚 **Documentation** - Create comprehensive project snapshots
61
+ - 🚀 **Sharing** - Easily share complete projects with team members
74
62
 
75
63
  ## Output Format
76
64
 
@@ -84,28 +72,15 @@ CONTENT : {
84
72
  }
85
73
  ```
86
74
 
87
- ## Use Cases
88
-
89
- - Share code with AI assistants (ChatGPT, Claude, etc.)
90
- - Code reviews and analysis
91
- - Project documentation
92
- - Backup and sharing
93
-
94
-
95
-
75
+ ## Links
76
+ - **npm:** https://www.npmjs.com/package/project-to-text
77
+ - **GitHub:** https://github.com/IrbadAbdeldjelil/project-to-text
78
+ ---
96
79
  ## 👨‍💻 Author
97
80
 
98
81
  **Irbad Abdeldjelil**
99
82
  - Email: irbadabdeldjelil@gmail.com
100
83
  - GitHub: [IrbadAbdeldjelil](https://github.com/IrbadAbdeldjelil)
101
-
102
- ## 🙏 Acknowledgments
103
-
104
- - Built with [fast-glob](https://github.com/mrmlnc/fast-glob) for fast file scanning
105
- - Inspired by the need for better AI code analysis workflows
106
-
107
- ---
108
-
109
84
  <div align="center">
110
85
 
111
86
  **If you find this tool helpful, please consider giving it a ⭐ on GitHub!**
package/bin/exporter.js CHANGED
@@ -7,19 +7,37 @@ const path = require('path');
7
7
  // الدالة الرئيسية للتصدير
8
8
  async function exporter(thisFile = path.basename(__filename), customIgnore = []) {
9
9
  try {
10
- console.log('🔧 Running with ignore patterns:', customIgnore);
10
+ if (customIgnore.length > 0) {
11
+ console.log('🎯 Ignore patterns:', customIgnore);
12
+ }
11
13
 
14
+ console.log('🔍 Scanning project...');
12
15
  const projectStruc = await scanner(customIgnore);
13
16
 
14
17
  if(projectStruc.includes('thisProject.txt')) {
15
18
  await fs.rm('thisProject.txt');
16
- console.log('🗑️ Deleted old file');
19
+ console.log('🗑️ Deleted previous thisProject.txt');
17
20
  }
18
21
 
22
+ console.log('📄 Processing files...');
19
23
  const results = await reader(thisFile, customIgnore);
24
+
20
25
  await fs.writeFile('thisProject.txt', results, 'utf8');
21
26
  console.log('✅ Project exported successfully to thisProject.txt');
22
- console.log('📊 Total files processed:', projectStruc.length);
27
+ console.log(`📊 Total files processed: ${projectStruc.length}`);
28
+
29
+ // إظهار معلومات إضافية
30
+ const fileExtensions = {};
31
+ projectStruc.forEach(file => {
32
+ const ext = path.extname(file) || 'no-extension';
33
+ fileExtensions[ext] = (fileExtensions[ext] || 0) + 1;
34
+ });
35
+
36
+ console.log('📈 File types summary:');
37
+ Object.entries(fileExtensions).forEach(([ext, count]) => {
38
+ console.log(` ${ext}: ${count} files`);
39
+ });
40
+
23
41
  } catch(error) {
24
42
  console.log('❌ Failed to export:', error.message);
25
43
  }
@@ -30,12 +48,14 @@ function parseArgs() {
30
48
  const args = process.argv.slice(2);
31
49
  let customIgnore = [];
32
50
 
33
- console.log('📨 Raw arguments:', args);
34
-
35
51
  for (let i = 0; i < args.length; i++) {
36
52
  if (args[i] === '--ignore' && args[i + 1]) {
37
53
  customIgnore = args[i + 1].split(',');
38
- console.log('🎯 Parsed ignore patterns:', customIgnore);
54
+ break;
55
+ }
56
+ // دعم --ignore=value أيضاً
57
+ if (args[i].startsWith('--ignore=')) {
58
+ customIgnore = args[i].split('=')[1].split(',');
39
59
  break;
40
60
  }
41
61
  }
package/package.json CHANGED
@@ -1,15 +1,36 @@
1
1
  {
2
2
  "name": "project-to-text",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Convert your project to a single text file for AI analysis and code sharing",
5
5
  "keywords": [
6
- "project",
7
- "text",
8
- "export",
9
6
  "ai",
10
- "analysis",
11
- "documentation",
12
- "code-sharing"
7
+ "chatgpt",
8
+ "claude",
9
+ "code-analysis",
10
+ "project-export",
11
+ "developer-tools",
12
+ "code-review",
13
+ "ai-assistant",
14
+ "project-to-text",
15
+ "repomix-alternative",
16
+ "lightweight",
17
+ "fast",
18
+ "simple",
19
+ "media-ignore",
20
+ "gitignore-support",
21
+ "file-converter",
22
+ "project-analyzer",
23
+ "ai-tools",
24
+ "code-sharing",
25
+ "project-documentation",
26
+ "automation",
27
+ "productivity",
28
+ "nodejs",
29
+ "javascript",
30
+ "open-source",
31
+ "text",
32
+ "to-text",
33
+ "one-file"
13
34
  ],
14
35
  "license": "MIT",
15
36
  "author": "Irbad Abdeldjelil <irbadabdeldjelil@gmail.com>",
@@ -37,4 +58,4 @@
37
58
  "bugs": {
38
59
  "url": "https://github.com/IrbadAbdeldjelil/project-to-text/issues"
39
60
  }
40
- }
61
+ }
package/src/scanner.js CHANGED
@@ -1,26 +1,71 @@
1
1
  const fg = require('fast-glob');
2
+ const fs = require('fs/promises');
3
+ const path = require('path');
2
4
 
3
5
  module.exports = async (customIgnore = []) => {
4
6
  const defaultIgnore = [
5
- 'node_modules',
7
+ // الملفات الأساسية
6
8
  'node_modules/**',
7
9
  'README.md',
8
10
  'package-lock.json',
9
11
  'package.json',
10
- '.git',
12
+
13
+ // نظام التحكم بالإصدارات
11
14
  '.git/**',
15
+
16
+ // ملفات النظام
12
17
  '.DS_Store',
18
+ 'Thumbs.db',
19
+ 'desktop.ini',
20
+
21
+ // الملفات المنطقية
13
22
  '*.log',
23
+ '*.tmp',
24
+ '*.temp',
25
+
26
+ // مجلدات البناء والتوزيع
14
27
  'coverage/**',
15
28
  'dist/**',
16
- 'build/**'
29
+ 'build/**',
30
+ 'out/**',
31
+ '.next/**',
32
+ '.nuxt/**',
33
+
34
+ // البيئة والإعدادات
35
+ '.env*',
36
+ '.config/**',
37
+
38
+ // الوسائط - الملفات الثقيلة
39
+ '**/*.jpg', '**/*.jpeg', '**/*.png', '**/*.gif', '**/*.bmp', '**/*.svg',
40
+ '**/*.mp4', '**/*.avi', '**/*.mov', '**/*.wmv', '**/*.flv',
41
+ '**/*.mp3', '**/*.wav', '**/*.ogg', '**/*.flac',
42
+ '**/*.pdf', '**/*.doc', '**/*.docx', '**/*.ppt', '**/*.pptx',
43
+ '**/*.zip', '**/*.rar', '**/*.tar', '**/*.gz',
44
+
45
+ // بيانات وقواعد بيانات
46
+ '**/*.db', '**/*.sqlite', '**/*.mdb'
17
47
  ];
18
48
 
19
- const ignoreList = [...defaultIgnore, ...customIgnore];
49
+ // قراءة .gitignore إذا موجود
50
+ let gitignorePatterns = [];
51
+ try {
52
+ const gitignoreContent = await fs.readFile('.gitignore', 'utf8');
53
+ gitignorePatterns = gitignoreContent
54
+ .split('\n')
55
+ .filter(line => line.trim() && !line.startsWith('#'))
56
+ .map(pattern => pattern.trim());
57
+ } catch (error) {
58
+ // إذا لم يوجد .gitignore، هذا طبيعي
59
+ }
60
+
61
+ const ignoreList = [...defaultIgnore, ...gitignorePatterns, ...customIgnore];
20
62
 
21
63
  const results = await fg('**/**', {
22
64
  ignore: ignoreList,
23
- dot: true
65
+ dot: true,
66
+ onlyFiles: true, // نتأكد أننا نحصل على ملفات فقط وليس مجلدات
67
+ caseSensitiveMatch: false
24
68
  });
69
+
25
70
  return results;
26
71
  }