@solcreek/cli 0.4.17 → 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.
@@ -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, [
@@ -686,18 +687,34 @@ async function deploySandbox(cwd, skipBuild, jsonMode = false, resolved, tos) {
686
687
  // so we fail with a helpful message instead of an ENOENT stack trace.
687
688
  const pkgJsonPath = join(cwd, "package.json");
688
689
  if (!existsSync(pkgJsonPath)) {
690
+ // Static fallback: if there's no package.json but the cwd looks like a
691
+ // static site (index.html at root or under public/), treat as static
692
+ // and skip the build step. Covers the common "ran `creek init` in an
693
+ // empty dir, then added only index.html" journey — creek.toml's
694
+ // [build].command = "npm run build" default would otherwise trigger
695
+ // no_package_json here.
696
+ const cwdIndex = existsSync(join(cwd, "index.html"));
697
+ const publicIndex = existsSync(join(cwd, "public/index.html"));
698
+ if (cwdIndex || publicIndex) {
699
+ const staticDir = cwdIndex ? cwd : join(cwd, "public");
700
+ if (!jsonMode) {
701
+ consola.info(" No package.json found — deploying as static site (no build step).");
702
+ }
703
+ return deployDirectory(staticDir, jsonMode, tos);
704
+ }
689
705
  const message = `Expected package.json in ${cwd} but none found.`;
690
706
  if (jsonMode) {
691
707
  jsonOutput({
692
708
  ok: false,
693
709
  error: "no_package_json",
694
710
  message,
695
- hint: "Run `npx creek deploy ./dist` to deploy a prebuilt directory, or `npx creek deploy --template landing` to start from a template.",
711
+ hint: "Add an index.html to deploy as a static site, run `npx creek deploy ./dist` for a prebuilt directory, or `npx creek deploy --template landing` to start from a template.",
696
712
  }, 1, NO_PROJECT_BREADCRUMBS);
697
713
  return;
698
714
  }
699
715
  consola.error(message);
700
- consola.info(" Run `npx creek deploy ./dist` to deploy a prebuilt directory instead,");
716
+ consola.info(" Add an index.html to deploy as a static site,");
717
+ consola.info(" run `npx creek deploy ./dist` to deploy a prebuilt directory,");
701
718
  consola.info(" or `npx creek deploy --template landing` to start from a template.");
702
719
  process.exit(1);
703
720
  }
@@ -761,6 +778,7 @@ async function deploySandbox(cwd, skipBuild, jsonMode = false, resolved, tos) {
761
778
  url: status.previewUrl,
762
779
  deployDurationMs: status.deployDurationMs,
763
780
  expiresAt: result.expiresAt,
781
+ expiresInMinutes: expiresInMinutes(result.expiresAt),
764
782
  framework: framework ?? null,
765
783
  assetCount: fileList.length,
766
784
  mode: "sandbox",
@@ -6,6 +6,7 @@ const IGNORED_DIRS = new Set([
6
6
  const IGNORED_FILES = new Set([
7
7
  ".DS_Store", "Thumbs.db", ".env", ".env.local", ".env.production",
8
8
  ".gitignore", ".npmrc", ".eslintcache",
9
+ "creek.toml", "wrangler.toml", "wrangler.json", "wrangler.jsonc",
9
10
  ]);
10
11
  function isIgnored(name) {
11
12
  return name.startsWith(".") && IGNORED_FILES.has(name)
@@ -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
  */
@@ -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(" Free preview available for 60 minutes.");
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.17",
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.7"
36
+ "@solcreek/sdk": "0.4.8"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@testing-library/dom": "^10.4.1",