vslides 1.0.6 → 1.0.8

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 (3) hide show
  1. package/README.md +20 -0
  2. package/dist/cli.js +83 -46
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -214,6 +214,26 @@ vslides export pdf
214
214
  vslides export pptx
215
215
  ```
216
216
 
217
+ ## Deploy
218
+
219
+ #### `vslides deploy`
220
+
221
+ Deploy presentation as a permanent static site. The deployed URL works without the sandbox running and loads faster.
222
+
223
+ ```bash
224
+ vslides deploy
225
+ # Output:
226
+ # DEPLOYED: https://slidev-server.vercel.app/static/happy-blue-ocean
227
+ # VERSION: 5
228
+ # DEPLOYED_AT: 2026-01-28T12:00:00.000Z
229
+ ```
230
+
231
+ Benefits:
232
+ - Permanent URL that doesn't expire
233
+ - Fast loading (no sandbox startup)
234
+ - Works even after sandbox times out
235
+ - Can be embedded in docs/wikis
236
+
217
237
  ## Version History
218
238
 
219
239
  #### `vslides history`
package/dist/cli.js CHANGED
@@ -3322,6 +3322,17 @@ async function revokeCLIAuth(token) {
3322
3322
  // Don't clear auth on revoke failure
3323
3323
  });
3324
3324
  }
3325
+ async function deploy(slug, token) {
3326
+ return request(`/api/session/${slug}/deploy`, {
3327
+ method: "POST",
3328
+ headers: {
3329
+ "X-Slug": slug,
3330
+ "X-Session-Token": token,
3331
+ "Content-Type": "application/json"
3332
+ },
3333
+ body: JSON.stringify({})
3334
+ });
3335
+ }
3325
3336
 
3326
3337
  // src/lib/config.ts
3327
3338
  var import_node_fs2 = require("node:fs");
@@ -3471,10 +3482,10 @@ var ExitCode = {
3471
3482
 
3472
3483
  // src/commands/init.ts
3473
3484
  var STARTER_SLIDES = `---
3485
+ theme: ./
3474
3486
  title: My Presentation
3475
- ---
3476
-
3477
- ---
3487
+ footerLogo: wordmark
3488
+ footerTitle: true
3478
3489
  layout: 1-title
3479
3490
  variant: title
3480
3491
  ---
@@ -3510,49 +3521,22 @@ async function init() {
3510
3521
  return;
3511
3522
  }
3512
3523
  const cachedAuth = getCachedAuth();
3513
- if (cachedAuth && isAuthValid(cachedAuth)) {
3514
- const result2 = await createSession({ cliAuthToken: cachedAuth.token });
3515
- if (result2.ok && result2.data.authenticated && result2.data.token) {
3516
- const { slug: slug2, pollSecret: pollSecret2, previewUrl: previewUrl2, token } = result2.data;
3517
- writeConfig({
3518
- slug: slug2,
3519
- pollSecret: pollSecret2,
3520
- previewUrl: previewUrl2,
3521
- token
3522
- });
3523
- try {
3524
- const guideResult = await getGuide();
3525
- if (guideResult.ok && typeof guideResult.data === "string") {
3526
- writeGuide(guideResult.data);
3527
- }
3528
- } catch {
3529
- }
3530
- if (!slidesExist()) {
3531
- writeSlides(STARTER_SLIDES);
3532
- info("Created slides.md with starter template");
3533
- }
3534
- success(`Authenticated as ${cachedAuth.email}`);
3535
- url("PREVIEW_URL", previewUrl2);
3536
- newline();
3537
- info("Sandbox is starting in the background.");
3538
- instructions([
3539
- "Run: vslides check --wait (wait for sandbox to be ready)",
3540
- "Run: vslides push (upload your slides)"
3541
- ]);
3542
- return;
3543
- }
3544
- clearCLIAuth();
3524
+ if (!cachedAuth || !isAuthValid(cachedAuth)) {
3525
+ error("Not authenticated. Run `vslides login` to log in.");
3526
+ process.exit(ExitCode.AuthRequired);
3545
3527
  }
3546
- const result = await createSession();
3547
- if (!result.ok) {
3548
- error(`Failed to create session: ${JSON.stringify(result.data)}`);
3549
- process.exit(ExitCode.NetworkError);
3528
+ const result = await createSession({ cliAuthToken: cachedAuth.token });
3529
+ if (!result.ok || !result.data.authenticated || !result.data.token) {
3530
+ clearCLIAuth();
3531
+ error("Not authenticated. Run `vslides login` to log in.");
3532
+ process.exit(ExitCode.AuthRequired);
3550
3533
  }
3551
- const { slug, pollSecret, verifyUrl, previewUrl } = result.data;
3534
+ const { slug, pollSecret, previewUrl, token } = result.data;
3552
3535
  writeConfig({
3553
3536
  slug,
3554
3537
  pollSecret,
3555
- previewUrl
3538
+ previewUrl,
3539
+ token
3556
3540
  });
3557
3541
  try {
3558
3542
  const guideResult = await getGuide();
@@ -3565,12 +3549,13 @@ async function init() {
3565
3549
  writeSlides(STARTER_SLIDES);
3566
3550
  info("Created slides.md with starter template");
3567
3551
  }
3568
- const authUrlWithCli = `${verifyUrl}?cliAuth=true`;
3569
- url("AUTH_URL", authUrlWithCli);
3552
+ url("SESSION", slug);
3553
+ info("CONFIG: .vslides.json created");
3554
+ url("USER", cachedAuth.email);
3570
3555
  url("PREVIEW_URL", previewUrl);
3571
3556
  instructions([
3572
- "Run in background: vslides check --wait &",
3573
- "Open the AUTH_URL to authenticate"
3557
+ "Run: vslides check --wait (wait for sandbox to be ready)",
3558
+ "Run: vslides push (upload your slides)"
3574
3559
  ]);
3575
3560
  }
3576
3561
 
@@ -3590,7 +3575,7 @@ async function check(options = {}) {
3590
3575
  error(`Failed to check session: ${JSON.stringify(result.data)}`);
3591
3576
  process.exit(ExitCode.NetworkError);
3592
3577
  }
3593
- const { status: sessionStatus, token, cliAuthToken } = result.data;
3578
+ const { status: sessionStatus, token, cliAuthToken, expiresAt } = result.data;
3594
3579
  if (sessionStatus === "running") {
3595
3580
  if (token) {
3596
3581
  updateConfig({ token });
@@ -3606,6 +3591,31 @@ async function check(options = {}) {
3606
3591
  }
3607
3592
  }
3608
3593
  status("running");
3594
+ url("SESSION", slug);
3595
+ const cachedAuth = getCachedAuth();
3596
+ if (cachedAuth?.email) {
3597
+ url("USER", cachedAuth.email);
3598
+ }
3599
+ const sessionToken = token || cfg.token;
3600
+ if (sessionToken) {
3601
+ try {
3602
+ const slidesResult = await getSlides(slug, sessionToken);
3603
+ if (slidesResult.ok && slidesResult.data.version !== void 0) {
3604
+ url("VERSION", String(slidesResult.data.version));
3605
+ }
3606
+ } catch {
3607
+ }
3608
+ }
3609
+ const previewUrl = cfg.previewUrl || `${getBaseUrl()}/slides/${slug}`;
3610
+ url("PREVIEW_URL", previewUrl);
3611
+ if (expiresAt) {
3612
+ const expiresDate = new Date(expiresAt);
3613
+ const now = Date.now();
3614
+ const remainingMs = expiresAt - now;
3615
+ const remainingMins = Math.max(0, Math.floor(remainingMs / 6e4));
3616
+ const dateStr = expiresDate.toISOString().slice(0, 16).replace("T", " ");
3617
+ url("EXPIRES", `${dateStr} (${remainingMins} min remaining)`);
3618
+ }
3609
3619
  process.exit(ExitCode.Success);
3610
3620
  }
3611
3621
  if (!options.wait) {
@@ -3890,10 +3900,16 @@ async function push(options = {}) {
3890
3900
  process.exit(ExitCode.NetworkError);
3891
3901
  }
3892
3902
  const pushResult = result.data;
3903
+ const cfg_updated = readConfig();
3893
3904
  if (pushResult.version !== void 0) {
3894
3905
  updateConfig({ version: pushResult.version });
3895
3906
  }
3896
3907
  success(`Version ${pushResult.version} saved`);
3908
+ if (pushResult.previewUrl) {
3909
+ url("PREVIEW_URL", pushResult.previewUrl);
3910
+ } else if (cfg_updated?.previewUrl) {
3911
+ url("PREVIEW_URL", cfg_updated.previewUrl);
3912
+ }
3897
3913
  }
3898
3914
 
3899
3915
  // src/commands/sync.ts
@@ -3981,6 +3997,11 @@ async function sync() {
3981
3997
  updateConfig({ version: pushResult.version });
3982
3998
  }
3983
3999
  success(`Version ${pushResult.version} saved`);
4000
+ if (pushResult.previewUrl) {
4001
+ url("PREVIEW_URL", pushResult.previewUrl);
4002
+ } else if (cfg.previewUrl) {
4003
+ url("PREVIEW_URL", cfg.previewUrl);
4004
+ }
3984
4005
  }
3985
4006
 
3986
4007
  // src/commands/upload.ts
@@ -4077,6 +4098,21 @@ async function revert(version) {
4077
4098
  info(`REVERTED: Now at version ${newVersion} (content from version ${revertedFrom})`);
4078
4099
  }
4079
4100
 
4101
+ // src/commands/deploy.ts
4102
+ async function deploy2() {
4103
+ const { config: cfg, token } = requireToken();
4104
+ info("Deploying presentation...");
4105
+ const result = await deploy(cfg.slug, token);
4106
+ if (!result.ok) {
4107
+ const errorData = result.data;
4108
+ error(`Deploy failed: ${errorData.message || errorData.error || "Unknown error"}`);
4109
+ process.exit(ExitCode.NetworkError);
4110
+ }
4111
+ info(`DEPLOYED: ${result.data.url}`);
4112
+ info(`VERSION: ${result.data.version}`);
4113
+ info(`DEPLOYED_AT: ${new Date(result.data.deployedAt).toISOString()}`);
4114
+ }
4115
+
4080
4116
  // src/commands/login.ts
4081
4117
  var POLL_INTERVAL2 = 2e3;
4082
4118
  var POLL_TIMEOUT2 = 12e4;
@@ -4207,6 +4243,7 @@ program.command("push").description("Upload slides.md to server").option("--forc
4207
4243
  program.command("sync").description("Smart bidirectional sync").action(wrapCommand(sync));
4208
4244
  program.command("upload <file>").description("Upload an image or media file").action(wrapCommand(upload));
4209
4245
  program.command("export <format>").description("Export presentation to PDF or PPTX").action(wrapCommand(exportSlides2));
4246
+ program.command("deploy").description("Deploy presentation as static site").action(wrapCommand(deploy2));
4210
4247
  program.command("history").description("List saved versions").action(wrapCommand(history));
4211
4248
  program.command("revert <version>").description("Revert to a previous version").action(wrapCommand(revert));
4212
4249
  program.parse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vslides",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "CLI for Vercel Slides API",
5
5
  "license": "MIT",
6
6
  "author": "Vercel",