@glash/cli 0.2.30 → 0.2.31
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/README.md +3 -0
- package/commands/deploy.mjs +25 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -104,6 +104,8 @@ glash deploy --asset-mode offload
|
|
|
104
104
|
glash deploy --asset-mode auto --asset-threshold 100mb
|
|
105
105
|
```
|
|
106
106
|
|
|
107
|
+
Every deploy prints a live monitor link. Open it to watch the black-screen deployment flow while the CLI is packaging, uploading, building, routing, and checking the live URL.
|
|
108
|
+
|
|
107
109
|
## Commands
|
|
108
110
|
|
|
109
111
|
| Command | Purpose |
|
|
@@ -174,6 +176,7 @@ The commands require PostgreSQL client tools locally: `pg_dump` for dumps,
|
|
|
174
176
|
| Variable | Default | Notes |
|
|
175
177
|
| --- | --- | --- |
|
|
176
178
|
| `GLASH_API_URL` | `https://api.glashdb.com/api` | Override the API base (self-hosted, staging) |
|
|
179
|
+
| `GLASH_APP_URL` | `https://glashdb.com` | Override the dashboard base used for live monitor links |
|
|
177
180
|
| `GLASH_TOKEN` | — | Use this token instead of `~/.glash/credentials.json` (useful in CI) |
|
|
178
181
|
| `GLASH_ASSET_OFFLOAD_THRESHOLD` | `100mb` | Default threshold for `glash deploy --asset-mode auto` |
|
|
179
182
|
|
package/commands/deploy.mjs
CHANGED
|
@@ -135,6 +135,8 @@ export async function deploy({ flags }) {
|
|
|
135
135
|
const gitBranch = flags.branch || currentBranch();
|
|
136
136
|
const target = flags.prod || flags.production ? 'production' : (flags.target || 'production');
|
|
137
137
|
const requestedAssetMode = assetMode(flags);
|
|
138
|
+
const monitorStartedAt = Date.now();
|
|
139
|
+
const initialStatusUrl = deployMonitorUrl({ projectId, after: monitorStartedAt });
|
|
138
140
|
|
|
139
141
|
let dep;
|
|
140
142
|
let envSummary = { count: 0, skipped: Boolean(flags['no-env']) };
|
|
@@ -154,9 +156,11 @@ export async function deploy({ flags }) {
|
|
|
154
156
|
envSummary,
|
|
155
157
|
assetSummary,
|
|
156
158
|
liveUrl: '',
|
|
159
|
+
statusUrl: initialStatusUrl,
|
|
157
160
|
error: '',
|
|
158
161
|
start,
|
|
159
162
|
};
|
|
163
|
+
info(`Live status: ${terminalLink(initialStatusUrl)}`);
|
|
160
164
|
indicator.start(currentPhase);
|
|
161
165
|
|
|
162
166
|
if (!flags['no-env']) {
|
|
@@ -211,6 +215,7 @@ export async function deploy({ flags }) {
|
|
|
211
215
|
indicator.setPhase('glashing');
|
|
212
216
|
dep = await apiPost('/deployments/upload', formData);
|
|
213
217
|
report.deploymentId = dep?.id ?? '';
|
|
218
|
+
report.statusUrl = deployMonitorUrl({ deploymentId: dep?.id, projectId, after: monitorStartedAt });
|
|
214
219
|
report.packagesUploaded = 1;
|
|
215
220
|
await rm(zipPath, { force: true }).catch(() => {});
|
|
216
221
|
} catch (e) {
|
|
@@ -224,6 +229,7 @@ export async function deploy({ flags }) {
|
|
|
224
229
|
try {
|
|
225
230
|
dep = await apiPost('/deployments', { projectId, commitHash, gitBranch, target });
|
|
226
231
|
report.deploymentId = dep?.id ?? '';
|
|
232
|
+
report.statusUrl = deployMonitorUrl({ deploymentId: dep?.id, projectId, after: monitorStartedAt });
|
|
227
233
|
} catch (e) {
|
|
228
234
|
indicator.fail('failed');
|
|
229
235
|
printDeployReport({ ...report, status: 'failed', error: e.message });
|
|
@@ -235,6 +241,7 @@ export async function deploy({ flags }) {
|
|
|
235
241
|
indicator.fail('queued');
|
|
236
242
|
printDeployReport({ ...report, status: 'queued' });
|
|
237
243
|
info(`Queued: ${color.dim(dep.id)}`);
|
|
244
|
+
info(`Watch live: ${terminalLink(report.statusUrl)}`);
|
|
238
245
|
info(`Track it with: ${color.cyan(`glash status ${dep.id}`)}`);
|
|
239
246
|
return;
|
|
240
247
|
}
|
|
@@ -667,6 +674,23 @@ function normalizeLiveUrl(url) {
|
|
|
667
674
|
return url ? `https://${String(url).replace(/^https?:\/\//, '')}` : '';
|
|
668
675
|
}
|
|
669
676
|
|
|
677
|
+
function deployMonitorUrl({ deploymentId, projectId, after } = {}) {
|
|
678
|
+
const base = appBaseUrl();
|
|
679
|
+
if (deploymentId) return `${base}/app/deploy/live/${encodeURIComponent(deploymentId)}`;
|
|
680
|
+
const url = new URL(`${base}/app/deploy/live`);
|
|
681
|
+
if (projectId) url.searchParams.set('projectId', projectId);
|
|
682
|
+
if (after) url.searchParams.set('after', String(after));
|
|
683
|
+
return url.toString();
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
function appBaseUrl() {
|
|
687
|
+
const configured = process.env.GLASH_APP_URL?.trim().replace(/\/$/, '');
|
|
688
|
+
if (configured) return configured;
|
|
689
|
+
const api = process.env.GLASH_API_URL || '';
|
|
690
|
+
if (/^https?:\/\/(localhost|127\.0\.0\.1|\[::1\])/i.test(api)) return 'http://localhost:3000';
|
|
691
|
+
return 'https://glashdb.com';
|
|
692
|
+
}
|
|
693
|
+
|
|
670
694
|
function printDeployReport(report) {
|
|
671
695
|
const elapsedMs = Date.now() - report.start;
|
|
672
696
|
const liveUrl = report.liveUrl ? terminalLink(report.liveUrl) : '-';
|
|
@@ -680,6 +704,7 @@ function printDeployReport(report) {
|
|
|
680
704
|
['Public assets', formatAssetSummary(report.assetSummary)],
|
|
681
705
|
['Deployment size', formatDeploymentSize(report)],
|
|
682
706
|
['Total time spent', formatMinutes(elapsedMs)],
|
|
707
|
+
['Status link', report.statusUrl ? terminalLink(report.statusUrl) : '-'],
|
|
683
708
|
['Live URL', liveUrl],
|
|
684
709
|
['Environment', formatEnvSummary(report.envSummary)],
|
|
685
710
|
];
|
package/package.json
CHANGED