acadex-cli 1.2.5 → 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
@@ -65,6 +65,7 @@ show_help() {
65
65
  echo -e " ${GREEN}phpmyadmin${NC} Start Apache & open phpMyAdmin (port 8080)"
66
66
  echo -e " ${GREEN}phpmyadmin:stop${NC} Stop Apache"
67
67
  echo -e " ${GREEN}docs${NC} Open ACADEX documentation"
68
+ echo -e " ${GREEN}update${NC} Update ACADEX CLI to latest version"
68
69
  echo -e " ${GREEN}uninstall${NC} Uninstall ACADEX CLI globally"
69
70
  echo -e " ${GREEN}menu${NC} Interactive menu (modern UI)"
70
71
  echo ""
@@ -766,6 +767,18 @@ case "$1" in
766
767
  echo -e "${GREEN}Opening ACADEX documentation...${NC}"
767
768
  open "https://xaviworks.github.io/AcadexV3/"
768
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
+ ;;
769
782
  uninstall)
770
783
  echo -e "${BLUE}╔══════════════════════════════════════════════════════════╗${NC}"
771
784
  echo -e "${BLUE}║${NC} ${YELLOW}Uninstalling ACADEX CLI${NC} ${BLUE}║${NC}"
package/acadex.ps1 CHANGED
@@ -96,6 +96,8 @@ function Show-Help {
96
96
  Write-Host "Stop Apache (Windows)"
97
97
  Write-Host " docs " -ForegroundColor Green -NoNewline
98
98
  Write-Host "Open ACADEX documentation"
99
+ Write-Host " update " -ForegroundColor Green -NoNewline
100
+ Write-Host "Update ACADEX CLI to latest version"
99
101
  Write-Host " uninstall " -ForegroundColor Green -NoNewline
100
102
  Write-Host "Uninstall ACADEX CLI globally"
101
103
  Write-Host " menu " -ForegroundColor Green -NoNewline
@@ -853,6 +855,19 @@ switch ($Command) {
853
855
  Start-Process "https://xaviworks.github.io/AcadexV3/"
854
856
  }
855
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
+
856
871
  "uninstall" {
857
872
  Write-Host "===========================================================" -ForegroundColor Cyan
858
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');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "acadex-cli",
3
- "version": "1.2.5",
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",