@glash/cli 0.2.15 → 0.2.17
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/commands/deploy.mjs +23 -4
- package/lib/version.mjs +1 -1
- package/package.json +1 -1
package/commands/deploy.mjs
CHANGED
|
@@ -123,7 +123,8 @@ export async function deploy({ flags }) {
|
|
|
123
123
|
let projectId;
|
|
124
124
|
try { projectId = await resolveProjectId(flags); } catch (e) { return fail(e.message); }
|
|
125
125
|
|
|
126
|
-
const
|
|
126
|
+
const remoteDeploy = Boolean(flags.git || flags.repo || flags.remote);
|
|
127
|
+
const commitHash = flags.commit || (remoteDeploy ? undefined : currentCommit());
|
|
127
128
|
const gitBranch = flags.branch || currentBranch();
|
|
128
129
|
const target = flags.prod || flags.production ? 'production' : (flags.target || 'production');
|
|
129
130
|
|
|
@@ -137,7 +138,7 @@ export async function deploy({ flags }) {
|
|
|
137
138
|
}
|
|
138
139
|
}
|
|
139
140
|
|
|
140
|
-
if (!
|
|
141
|
+
if (!remoteDeploy) {
|
|
141
142
|
info(color.dim(`→ uploading local source for project ${projectId} (${target})`));
|
|
142
143
|
const zipPath = join(tmpdir(), `glash-deploy-${Date.now()}.zip`);
|
|
143
144
|
try {
|
|
@@ -178,12 +179,13 @@ export async function deploy({ flags }) {
|
|
|
178
179
|
const seen = new Set();
|
|
179
180
|
let lastStatus = '';
|
|
180
181
|
const start = Date.now();
|
|
182
|
+
const timeoutMs = deployTimeoutMs(flags);
|
|
181
183
|
let pollDelayMs = 5000;
|
|
182
184
|
let lastProgressAt = Date.now();
|
|
183
185
|
let currentPhase = 'queued';
|
|
184
186
|
const indicator = createDeployIndicator({ start, getPhase: () => currentPhase });
|
|
185
187
|
indicator.start();
|
|
186
|
-
while (Date.now() - start <
|
|
188
|
+
while (Date.now() - start < timeoutMs) {
|
|
187
189
|
let pipe;
|
|
188
190
|
try {
|
|
189
191
|
pipe = await apiGet(`/deployments/${dep.id}/pipeline`);
|
|
@@ -233,7 +235,7 @@ export async function deploy({ flags }) {
|
|
|
233
235
|
await indicator.wait(pollDelayMs);
|
|
234
236
|
}
|
|
235
237
|
indicator.stop();
|
|
236
|
-
warn(
|
|
238
|
+
warn(`Timed out after ${formatDuration(timeoutMs)} waiting for deployment. Check \`glash status ${dep.id}\`.`);
|
|
237
239
|
}
|
|
238
240
|
|
|
239
241
|
async function syncEnvBeforeDeploy(projectId, target, flags) {
|
|
@@ -312,6 +314,23 @@ function nextPollDelay(pipe) {
|
|
|
312
314
|
return 5000;
|
|
313
315
|
}
|
|
314
316
|
|
|
317
|
+
function deployTimeoutMs(flags) {
|
|
318
|
+
const raw = flags['wait-timeout'] ?? flags.timeout ?? process.env.GLASH_DEPLOY_TIMEOUT_MS;
|
|
319
|
+
if (raw !== undefined && raw !== null && raw !== '') {
|
|
320
|
+
const parsed = Number(raw);
|
|
321
|
+
if (Number.isFinite(parsed) && parsed > 0) {
|
|
322
|
+
return parsed < 1000 ? parsed * 60_000 : parsed;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
return 45 * 60_000;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
function formatDuration(ms) {
|
|
329
|
+
const seconds = Math.round(ms / 1000);
|
|
330
|
+
if (seconds < 90) return `${seconds}s`;
|
|
331
|
+
return `${Math.round(seconds / 60)}m`;
|
|
332
|
+
}
|
|
333
|
+
|
|
315
334
|
function phaseFromEvent(ev) {
|
|
316
335
|
if (ev.step === 'detect') return 'detecting';
|
|
317
336
|
if (ev.step === 'host') return 'assigning host';
|
package/lib/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.2.
|
|
1
|
+
export const VERSION = '0.2.17';
|
package/package.json
CHANGED