@akash-chowdhury-24/deployhub 1.0.1 → 1.0.5

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 (79) hide show
  1. package/README.md +176 -176
  2. package/install.ps1 +65 -55
  3. package/install.sh +99 -99
  4. package/package.json +93 -86
  5. package/src/adapters/dotnet.adapter.js +41 -41
  6. package/src/adapters/go.adapter.js +40 -40
  7. package/src/adapters/index.js +48 -48
  8. package/src/adapters/java.adapter.js +46 -46
  9. package/src/adapters/node.adapter.js +77 -77
  10. package/src/adapters/php.adapter.js +43 -43
  11. package/src/adapters/python.adapter.js +54 -54
  12. package/src/adapters/rails.adapter.js +66 -66
  13. package/src/artifact/engine.js +473 -473
  14. package/src/cli/index.js +45 -45
  15. package/src/commands/artifact.js +88 -88
  16. package/src/commands/build.js +44 -44
  17. package/src/commands/clean.js +50 -50
  18. package/src/commands/deploy.js +82 -82
  19. package/src/commands/doctor.js +630 -630
  20. package/src/commands/init.js +810 -795
  21. package/src/commands/logs.js +33 -33
  22. package/src/commands/rollback.js +50 -50
  23. package/src/commands/storage.js +116 -116
  24. package/src/commands/update.js +63 -63
  25. package/src/commands/verify.js +55 -55
  26. package/src/core/config.js +168 -168
  27. package/src/core/pipeline.js +77 -77
  28. package/src/core/stages.js +210 -210
  29. package/src/deployment/index.js +156 -156
  30. package/src/deployment/providers/azure-vm.js +7 -7
  31. package/src/deployment/providers/docker.js +30 -30
  32. package/src/deployment/providers/ec2.js +7 -7
  33. package/src/deployment/providers/gcp-vm.js +7 -7
  34. package/src/deployment/providers/kubernetes.js +30 -30
  35. package/src/deployment/providers/platforms/_shared.js +167 -167
  36. package/src/deployment/providers/platforms/aws-amplify.js +164 -164
  37. package/src/deployment/providers/platforms/azure-static-web-apps.js +68 -68
  38. package/src/deployment/providers/platforms/cloudflare-pages.js +103 -103
  39. package/src/deployment/providers/platforms/firebase-app-hosting.js +95 -95
  40. package/src/deployment/providers/platforms/firebase-hosting.js +99 -99
  41. package/src/deployment/providers/platforms/index.js +44 -44
  42. package/src/deployment/providers/platforms/netlify.js +102 -102
  43. package/src/deployment/providers/platforms/vercel.js +92 -92
  44. package/src/deployment/providers/ssh.js +365 -365
  45. package/src/detectors/angular.js +23 -23
  46. package/src/detectors/backend.detector.js +304 -304
  47. package/src/detectors/dotnet.js +18 -18
  48. package/src/detectors/frontend.detector.js +219 -219
  49. package/src/detectors/go.js +20 -20
  50. package/src/detectors/index.js +78 -78
  51. package/src/detectors/java.js +24 -24
  52. package/src/detectors/nextjs.js +23 -23
  53. package/src/detectors/node.js +28 -28
  54. package/src/detectors/php.js +17 -17
  55. package/src/detectors/python.js +22 -22
  56. package/src/detectors/react.js +29 -29
  57. package/src/detectors/vue.js +23 -23
  58. package/src/logger/index.js +44 -44
  59. package/src/notifications/email.js +53 -53
  60. package/src/notifications/index.js +34 -34
  61. package/src/notifications/slack.js +18 -18
  62. package/src/notifications/webhook.js +21 -21
  63. package/src/rollback/engine.js +102 -102
  64. package/src/storage/index.js +109 -109
  65. package/src/storage/providers/aws.js +96 -96
  66. package/src/storage/providers/azure.js +45 -45
  67. package/src/storage/providers/dropbox.js +49 -49
  68. package/src/storage/providers/ftp.js +69 -69
  69. package/src/storage/providers/gcp.js +45 -45
  70. package/src/storage/providers/gdrive.js +80 -80
  71. package/src/storage/providers/local.js +61 -61
  72. package/src/utils/author.js +154 -141
  73. package/src/utils/checksums.js +53 -53
  74. package/src/utils/firebase-config-generator.js +35 -35
  75. package/src/utils/github-actions.js +403 -403
  76. package/src/utils/init-platform.js +229 -229
  77. package/src/utils/nginx.js +34 -34
  78. package/src/utils/platform-env.js +132 -132
  79. package/src/utils/version.js +31 -31
package/README.md CHANGED
@@ -1,176 +1,176 @@
1
- # DeployHub
2
-
3
- Zero-configuration deployment and artifact manager for Node.js projects. When you push to GitHub, DeployHub automatically detects your project type, builds it, creates a versioned artifact, uploads to cloud storage, and optionally deploys to your server.
4
-
5
- ## Installation
6
-
7
- ```bash
8
- npm install -g @akash-chowdhury-24/deployhub
9
- ```
10
-
11
- Or use locally in your project:
12
-
13
- ```bash
14
- npm install @akash-chowdhury-24/deployhub
15
- npx @akash-chowdhury-24/deployhub init
16
- ```
17
-
18
- ## Quick Start
19
-
20
- ### 1. Initialize
21
-
22
- ```bash
23
- deployhub init
24
- ```
25
-
26
- This interactive wizard will:
27
-
28
- - Detect your framework (React, Vue, Next.js, Node, Python, etc.)
29
- - Configure build commands and output directory
30
- - Set up storage providers (AWS, Google Drive, Azure, GCP, Dropbox, Local)
31
- - Optionally configure deployment targets (SSH, Docker, EC2, Kubernetes, etc.)
32
- - Generate `deployhub.config.json`
33
- - Generate `.github/workflows/deployhub.yml`
34
- - Generate `.env.example`
35
-
36
- ### 2. Configure credentials
37
-
38
- ```bash
39
- cp .env.example .env
40
- # Edit .env with your credentials
41
-
42
- deployhub storage add aws
43
- deployhub storage add gdrive
44
- ```
45
-
46
- ### 3. Run pre-flight checks
47
-
48
- ```bash
49
- deployhub doctor
50
- ```
51
-
52
- ### 4. Deploy
53
-
54
- ```bash
55
- deployhub build
56
- ```
57
-
58
- Or push to `main` — GitHub Actions runs `deployhub build` automatically.
59
-
60
- ## Commands
61
-
62
- | Command | Description |
63
- |---------|-------------|
64
- | `deployhub init` | Interactive project setup |
65
- | `deployhub build` | Full pipeline: detect → install → test → build → artifact → storage → deploy |
66
- | `deployhub artifact create` | Create artifact from current build |
67
- | `deployhub artifact list` | List all artifacts |
68
- | `deployhub artifact restore <version>` | Download and extract an artifact |
69
- | `deployhub storage add <provider>` | Add storage provider credentials |
70
- | `deployhub storage list` | List storage providers and connection status |
71
- | `deployhub deploy` | Deploy latest artifact |
72
- | `deployhub rollback [version]` | Rollback to a previous version |
73
- | `deployhub logs` | Show logs from last deployment |
74
- | `deployhub doctor` | Pre-flight checks |
75
- | `deployhub verify` | Health check on configured endpoint |
76
- | `deployhub clean` | Remove old local artifacts |
77
- | `deployhub update` | Check for CLI updates |
78
-
79
- ## GitHub Secrets
80
-
81
- Add these secrets in your repository (Settings → Secrets and variables → Actions). Only add secrets for providers you selected during `init`:
82
-
83
- | Secret | Provider |
84
- |--------|----------|
85
- | `AWS_ACCESS_KEY_ID` | AWS S3 |
86
- | `AWS_SECRET_ACCESS_KEY` | AWS S3 |
87
- | `AWS_BUCKET` | AWS S3 |
88
- | `AWS_REGION` | AWS S3 |
89
- | `GDRIVE_CLIENT_ID` | Google Drive |
90
- | `GDRIVE_CLIENT_SECRET` | Google Drive |
91
- | `GDRIVE_REFRESH_TOKEN` | Google Drive |
92
- | `GDRIVE_FOLDER_ID` | Google Drive |
93
- | `AZURE_CONNECTION_STRING` | Azure Blob |
94
- | `AZURE_CONTAINER` | Azure Blob |
95
- | `GCP_PROJECT_ID` | GCP Storage |
96
- | `GCP_KEY_FILE` | GCP Storage |
97
- | `GCP_BUCKET` | GCP Storage |
98
- | `DROPBOX_ACCESS_TOKEN` | Dropbox |
99
- | `SSH_HOST` | SSH deployment |
100
- | `SSH_USER` | SSH deployment |
101
- | `SSH_KEY` | SSH deployment |
102
-
103
- ## `deployhub doctor` Output
104
-
105
- The doctor command runs independent checks and always completes without crashing:
106
-
107
- ```
108
- Checking Git... ✓ Git installed, repo detected, remote set
109
- Checking Docker... ✓ Docker running
110
- Checking Build command... ✓ "npm run build" found in package.json
111
- Checking AWS... ✓ Credentials valid, bucket accessible
112
- Checking Google Drive... ✓ Connected
113
- Checking SSH target... ✓ Can reach host
114
- Checking Health endpoint... ✓ URL reachable (HTTP 200)
115
- Checking Secrets... ✓ All required env vars present
116
- Checking GitHub Actions... ✓ Workflow file exists at .github/workflows/deployhub.yml
117
- Checking Storage write... ✓ Test upload succeeded
118
-
119
- ✓ Ready to deploy (10/10 checks passed)
120
- ```
121
-
122
- If checks fail:
123
-
124
- ```
125
- Checking AWS... ✗ Missing: AWS_SECRET_ACCESS_KEY
126
- Checking Health endpoint... ✗ No URL configured
127
-
128
- 8/10 — fix the 2 issues above before deploying
129
- ```
130
-
131
- ## Artifact Structure
132
-
133
- Each build creates:
134
-
135
- ```
136
- artifact/
137
- {projectName}/
138
- {YYYY-MM-DD}/
139
- v{semver}/
140
- artifact.zip
141
- metadata.json
142
- logs.txt
143
- checksums.txt
144
- deployment.json
145
- release-notes.md
146
- README.md
147
- ```
148
-
149
- ## Configuration
150
-
151
- `deployhub.config.json` is generated by `init`. Credentials are **never** stored in this file — only in `.env` or GitHub Secrets.
152
-
153
- ## Pipeline Stages
154
-
155
- 1. **detect** — auto-detect project type
156
- 2. **install** — install dependencies
157
- 3. **test** — run test suite (skippable)
158
- 4. **build** — run build command
159
- 5. **docker** — build Docker image (skippable)
160
- 6. **artifact** — create artifact.zip + metadata
161
- 7. **storage** — upload to all configured providers (parallel)
162
- 8. **deploy** — deploy to configured targets
163
- 9. **verify** — health check after deployment
164
- 10. **notify** — send Slack/email/webhook notifications
165
-
166
- ## Author
167
-
168
- **Akash Chowdhury**
169
- 📧 akashbumbac24@gmail.com
170
- 💼 [linkedin.com/in/akash-chowdhury-12141a222](https://www.linkedin.com/in/akash-chowdhury-12141a222/)
171
-
172
- Built with ❤ — if DeployHub saves you time, feel free to connect on LinkedIn.
173
-
174
- ## License
175
-
176
- MIT
1
+ # DeployHub
2
+
3
+ Zero-configuration deployment and artifact manager for Node.js projects. When you push to GitHub, DeployHub automatically detects your project type, builds it, creates a versioned artifact, uploads to cloud storage, and optionally deploys to your server.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install -g @akash-chowdhury-24/deployhub
9
+ ```
10
+
11
+ Or use locally in your project:
12
+
13
+ ```bash
14
+ npm install @akash-chowdhury-24/deployhub
15
+ npx @akash-chowdhury-24/deployhub init
16
+ ```
17
+
18
+ ## Quick Start
19
+
20
+ ### 1. Initialize
21
+
22
+ ```bash
23
+ deployhub init
24
+ ```
25
+
26
+ This interactive wizard will:
27
+
28
+ - Detect your framework (React, Vue, Next.js, Node, Python, etc.)
29
+ - Configure build commands and output directory
30
+ - Set up storage providers (AWS, Google Drive, Azure, GCP, Dropbox, Local)
31
+ - Optionally configure deployment targets (SSH, Docker, EC2, Kubernetes, etc.)
32
+ - Generate `deployhub.config.json`
33
+ - Generate `.github/workflows/deployhub.yml`
34
+ - Generate `.env.example`
35
+
36
+ ### 2. Configure credentials
37
+
38
+ ```bash
39
+ cp .env.example .env
40
+ # Edit .env with your credentials
41
+
42
+ deployhub storage add aws
43
+ deployhub storage add gdrive
44
+ ```
45
+
46
+ ### 3. Run pre-flight checks
47
+
48
+ ```bash
49
+ deployhub doctor
50
+ ```
51
+
52
+ ### 4. Deploy
53
+
54
+ ```bash
55
+ deployhub build
56
+ ```
57
+
58
+ Or push to `main` — GitHub Actions runs `deployhub build` automatically.
59
+
60
+ ## Commands
61
+
62
+ | Command | Description |
63
+ |---------|-------------|
64
+ | `deployhub init` | Interactive project setup |
65
+ | `deployhub build` | Full pipeline: detect → install → test → build → artifact → storage → deploy |
66
+ | `deployhub artifact create` | Create artifact from current build |
67
+ | `deployhub artifact list` | List all artifacts |
68
+ | `deployhub artifact restore <version>` | Download and extract an artifact |
69
+ | `deployhub storage add <provider>` | Add storage provider credentials |
70
+ | `deployhub storage list` | List storage providers and connection status |
71
+ | `deployhub deploy` | Deploy latest artifact |
72
+ | `deployhub rollback [version]` | Rollback to a previous version |
73
+ | `deployhub logs` | Show logs from last deployment |
74
+ | `deployhub doctor` | Pre-flight checks |
75
+ | `deployhub verify` | Health check on configured endpoint |
76
+ | `deployhub clean` | Remove old local artifacts |
77
+ | `deployhub update` | Check for CLI updates |
78
+
79
+ ## GitHub Secrets
80
+
81
+ Add these secrets in your repository (Settings → Secrets and variables → Actions). Only add secrets for providers you selected during `init`:
82
+
83
+ | Secret | Provider |
84
+ |--------|----------|
85
+ | `AWS_ACCESS_KEY_ID` | AWS S3 |
86
+ | `AWS_SECRET_ACCESS_KEY` | AWS S3 |
87
+ | `AWS_BUCKET` | AWS S3 |
88
+ | `AWS_REGION` | AWS S3 |
89
+ | `GDRIVE_CLIENT_ID` | Google Drive |
90
+ | `GDRIVE_CLIENT_SECRET` | Google Drive |
91
+ | `GDRIVE_REFRESH_TOKEN` | Google Drive |
92
+ | `GDRIVE_FOLDER_ID` | Google Drive |
93
+ | `AZURE_CONNECTION_STRING` | Azure Blob |
94
+ | `AZURE_CONTAINER` | Azure Blob |
95
+ | `GCP_PROJECT_ID` | GCP Storage |
96
+ | `GCP_KEY_FILE` | GCP Storage |
97
+ | `GCP_BUCKET` | GCP Storage |
98
+ | `DROPBOX_ACCESS_TOKEN` | Dropbox |
99
+ | `SSH_HOST` | SSH deployment |
100
+ | `SSH_USER` | SSH deployment |
101
+ | `SSH_KEY` | SSH deployment |
102
+
103
+ ## `deployhub doctor` Output
104
+
105
+ The doctor command runs independent checks and always completes without crashing:
106
+
107
+ ```
108
+ Checking Git... ✓ Git installed, repo detected, remote set
109
+ Checking Docker... ✓ Docker running
110
+ Checking Build command... ✓ "npm run build" found in package.json
111
+ Checking AWS... ✓ Credentials valid, bucket accessible
112
+ Checking Google Drive... ✓ Connected
113
+ Checking SSH target... ✓ Can reach host
114
+ Checking Health endpoint... ✓ URL reachable (HTTP 200)
115
+ Checking Secrets... ✓ All required env vars present
116
+ Checking GitHub Actions... ✓ Workflow file exists at .github/workflows/deployhub.yml
117
+ Checking Storage write... ✓ Test upload succeeded
118
+
119
+ ✓ Ready to deploy (10/10 checks passed)
120
+ ```
121
+
122
+ If checks fail:
123
+
124
+ ```
125
+ Checking AWS... ✗ Missing: AWS_SECRET_ACCESS_KEY
126
+ Checking Health endpoint... ✗ No URL configured
127
+
128
+ 8/10 — fix the 2 issues above before deploying
129
+ ```
130
+
131
+ ## Artifact Structure
132
+
133
+ Each build creates:
134
+
135
+ ```
136
+ artifact/
137
+ {projectName}/
138
+ {YYYY-MM-DD}/
139
+ v{semver}/
140
+ artifact.zip
141
+ metadata.json
142
+ logs.txt
143
+ checksums.txt
144
+ deployment.json
145
+ release-notes.md
146
+ README.md
147
+ ```
148
+
149
+ ## Configuration
150
+
151
+ `deployhub.config.json` is generated by `init`. Credentials are **never** stored in this file — only in `.env` or GitHub Secrets.
152
+
153
+ ## Pipeline Stages
154
+
155
+ 1. **detect** — auto-detect project type
156
+ 2. **install** — install dependencies
157
+ 3. **test** — run test suite (skippable)
158
+ 4. **build** — run build command
159
+ 5. **docker** — build Docker image (skippable)
160
+ 6. **artifact** — create artifact.zip + metadata
161
+ 7. **storage** — upload to all configured providers (parallel)
162
+ 8. **deploy** — deploy to configured targets
163
+ 9. **verify** — health check after deployment
164
+ 10. **notify** — send Slack/email/webhook notifications
165
+
166
+ ## Author
167
+
168
+ **Akash Chowdhury**
169
+ 📧 akashbumbac24@gmail.com
170
+ 💼 [linkedin.com/in/akash-chowdhury-12141a222](https://www.linkedin.com/in/akash-chowdhury-12141a222/)
171
+
172
+ Built with ❤ — if DeployHub saves you time, feel free to connect on LinkedIn.
173
+
174
+ ## License
175
+
176
+ MIT
package/install.ps1 CHANGED
@@ -1,55 +1,65 @@
1
- # DeployHub install script for Windows
2
- # Author: Akash Chowdhury — canonical source: src/utils/author.js
3
- # Repository: https://github.com/Akash-Chowdhury-24/DeployHub
4
-
5
- $ErrorActionPreference = "Stop"
6
-
7
- $GitHubRepo = "Akash-Chowdhury-24/DeployHub"
8
- $BinaryName = "deployhub.exe"
9
-
10
- function Get-LatestVersion {
11
- $release = Invoke-RestMethod -Uri "https://api.github.com/repos/$GitHubRepo/releases/latest"
12
- return $release.tag_name
13
- }
14
-
15
- function Get-InstallDir {
16
- $localBin = Join-Path $env:LOCALAPPDATA "Programs\DeployHub"
17
- if (-not (Test-Path $localBin)) {
18
- New-Item -ItemType Directory -Path $localBin -Force | Out-Null
19
- }
20
- return $localBin
21
- }
22
-
23
- function Add-ToPath {
24
- param([string]$Dir)
25
- $userPath = [Environment]::GetEnvironmentVariable("Path", "User")
26
- if ($userPath -notlike "*$Dir*") {
27
- [Environment]::SetEnvironmentVariable("Path", "$userPath;$Dir", "User")
28
- $env:Path = "$env:Path;$Dir"
29
- Write-Host "Added $Dir to user PATH"
30
- }
31
- }
32
-
33
- try {
34
- $version = Get-LatestVersion
35
- $assetName = "deployhub-win.exe"
36
- $url = "https://github.com/$GitHubRepo/releases/download/$version/$assetName"
37
- $installDir = Get-InstallDir
38
- $dest = Join-Path $installDir $BinaryName
39
-
40
- Write-Host "Downloading DeployHub $version for Windows..."
41
- Invoke-WebRequest -Uri $url -OutFile $dest -UseBasicParsing
42
-
43
- if (-not (Test-Path $dest) -or (Get-Item $dest).Length -eq 0) {
44
- throw "Binary download failed"
45
- }
46
-
47
- Add-ToPath $installDir
48
- Write-Host "DeployHub $version installed to $dest"
49
- & $dest --version
50
- }
51
- catch {
52
- Write-Host "Binary install failed ($($_.Exception.Message)). Falling back to npm..." -ForegroundColor Yellow
53
- npm install -g @akash-chowdhury-24/deployhub@latest
54
- Write-Host "DeployHub installed via npm."
55
- }
1
+ # DeployHub install script for Windows
2
+ # Author: Akash Chowdhury — canonical source: src/utils/author.js
3
+ # Repository: https://github.com/Akash-Chowdhury-24/DeployHub
4
+
5
+ $ErrorActionPreference = "Stop"
6
+
7
+ $GitHubRepo = "Akash-Chowdhury-24/DeployHub"
8
+ $BinaryName = "deployhub.exe"
9
+
10
+ function Get-LatestVersion {
11
+ $release = Invoke-RestMethod -Uri "https://api.github.com/repos/$GitHubRepo/releases/latest"
12
+ return $release.tag_name
13
+ }
14
+
15
+ function Get-InstallDir {
16
+ $localBin = Join-Path $env:LOCALAPPDATA "Programs\DeployHub"
17
+ if (-not (Test-Path $localBin)) {
18
+ New-Item -ItemType Directory -Path $localBin -Force | Out-Null
19
+ }
20
+ return $localBin
21
+ }
22
+
23
+ function Add-ToPath {
24
+ param([string]$Dir)
25
+ $userPath = [Environment]::GetEnvironmentVariable("Path", "User")
26
+ if ($userPath -notlike "*$Dir*") {
27
+ [Environment]::SetEnvironmentVariable("Path", "$userPath;$Dir", "User")
28
+ $env:Path = "$env:Path;$Dir"
29
+ Write-Host "Added $Dir to user PATH"
30
+ }
31
+ }
32
+
33
+ try {
34
+ $arch = $env:PROCESSOR_ARCHITECTURE
35
+ if ($arch -eq "ARM64") {
36
+ $binaryName = "deployhub-macos-arm64" # no Windows ARM64 binary yet
37
+ Write-Host "Windows ARM64 detected — no native binary available yet. Installing via npm instead..."
38
+ npm install -g @akash-chowdhury-24/deployhub@latest
39
+ exit 0
40
+ } else {
41
+ $binaryName = "deployhub-win.exe"
42
+ }
43
+
44
+ $version = Get-LatestVersion
45
+ $assetName = $binaryName
46
+ $url = "https://github.com/$GitHubRepo/releases/download/$version/$assetName"
47
+ $installDir = Get-InstallDir
48
+ $dest = Join-Path $installDir $BinaryName
49
+
50
+ Write-Host "Downloading DeployHub $version for Windows..."
51
+ Invoke-WebRequest -Uri $url -OutFile $dest -UseBasicParsing
52
+
53
+ if (-not (Test-Path $dest) -or (Get-Item $dest).Length -eq 0) {
54
+ throw "Binary download failed"
55
+ }
56
+
57
+ Add-ToPath $installDir
58
+ Write-Host "DeployHub $version installed to $dest"
59
+ & $dest --version
60
+ }
61
+ catch {
62
+ Write-Host "Binary install failed ($($_.Exception.Message)). Falling back to npm..." -ForegroundColor Yellow
63
+ npm install -g @akash-chowdhury-24/deployhub@latest
64
+ Write-Host "DeployHub installed via npm."
65
+ }
package/install.sh CHANGED
@@ -1,99 +1,99 @@
1
- #!/bin/sh
2
- # DeployHub install script
3
- # Author: Akash Chowdhury — canonical source: src/utils/author.js
4
- # Repository: https://github.com/Akash-Chowdhury-24/DeployHub
5
-
6
- set -e
7
-
8
- GITHUB_REPO="Akash-Chowdhury-24/DeployHub"
9
- INSTALL_DIR="/usr/local/bin"
10
- BINARY_NAME="deployhub"
11
-
12
- detect_platform() {
13
- OS="$(uname -s | tr '[:upper:]' '[:lower:]')"
14
- ARCH="$(uname -m)"
15
-
16
- case "$OS" in
17
- linux)
18
- case "$ARCH" in
19
- x86_64|amd64) PLATFORM="linux" ;;
20
- *) echo "Unsupported Linux architecture: $ARCH" >&2; exit 1 ;;
21
- esac
22
- ;;
23
- darwin)
24
- case "$ARCH" in
25
- x86_64) PLATFORM="macos" ;;
26
- arm64|aarch64) PLATFORM="macos-arm64" ;;
27
- *) echo "Unsupported macOS architecture: $ARCH" >&2; exit 1 ;;
28
- esac
29
- ;;
30
- *)
31
- echo "Unsupported OS: $OS. Use install.ps1 on Windows." >&2
32
- exit 1
33
- ;;
34
- esac
35
- }
36
-
37
- fetch_latest_version() {
38
- if command -v curl >/dev/null 2>&1; then
39
- VERSION=$(curl -fsSL "https://api.github.com/repos/${GITHUB_REPO}/releases/latest" \
40
- | sed -n 's/.*"tag_name"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' \
41
- | head -n 1)
42
- elif command -v wget >/dev/null 2>&1; then
43
- VERSION=$(wget -qO- "https://api.github.com/repos/${GITHUB_REPO}/releases/latest" \
44
- | sed -n 's/.*"tag_name"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' \
45
- | head -n 1)
46
- else
47
- echo "curl or wget is required to download DeployHub." >&2
48
- exit 1
49
- fi
50
-
51
- if [ -z "$VERSION" ]; then
52
- echo "Could not determine latest release version. Falling back to npm install." >&2
53
- npm install -g @akash-chowdhury-24/deployhub@latest
54
- echo "DeployHub installed via npm."
55
- exit 0
56
- fi
57
- }
58
-
59
- download_binary() {
60
- ASSET="deployhub-${PLATFORM}"
61
- URL="https://github.com/${GITHUB_REPO}/releases/download/${VERSION}/${ASSET}"
62
- TMP="$(mktemp)"
63
-
64
- echo "Downloading DeployHub ${VERSION} (${PLATFORM})..."
65
- if command -v curl >/dev/null 2>&1; then
66
- curl -fsSL "$URL" -o "$TMP"
67
- else
68
- wget -qO "$TMP" "$URL"
69
- fi
70
-
71
- if [ ! -s "$TMP" ]; then
72
- echo "Binary download failed. Falling back to npm install." >&2
73
- rm -f "$TMP"
74
- npm install -g @akash-chowdhury-24/deployhub@latest
75
- echo "DeployHub installed via npm."
76
- exit 0
77
- fi
78
-
79
- if [ "$(id -u)" -eq 0 ]; then
80
- install -m 755 "$TMP" "${INSTALL_DIR}/${BINARY_NAME}"
81
- else
82
- if command -v sudo >/dev/null 2>&1; then
83
- sudo install -m 755 "$TMP" "${INSTALL_DIR}/${BINARY_NAME}"
84
- else
85
- mkdir -p "${HOME}/.local/bin"
86
- install -m 755 "$TMP" "${HOME}/.local/bin/${BINARY_NAME}"
87
- echo "Installed to ${HOME}/.local/bin/${BINARY_NAME} — ensure it is on your PATH"
88
- fi
89
- fi
90
-
91
- rm -f "$TMP"
92
- }
93
-
94
- detect_platform
95
- fetch_latest_version
96
- download_binary
97
-
98
- echo "DeployHub ${VERSION} installed successfully."
99
- deployhub --version 2>/dev/null || true
1
+ #!/bin/sh
2
+ # DeployHub install script
3
+ # Author: Akash Chowdhury — canonical source: src/utils/author.js
4
+ # Repository: https://github.com/Akash-Chowdhury-24/DeployHub
5
+
6
+ set -e
7
+
8
+ GITHUB_REPO="Akash-Chowdhury-24/DeployHub"
9
+ INSTALL_DIR="/usr/local/bin"
10
+ BINARY_NAME="deployhub"
11
+
12
+ detect_platform() {
13
+ OS="$(uname -s | tr '[:upper:]' '[:lower:]')"
14
+ ARCH="$(uname -m)"
15
+
16
+ case "$OS" in
17
+ linux)
18
+ case "$ARCH" in
19
+ x86_64|amd64) PLATFORM="linux-x64" ;;
20
+ *) echo "Unsupported Linux architecture: $ARCH" >&2; exit 1 ;;
21
+ esac
22
+ ;;
23
+ darwin)
24
+ case "$ARCH" in
25
+ x86_64) PLATFORM="macos-x64" ;;
26
+ arm64|aarch64) PLATFORM="macos-arm64" ;;
27
+ *) echo "Unsupported macOS architecture: $ARCH" >&2; exit 1 ;;
28
+ esac
29
+ ;;
30
+ *)
31
+ echo "Unsupported OS: $OS. Use install.ps1 on Windows." >&2
32
+ exit 1
33
+ ;;
34
+ esac
35
+ }
36
+
37
+ fetch_latest_version() {
38
+ if command -v curl >/dev/null 2>&1; then
39
+ VERSION=$(curl -fsSL "https://api.github.com/repos/${GITHUB_REPO}/releases/latest" \
40
+ | sed -n 's/.*"tag_name"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' \
41
+ | head -n 1)
42
+ elif command -v wget >/dev/null 2>&1; then
43
+ VERSION=$(wget -qO- "https://api.github.com/repos/${GITHUB_REPO}/releases/latest" \
44
+ | sed -n 's/.*"tag_name"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' \
45
+ | head -n 1)
46
+ else
47
+ echo "curl or wget is required to download DeployHub." >&2
48
+ exit 1
49
+ fi
50
+
51
+ if [ -z "$VERSION" ]; then
52
+ echo "Could not determine latest release version. Falling back to npm install." >&2
53
+ npm install -g @akash-chowdhury-24/deployhub@latest
54
+ echo "DeployHub installed via npm."
55
+ exit 0
56
+ fi
57
+ }
58
+
59
+ download_binary() {
60
+ ASSET="deployhub-${PLATFORM}"
61
+ URL="https://github.com/${GITHUB_REPO}/releases/download/${VERSION}/${ASSET}"
62
+ TMP="$(mktemp)"
63
+
64
+ echo "Downloading DeployHub ${VERSION} (${PLATFORM})..."
65
+ if command -v curl >/dev/null 2>&1; then
66
+ curl -fsSL "$URL" -o "$TMP"
67
+ else
68
+ wget -qO "$TMP" "$URL"
69
+ fi
70
+
71
+ if [ ! -s "$TMP" ]; then
72
+ echo "Binary download failed. Falling back to npm install." >&2
73
+ rm -f "$TMP"
74
+ npm install -g @akash-chowdhury-24/deployhub@latest
75
+ echo "DeployHub installed via npm."
76
+ exit 0
77
+ fi
78
+
79
+ if [ "$(id -u)" -eq 0 ]; then
80
+ install -m 755 "$TMP" "${INSTALL_DIR}/${BINARY_NAME}"
81
+ else
82
+ if command -v sudo >/dev/null 2>&1; then
83
+ sudo install -m 755 "$TMP" "${INSTALL_DIR}/${BINARY_NAME}"
84
+ else
85
+ mkdir -p "${HOME}/.local/bin"
86
+ install -m 755 "$TMP" "${HOME}/.local/bin/${BINARY_NAME}"
87
+ echo "Installed to ${HOME}/.local/bin/${BINARY_NAME} — ensure it is on your PATH"
88
+ fi
89
+ fi
90
+
91
+ rm -f "$TMP"
92
+ }
93
+
94
+ detect_platform
95
+ fetch_latest_version
96
+ download_binary
97
+
98
+ echo "DeployHub ${VERSION} installed successfully."
99
+ deployhub --version 2>/dev/null || true