@chahuadev/chahuadev-hub-app 1.0.4 → 2.0.0

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 (4) hide show
  1. package/README.md +30 -8
  2. package/index.js +10 -16
  3. package/install.js +24 -47
  4. package/package.json +4 -4
package/README.md CHANGED
@@ -54,20 +54,19 @@ sudo npm install -g @chahuadev/chahuadev-hub-app --foreground-scripts --force
54
54
  ```bash
55
55
  chahuadev-hub
56
56
  ```
57
- > **If the command fails, run the binary directly from the install folder:**
57
+ > **Note:** Downloaded apps will be automatically saved to your `Downloads/ChahuadevHub` folder.
58
+
59
+ > **If the command fails, go into the bin folder and run it directly:**
58
60
  >
59
61
  > ```bash
60
- > # With ~/.npm-global prefix (no-sudo install)
61
- > ~/.npm-global/lib/node_modules/@chahuadev/chahuadev-hub-app/bin/chahuadev_hub
62
- >
63
- > # Or navigate into the folder first
64
62
  > cd ~/.npm-global/lib/node_modules/@chahuadev/chahuadev-hub-app/bin
65
63
  > ./chahuadev_hub
66
64
  > ```
67
65
  >
68
- > For sudo installs, the folder is usually under `/usr/lib/node_modules/` or `/usr/local/lib/node_modules/`:
66
+ > If you installed with `sudo`, the folder may be under `/usr/local/lib/` instead:
69
67
  > ```bash
70
- > /usr/local/lib/node_modules/@chahuadev/chahuadev-hub-app/bin/chahuadev_hub
68
+ > cd /usr/local/lib/node_modules/@chahuadev/chahuadev-hub-app/bin
69
+ > ./chahuadev_hub
71
70
  > ```
72
71
  ---
73
72
 
@@ -86,7 +85,8 @@ npm install -g @chahuadev/chahuadev-hub-app --foreground-scripts --force
86
85
  Or run the binary directly without going through the Node wrapper:
87
86
 
88
87
  ```bash
89
- ~/.npm-global/lib/node_modules/@chahuadev/chahuadev-hub-app/bin/chahuadev_hub
88
+ cd ~/.npm-global/lib/node_modules/@chahuadev/chahuadev-hub-app/bin
89
+ ./chahuadev_hub
90
90
  ```
91
91
 
92
92
  ### ENOTEMPTY error on Linux (directory not empty)
@@ -113,6 +113,28 @@ source ~/.bashrc
113
113
  chahuadev-hub
114
114
  ```
115
115
 
116
+ ### `ModuleNotFoundError: No module named 'tkinter'` (Linux)
117
+
118
+ The Linux binary requires `tkinter` to be present at build time. If you see this error, the downloaded binary was built on a system without `tkinter` installed. You need to build from source:
119
+
120
+ ```bash
121
+ # 1. Install tkinter
122
+ sudo apt-get install python3-tk python3-dev -y
123
+
124
+ # 2. Install Python dependencies
125
+ pip3 install customtkinter requests pyinstaller
126
+
127
+ # 3. Go into the project folder
128
+ cd /path/to/Chahuadev-Hub-Python
129
+
130
+ # 4. Build the binary
131
+ python3 -m PyInstaller --onefile chahuadev_hub.py
132
+
133
+ # 5. Run it
134
+ cd dist
135
+ ./chahuadev_hub
136
+ ```
137
+
116
138
  ---
117
139
 
118
140
  ## �🚀 What It Does
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- #!/usr/bin/env node
1
+ #!/usr/bin/env node
2
2
  'use strict';
3
3
  const path = require('path');
4
4
  const { spawnSync } = require('child_process');
@@ -9,21 +9,20 @@ const platform = os.platform();
9
9
  const arch = os.arch();
10
10
 
11
11
  let exeName = '';
12
-
13
12
  if (platform === 'win32') {
14
- exeName = 'chahuadev_hub.exe';
13
+ exeName = 'Chahuadev-Hub.exe';
15
14
  } else if (platform === 'linux') {
16
- exeName = 'chahuadev_hub';
15
+ exeName = 'Chahuadev-Hub.AppImage';
17
16
  } else {
18
- console.error(`❌ Chahuadev Hub does not support ${platform} ${arch} yet.`);
17
+ console.error(`Chahuadev Hub does not support ${platform} ${arch}`);
19
18
  process.exit(1);
20
19
  }
21
20
 
22
21
  const getPath = () => {
23
22
  const exePath = path.join(__dirname, 'bin', exeName);
24
23
  if (!fs.existsSync(exePath)) {
25
- console.error(`\n❌ Executable not found: ${exePath}`);
26
- console.error('👉 Try reinstalling: npm install -g @chahuadev/chahuadev-hub-app --foreground-scripts --force\n');
24
+ console.error(`Executable not found: ${exePath}`);
25
+ console.error('Try running "npm install" again to download the binary.');
27
26
  process.exit(1);
28
27
  }
29
28
  return exePath;
@@ -31,17 +30,12 @@ const getPath = () => {
31
30
 
32
31
  const run = () => {
33
32
  try {
34
- const exePath = getPath();
35
- const args = process.argv.slice(2);
36
- spawnSync(exePath, args, { stdio: 'inherit' });
33
+ spawnSync(getPath(), process.argv.slice(2), { stdio: 'inherit' });
37
34
  } catch (error) {
38
- console.error('Failed to start Chahuadev Hub:', error.message);
35
+ console.error('Failed to start Chahuadev Hub:', error.message);
39
36
  process.exit(1);
40
37
  }
41
38
  };
42
39
 
43
- if (require.main === module) {
44
- run();
45
- } else {
46
- module.exports = { run, getPath };
47
- }
40
+ if (require.main === module) run();
41
+ else module.exports = { run, getPath };
package/install.js CHANGED
@@ -1,4 +1,4 @@
1
- 'use strict';
1
+ 'use strict';
2
2
  const fs = require('fs');
3
3
  const path = require('path');
4
4
  const https = require('https');
@@ -7,92 +7,69 @@ const os = require('os');
7
7
  const platform = os.platform();
8
8
  const arch = os.arch();
9
9
 
10
+ const R2_BASE = 'https://pub-419d22521da042dfb27d1f404b3eb8a6.r2.dev';
11
+
10
12
  let downloadUrl = '';
11
13
  let fileName = '';
12
14
 
13
15
  if (platform === 'win32') {
14
- // ชื่อไฟล์ตรงกับที่ PyInstaller build ออกมา
15
- downloadUrl = 'https://huggingface.co/datasets/chahuadev/chahuadev-framework-binaries/resolve/main/chahuadev_hub.exe?download=true';
16
- fileName = 'chahuadev_hub.exe';
16
+ downloadUrl = `${R2_BASE}/Chahuadev-Hub.exe`;
17
+ fileName = 'Chahuadev-Hub.exe';
17
18
  } else if (platform === 'linux') {
18
- downloadUrl = 'https://huggingface.co/datasets/chahuadev/chahuadev-framework-binaries/resolve/main/chahuadev_hub?download=true';
19
- fileName = 'chahuadev_hub';
20
- }
21
-
22
- if (!downloadUrl) {
23
- console.warn(`\n⚠️ Skipping download: Chahuadev Hub does not support ${platform} ${arch} yet.`);
19
+ downloadUrl = `${R2_BASE}/Chahuadev-Hub.AppImage`;
20
+ fileName = 'Chahuadev-Hub.AppImage';
21
+ } else {
22
+ console.warn(`Chahuadev Hub does not support ${platform} ${arch} yet.`);
24
23
  process.exit(0);
25
24
  }
26
25
 
27
26
  const binDir = path.join(__dirname, 'bin');
28
- if (!fs.existsSync(binDir)) {
29
- fs.mkdirSync(binDir, { recursive: true });
30
- }
27
+ if (!fs.existsSync(binDir)) fs.mkdirSync(binDir, { recursive: true });
31
28
 
32
29
  const filePath = path.join(binDir, fileName);
33
-
34
- console.log(`\n🚀 Chahuadev Hub Downloading binary for ${platform} (${arch})...`);
35
- console.log(`⏳ Please wait, this may take a few minutes depending on your connection.\n`);
30
+ console.log(`\nChahuadev Hub -- Downloading binary for ${platform} (${arch})...`);
31
+ console.log('Please wait, this may take a few minutes.\n');
36
32
 
37
33
  function downloadFile(url, dest) {
38
34
  https.get(url, (response) => {
39
35
  if (response.statusCode === 301 || response.statusCode === 302) {
40
36
  return downloadFile(response.headers.location, dest);
41
37
  }
42
-
43
38
  if (response.statusCode !== 200) {
44
- console.error(`\n❌ Download failed: HTTP ${response.statusCode}`);
39
+ console.error(`Download failed: HTTP ${response.statusCode}`);
45
40
  process.exit(1);
46
41
  }
47
-
48
42
  const totalBytes = parseInt(response.headers['content-length'], 10);
49
43
  let downloadedBytes = 0;
50
-
51
44
  const file = fs.createWriteStream(dest);
52
-
53
45
  response.on('data', (chunk) => {
54
46
  downloadedBytes += chunk.length;
55
-
56
47
  if (!isNaN(totalBytes)) {
57
48
  const percent = ((downloadedBytes / totalBytes) * 100).toFixed(1);
58
- const downloadedMB = (downloadedBytes / (1024 * 1024)).toFixed(1);
49
+ const dlMB = (downloadedBytes / (1024 * 1024)).toFixed(1);
59
50
  const totalMB = (totalBytes / (1024 * 1024)).toFixed(1);
60
-
61
- const barLength = 30;
62
- const filledLength = Math.round((barLength * downloadedBytes) / totalBytes);
63
- const bar = '█'.repeat(filledLength) + '░'.repeat(barLength - filledLength);
64
-
65
- process.stdout.write(`\r[${bar}] ${percent}% (${downloadedMB} MB / ${totalMB} MB)`);
51
+ const filled = Math.round(30 * downloadedBytes / totalBytes);
52
+ const bar = '#'.repeat(filled) + '-'.repeat(30 - filled);
53
+ process.stdout.write(`\r[${bar}] ${percent}% (${dlMB} MB / ${totalMB} MB)`);
66
54
  } else {
67
- const downloadedMB = (downloadedBytes / (1024 * 1024)).toFixed(1);
68
- process.stdout.write(`\rDownloading... ${downloadedMB} MB`);
55
+ process.stdout.write(`\rDownloading... ${(downloadedBytes / (1024 * 1024)).toFixed(1)} MB`);
69
56
  }
70
57
  });
71
-
72
58
  response.pipe(file);
73
-
74
59
  file.on('finish', () => {
75
60
  file.close();
76
- console.log('\n');
77
- console.log('✅ Download completed successfully!');
78
- console.log(`📂 Saved to: ${dest}`);
79
- console.log('');
80
- console.log('🚀 Launch the app with:');
61
+ console.log('\n\nDownload completed.');
62
+ console.log(`Saved to: ${dest}`);
63
+ console.log('\nLaunch the app with:');
81
64
  console.log(' chahuadev-hub');
82
65
  console.log(' npx @chahuadev/chahuadev-hub-app\n');
83
-
84
- // Make executable on Linux/macOS
85
- if (platform !== 'win32') {
86
- fs.chmodSync(dest, 0o755);
87
- console.log(' chmod +x applied');
88
- }
66
+ if (platform !== 'win32') fs.chmodSync(dest, 0o755);
89
67
  });
90
-
91
68
  }).on('error', (err) => {
92
69
  fs.unlink(dest, () => {});
93
- console.error('\n❌ Download failed:', err.message);
70
+ console.error('\nDownload failed:', err.message);
94
71
  process.exit(1);
95
72
  });
96
73
  }
97
74
 
98
- downloadFile(downloadUrl, filePath);
75
+ downloadFile(downloadUrl, filePath);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
- {
1
+ {
2
2
  "name": "@chahuadev/chahuadev-hub-app",
3
- "version": "1.0.4",
4
- "description": "Chahuadev Hub Official app launcher and distribution hub by Chahuadev",
3
+ "version": "2.0.0",
4
+ "description": "Chahuadev Hub โ€” Official app launcher and distribution hub by Chahuadev",
5
5
  "main": "index.js",
6
6
  "bin": {
7
7
  "chahuadev-hub": "index.js"
@@ -33,7 +33,7 @@
33
33
  },
34
34
  "repository": {
35
35
  "type": "git",
36
- "url": "https://huggingface.co/datasets/chahuadev/chahuadev-framework-binaries"
36
+ "url": "https://huggingface.co/datasets/chahuadev/chahuadev-hub"
37
37
  },
38
38
  "homepage": "https://huggingface.co/chahuadev"
39
39
  }