acadex-cli 1.0.1 → 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/acadex CHANGED
@@ -352,13 +352,23 @@ case "$1" in
352
352
  echo ""
353
353
  ;;
354
354
 
355
+ services)
356
+ echo -e "${GREEN}Starting background services (Queue + Scheduler + Reverb) for Herd/Laragon...${NC}"
357
+ echo -e "${BLUE}→${NC} Use this when Herd/Laragon is already handling the web server"
358
+ npx concurrently -c "#c4b5fd,#4ade80,#fbbf24" \
359
+ "php artisan queue:work --tries=3 --timeout=90" \
360
+ "php artisan schedule:work" \
361
+ "php artisan reverb:start" \
362
+ --names=queue,scheduler,reverb
363
+ ;;
355
364
  serve)
356
365
  echo -e "${GREEN}Starting production servers (Laravel + Queue + Scheduler + Reverb)...${NC}"
357
366
  npx concurrently -c "#93c5fd,#c4b5fd,#4ade80,#fbbf24" \
358
367
  "php artisan serve" \
359
368
  "php artisan queue:work --tries=3 --timeout=90" \
360
369
  "php artisan schedule:work" \
361
- --names=server,queue,scheduler
370
+ "php artisan reverb:start" \
371
+ --names=server,queue,scheduler,reverb
362
372
  ;;
363
373
  dev)
364
374
  echo -e "${GREEN}Starting development servers (Laravel + Queue + Logs + Vite + Reverb)...${NC}"
package/acadex.ps1 CHANGED
@@ -390,9 +390,15 @@ switch ($Command) {
390
390
  Write-Host ""
391
391
  }
392
392
 
393
+ "services" {
394
+ Write-Host "Starting background services (Queue + Scheduler + Reverb) for Herd/Laragon..." -ForegroundColor Green
395
+ Write-Host " -> Use this when Herd/Laragon is already handling the web server" -ForegroundColor Cyan
396
+ npx concurrently -c "#c4b5fd,#4ade80,#fbbf24" "php artisan queue:work --tries=3 --timeout=90" "php artisan schedule:work" "php artisan reverb:start" --names=queue,scheduler,reverb
397
+ }
398
+
393
399
  "serve" {
394
- Write-Host "Starting production servers (Laravel + Queue + Scheduler)..." -ForegroundColor Green
395
- npx concurrently -c "#93c5fd,#c4b5fd,#4ade80" "php artisan serve" "php artisan queue:work --tries=3 --timeout=90" "php artisan schedule:work" --names=server,queue,scheduler
400
+ Write-Host "Starting production servers (Laravel + Queue + Scheduler + Reverb)..." -ForegroundColor Green
401
+ npx concurrently -c "#93c5fd,#c4b5fd,#4ade80,#fbbf24" "php artisan serve" "php artisan queue:work --tries=3 --timeout=90" "php artisan schedule:work" "php artisan reverb:start" --names=server,queue,scheduler,reverb
396
402
  }
397
403
 
398
404
  "dev" {
package/bin/acadex.js CHANGED
@@ -3,29 +3,67 @@
3
3
  const { spawn } = require('child_process');
4
4
  const path = require('path');
5
5
  const os = require('os');
6
+ const fs = require('fs');
6
7
 
7
8
  const platform = os.platform();
8
- const scriptDir = __dirname;
9
+ const scriptDir = path.join(__dirname, '..');
9
10
 
10
11
  let scriptPath;
11
12
  let shell;
12
13
  let shellArgs;
13
14
 
15
+ // Detect platform and select appropriate script
14
16
  if (platform === 'win32') {
15
17
  // Windows - use PowerShell script
16
18
  scriptPath = path.join(scriptDir, 'acadex.ps1');
19
+
20
+ if (!fs.existsSync(scriptPath)) {
21
+ console.error('Error: ACADEX CLI is not properly installed for Windows.');
22
+ console.error(`Missing: ${scriptPath}`);
23
+ console.error('Please reinstall: npm install -g acadex-cli');
24
+ process.exit(1);
25
+ }
26
+
17
27
  shell = 'powershell.exe';
18
- shellArgs = ['-NoProfile', '-ExecutionPolicy', 'Bypass', '-File', scriptPath, ...process.argv.slice(2)];
19
- } else {
20
- // Unix-like systems (Linux, macOS) - use bash script
28
+ shellArgs = [
29
+ '-NoProfile',
30
+ '-ExecutionPolicy', 'Bypass',
31
+ '-File', scriptPath,
32
+ ...process.argv.slice(2)
33
+ ];
34
+ } else if (platform === 'darwin' || platform === 'linux') {
35
+ // macOS and Linux - use bash script
21
36
  scriptPath = path.join(scriptDir, 'acadex');
22
- shell = scriptPath;
23
- shellArgs = process.argv.slice(2);
37
+
38
+ if (!fs.existsSync(scriptPath)) {
39
+ console.error('Error: ACADEX CLI is not properly installed for Unix systems.');
40
+ console.error(`Missing: ${scriptPath}`);
41
+ console.error('Please reinstall: npm install -g acadex-cli');
42
+ process.exit(1);
43
+ }
44
+
45
+ // Ensure script is executable
46
+ try {
47
+ fs.chmodSync(scriptPath, 0o755);
48
+ } catch (err) {
49
+ // Silent fail - may not have permissions or already executable
50
+ }
51
+
52
+ shell = 'bash';
53
+ shellArgs = [scriptPath, ...process.argv.slice(2)];
54
+ } else {
55
+ // Unsupported platform
56
+ console.error(`Error: Unsupported platform: ${platform}`);
57
+ console.error('ACADEX CLI supports: Windows (win32), macOS (darwin), Linux (linux)');
58
+ console.error('Please report this issue if you believe this is an error.');
59
+ process.exit(1);
24
60
  }
25
61
 
62
+ // Spawn the platform-specific script
26
63
  const child = spawn(shell, shellArgs, {
27
64
  stdio: 'inherit',
28
- shell: platform === 'win32' ? false : false
65
+ shell: false,
66
+ windowsHide: true // Hide console window on Windows for cleaner experience
29
67
  });
30
68
 
31
69
  child.on('exit', (code) => {
@@ -33,6 +71,20 @@ child.on('exit', (code) => {
33
71
  });
34
72
 
35
73
  child.on('error', (err) => {
36
- console.error('Failed to start subprocess:', err);
74
+ console.error('\nError: Failed to execute ACADEX CLI');
75
+ console.error(`Reason: ${err.message}`);
76
+ console.error(`Platform: ${platform}`);
77
+ console.error(`Script: ${scriptPath}`);
78
+ console.error('\nTroubleshooting:');
79
+
80
+ if (platform === 'win32') {
81
+ console.error(' - Ensure PowerShell is installed and in PATH');
82
+ console.error(' - Try running PowerShell as Administrator');
83
+ } else {
84
+ console.error(' - Ensure bash is installed: which bash');
85
+ console.error(' - Check script permissions: ls -la $(which acadex)');
86
+ }
87
+
88
+ console.error('\nReinstall: npm uninstall -g acadex-cli && npm install -g acadex-cli');
37
89
  process.exit(1);
38
90
  });
package/package.json CHANGED
@@ -1,11 +1,18 @@
1
1
  {
2
2
  "name": "acadex-cli",
3
- "version": "1.0.1",
3
+ "version": "1.0.4",
4
4
  "description": "A global CLI tool for managing Acadex projects with easy setup and automation",
5
5
  "main": "bin/acadex.js",
6
6
  "bin": {
7
- "acadex": "./bin/acadex.js"
7
+ "acadex": "bin/acadex.js"
8
8
  },
9
+ "files": [
10
+ "bin/",
11
+ "acadex",
12
+ "acadex.ps1",
13
+ "LICENSE",
14
+ "README.md"
15
+ ],
9
16
  "scripts": {
10
17
  "test": "echo \"Error: no test specified\" && exit 1"
11
18
  },
@@ -32,4 +39,3 @@
32
39
  "win32"
33
40
  ]
34
41
  }
35
-