acadex-cli 1.2.3 → 1.3.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.
package/acadex CHANGED
@@ -10,10 +10,6 @@ YELLOW='\033[1;33m'
10
10
  BLUE='\033[0;34m'
11
11
  NC='\033[0m' # No Color
12
12
 
13
- # Project root directory
14
- SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
15
- cd "$SCRIPT_DIR"
16
-
17
13
  # Display help
18
14
  show_help() {
19
15
  echo -e "${BLUE}╔══════════════════════════════════════════════════════════╗${NC}"
@@ -69,6 +65,7 @@ show_help() {
69
65
  echo -e " ${GREEN}phpmyadmin${NC} Start Apache & open phpMyAdmin (port 8080)"
70
66
  echo -e " ${GREEN}phpmyadmin:stop${NC} Stop Apache"
71
67
  echo -e " ${GREEN}docs${NC} Open ACADEX documentation"
68
+ echo -e " ${GREEN}update${NC} Update ACADEX CLI to latest version"
72
69
  echo -e " ${GREEN}uninstall${NC} Uninstall ACADEX CLI globally"
73
70
  echo -e " ${GREEN}menu${NC} Interactive menu (modern UI)"
74
71
  echo ""
@@ -770,6 +767,18 @@ case "$1" in
770
767
  echo -e "${GREEN}Opening ACADEX documentation...${NC}"
771
768
  open "https://xaviworks.github.io/AcadexV3/"
772
769
  ;;
770
+ update)
771
+ echo -e "${GREEN}Updating ACADEX CLI to the latest version...${NC}"
772
+ echo ""
773
+ npm update -g acadex-cli
774
+ if [ $? -eq 0 ]; then
775
+ echo ""
776
+ echo -e "${GREEN}✓ ACADEX CLI updated successfully!${NC}"
777
+ else
778
+ echo ""
779
+ echo -e "${RED}✗ Update failed. Try manually: npm update -g acadex-cli${NC}"
780
+ fi
781
+ ;;
773
782
  uninstall)
774
783
  echo -e "${BLUE}╔══════════════════════════════════════════════════════════╗${NC}"
775
784
  echo -e "${BLUE}║${NC} ${YELLOW}Uninstalling ACADEX CLI${NC} ${BLUE}║${NC}"
package/acadex.ps1 CHANGED
@@ -13,10 +13,6 @@ param(
13
13
  [string[]]$Arguments
14
14
  )
15
15
 
16
- # Project root directory
17
- $ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
18
- Set-Location $ScriptDir
19
-
20
16
  # Display help
21
17
  function Show-Help {
22
18
  Write-Host "===========================================================" -ForegroundColor Cyan
@@ -100,6 +96,8 @@ function Show-Help {
100
96
  Write-Host "Stop Apache (Windows)"
101
97
  Write-Host " docs " -ForegroundColor Green -NoNewline
102
98
  Write-Host "Open ACADEX documentation"
99
+ Write-Host " update " -ForegroundColor Green -NoNewline
100
+ Write-Host "Update ACADEX CLI to latest version"
103
101
  Write-Host " uninstall " -ForegroundColor Green -NoNewline
104
102
  Write-Host "Uninstall ACADEX CLI globally"
105
103
  Write-Host " menu " -ForegroundColor Green -NoNewline
@@ -857,6 +855,19 @@ switch ($Command) {
857
855
  Start-Process "https://xaviworks.github.io/AcadexV3/"
858
856
  }
859
857
 
858
+ "update" {
859
+ Write-Host "Updating ACADEX CLI to the latest version..." -ForegroundColor Green
860
+ Write-Host ""
861
+ npm update -g acadex-cli
862
+ if ($LASTEXITCODE -eq 0) {
863
+ Write-Host ""
864
+ Write-Host "[OK] ACADEX CLI updated successfully!" -ForegroundColor Green
865
+ } else {
866
+ Write-Host ""
867
+ Write-Host "[X] Update failed. Try manually: npm update -g acadex-cli" -ForegroundColor Red
868
+ }
869
+ }
870
+
860
871
  "uninstall" {
861
872
  Write-Host "===========================================================" -ForegroundColor Cyan
862
873
  Write-Host " Uninstalling ACADEX CLI " -ForegroundColor Yellow
package/bin/acadex.js CHANGED
@@ -4,11 +4,48 @@ const { spawn } = require('child_process');
4
4
  const path = require('path');
5
5
  const os = require('os');
6
6
  const fs = require('fs');
7
+ const updateNotifier = require('update-notifier');
8
+ const pkg = require('../package.json');
9
+
10
+ // Check for updates
11
+ const notifier = updateNotifier({
12
+ pkg,
13
+ updateCheckInterval: 1000 * 60 * 60 * 24 // Check once per day
14
+ });
15
+
16
+ if (notifier.update) {
17
+ console.log('\n┌─────────────────────────────────────────────────┐');
18
+ console.log('│ Update available: ' + notifier.update.latest.padEnd(28) + '│');
19
+ console.log('│ Current version: ' + pkg.version.padEnd(28) + '│');
20
+ console.log('│ │');
21
+ console.log('│ Run: npm update -g acadex-cli │');
22
+ console.log('│ Or: acadex update │');
23
+ console.log('└─────────────────────────────────────────────────┘\n');
24
+ }
7
25
 
8
26
  const platform = os.platform();
9
27
  const scriptDir = path.join(__dirname, '..');
10
28
  const args = process.argv.slice(2);
11
29
 
30
+ // Handle update command
31
+ if (args.length === 1 && args[0] === 'update') {
32
+ console.log('Updating ACADEX CLI to the latest version...\n');
33
+ const updateProcess = spawn('npm', ['update', '-g', 'acadex-cli'], {
34
+ stdio: 'inherit',
35
+ shell: true
36
+ });
37
+
38
+ updateProcess.on('close', (code) => {
39
+ if (code === 0) {
40
+ console.log('\n✓ ACADEX CLI updated successfully!');
41
+ } else {
42
+ console.error('\n✗ Update failed. Try manually: npm update -g acadex-cli');
43
+ }
44
+ process.exit(code);
45
+ });
46
+ return;
47
+ }
48
+
12
49
  // Check if menu command with no additional args - use interactive menu
13
50
  if (args.length === 1 && args[0] === 'menu') {
14
51
  const { startInteractiveMenu } = require('./interactive-menu');
@@ -27,7 +27,10 @@ const executeCommand = (command, platform) => {
27
27
  args = [scriptPath, command];
28
28
  }
29
29
 
30
- const child = spawn(shell, args, { stdio: 'inherit' });
30
+ const child = spawn(shell, args, {
31
+ stdio: 'inherit',
32
+ cwd: process.cwd() // Run in user's current directory, not package directory
33
+ });
31
34
 
32
35
  child.on('close', (code) => {
33
36
  resolve(code);
@@ -41,16 +44,16 @@ const showMainMenu = async (platform) => {
41
44
  {
42
45
  type: 'list',
43
46
  name: 'category',
44
- message: '╔═══════════════════════════════════════╗\n ACADEX - Interactive Menu (v1.1) ║\n╚═══════════════════════════════════════╝\n\nSelect a category:',
47
+ message: '===========================================\n ACADEX - Interactive Menu (v1.1)\n===========================================\n\nSelect a category:',
45
48
  choices: [
46
49
  { name: '[+] Setup & Installation', value: 'setup' },
47
50
  { name: '[>] Development', value: 'development' },
48
- { name: '[] Testing', value: 'testing' },
51
+ { name: '[*] Testing', value: 'testing' },
49
52
  { name: '[#] Database', value: 'database' },
50
- { name: '[*] Maintenance', value: 'maintenance' },
51
- { name: '[~] Code Quality', value: 'quality' },
53
+ { name: '[~] Maintenance', value: 'maintenance' },
54
+ { name: '[@] Code Quality', value: 'quality' },
52
55
  { name: '[=] Dependencies', value: 'dependencies' },
53
- { name: '[] Other Commands', value: 'other' },
56
+ { name: '[!] Other Commands', value: 'other' },
54
57
  new inquirer.Separator(),
55
58
  { name: '[X] Exit', value: 'exit' }
56
59
  ],
@@ -59,7 +62,7 @@ const showMainMenu = async (platform) => {
59
62
  ]);
60
63
 
61
64
  if (category === 'exit') {
62
- console.log('\n[✓] Goodbye!\n');
65
+ console.log('\nGoodbye!\n');
63
66
  process.exit(0);
64
67
  }
65
68
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "acadex-cli",
3
- "version": "1.2.3",
3
+ "version": "1.3.0",
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": {
@@ -34,7 +34,8 @@
34
34
  },
35
35
  "preferGlobal": true,
36
36
  "dependencies": {
37
- "inquirer": "^8.2.6"
37
+ "inquirer": "^8.2.6",
38
+ "update-notifier": "^6.0.2"
38
39
  },
39
40
  "os": [
40
41
  "darwin",