@solcreek/cli 0.4.18 → 0.4.19
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/dist/commands/deploy.js +3 -1
- package/dist/utils/sandbox.d.ts +10 -0
- package/dist/utils/sandbox.js +20 -1
- package/package.json +2 -2
package/dist/commands/deploy.js
CHANGED
|
@@ -8,7 +8,7 @@ import { CreekClient, CreekAuthError, detectFramework, resolveConfig, formatDete
|
|
|
8
8
|
import { buildDoctorContext } from "../utils/doctor-context.js";
|
|
9
9
|
import { getToken, getApiUrl } from "../utils/config.js";
|
|
10
10
|
import { collectAssets } from "../utils/bundle.js";
|
|
11
|
-
import { sandboxDeploy, pollSandboxStatus, printSandboxSuccess } from "../utils/sandbox.js";
|
|
11
|
+
import { sandboxDeploy, pollSandboxStatus, printSandboxSuccess, expiresInMinutes } from "../utils/sandbox.js";
|
|
12
12
|
import { prepareDeployBundle } from "../utils/prepare-bundle.js";
|
|
13
13
|
import { BuildLogEmitter } from "../utils/build-log.js";
|
|
14
14
|
import { isTTY, jsonOutput, resolveJsonMode, globalArgs, shouldAutoConfirm, AUTH_BREADCRUMBS, NO_PROJECT_BREADCRUMBS } from "../utils/output.js";
|
|
@@ -648,6 +648,7 @@ async function deployDirectory(dir, jsonMode, tos) {
|
|
|
648
648
|
url: status.previewUrl,
|
|
649
649
|
deployDurationMs: status.deployDurationMs,
|
|
650
650
|
expiresAt: result.expiresAt,
|
|
651
|
+
expiresInMinutes: expiresInMinutes(result.expiresAt),
|
|
651
652
|
assetCount: fileList.length,
|
|
652
653
|
mode: "sandbox",
|
|
653
654
|
}, 0, [
|
|
@@ -777,6 +778,7 @@ async function deploySandbox(cwd, skipBuild, jsonMode = false, resolved, tos) {
|
|
|
777
778
|
url: status.previewUrl,
|
|
778
779
|
deployDurationMs: status.deployDurationMs,
|
|
779
780
|
expiresAt: result.expiresAt,
|
|
781
|
+
expiresInMinutes: expiresInMinutes(result.expiresAt),
|
|
780
782
|
framework: framework ?? null,
|
|
781
783
|
assetCount: fileList.length,
|
|
782
784
|
mode: "sandbox",
|
package/dist/utils/sandbox.d.ts
CHANGED
|
@@ -60,6 +60,16 @@ export declare function sandboxDeploy(bundle: {
|
|
|
60
60
|
* Poll sandbox status until terminal state.
|
|
61
61
|
*/
|
|
62
62
|
export declare function pollSandboxStatus(statusUrl: string): Promise<SandboxStatusResponse>;
|
|
63
|
+
/**
|
|
64
|
+
* Compute minutes-remaining until expiresAt (ISO string). Clamps at 0.
|
|
65
|
+
* Returned integer is ceiling, so a sandbox with 60:01 left reports 61.
|
|
66
|
+
*/
|
|
67
|
+
export declare function expiresInMinutes(expiresAt: string): number;
|
|
68
|
+
/**
|
|
69
|
+
* Format expiresAt as a local-clock wall time ("HH:MM") for users who
|
|
70
|
+
* don't want to mentally parse ISO timestamps in UTC.
|
|
71
|
+
*/
|
|
72
|
+
export declare function expiresAtLocal(expiresAt: string): string;
|
|
63
73
|
/**
|
|
64
74
|
* Print sandbox success message with claim instructions.
|
|
65
75
|
*/
|
package/dist/utils/sandbox.js
CHANGED
|
@@ -57,13 +57,32 @@ export async function pollSandboxStatus(statusUrl) {
|
|
|
57
57
|
}
|
|
58
58
|
throw new Error("Sandbox deploy timed out");
|
|
59
59
|
}
|
|
60
|
+
/**
|
|
61
|
+
* Compute minutes-remaining until expiresAt (ISO string). Clamps at 0.
|
|
62
|
+
* Returned integer is ceiling, so a sandbox with 60:01 left reports 61.
|
|
63
|
+
*/
|
|
64
|
+
export function expiresInMinutes(expiresAt) {
|
|
65
|
+
const ms = new Date(expiresAt).getTime() - Date.now();
|
|
66
|
+
return Math.max(0, Math.ceil(ms / 60_000));
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Format expiresAt as a local-clock wall time ("HH:MM") for users who
|
|
70
|
+
* don't want to mentally parse ISO timestamps in UTC.
|
|
71
|
+
*/
|
|
72
|
+
export function expiresAtLocal(expiresAt) {
|
|
73
|
+
const d = new Date(expiresAt);
|
|
74
|
+
const hh = d.getHours().toString().padStart(2, "0");
|
|
75
|
+
const mm = d.getMinutes().toString().padStart(2, "0");
|
|
76
|
+
return `${hh}:${mm}`;
|
|
77
|
+
}
|
|
60
78
|
/**
|
|
61
79
|
* Print sandbox success message with claim instructions.
|
|
62
80
|
*/
|
|
63
81
|
export function printSandboxSuccess(previewUrl, expiresAt, sandboxId) {
|
|
82
|
+
const mins = expiresInMinutes(expiresAt);
|
|
64
83
|
consola.success(` Live → ${previewUrl}`);
|
|
65
84
|
consola.info("");
|
|
66
|
-
consola.info(
|
|
85
|
+
consola.info(` Expires in ${mins} minutes (local ${expiresAtLocal(expiresAt)}).`);
|
|
67
86
|
consola.info(" Make it permanent: creek login && creek claim " + sandboxId);
|
|
68
87
|
}
|
|
69
88
|
//# sourceMappingURL=sandbox.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solcreek/cli",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.19",
|
|
4
4
|
"description": "CLI for the Creek deployment platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"esbuild": "^0.25.0",
|
|
34
34
|
"smol-toml": "^1.3.1",
|
|
35
35
|
"ws": "^8.20.0",
|
|
36
|
-
"@solcreek/sdk": "0.4.
|
|
36
|
+
"@solcreek/sdk": "0.4.8"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@testing-library/dom": "^10.4.1",
|