vslides 1.0.7 → 1.0.9

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 +161 -0
  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,34 @@ 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
+ }
3336
+ async function getPresentations(cliAuthToken) {
3337
+ return request("/api/presentations", {
3338
+ headers: {
3339
+ "X-CLI-Auth-Token": cliAuthToken
3340
+ }
3341
+ });
3342
+ }
3343
+ async function reconnectSession(slug, cliAuthToken) {
3344
+ return request(`/api/session/${slug}/reconnect`, {
3345
+ method: "POST",
3346
+ headers: {
3347
+ "X-CLI-Auth-Token": cliAuthToken,
3348
+ "Content-Type": "application/json"
3349
+ },
3350
+ body: JSON.stringify({})
3351
+ });
3352
+ }
3325
3353
 
3326
3354
  // src/lib/config.ts
3327
3355
  var import_node_fs2 = require("node:fs");
@@ -3343,6 +3371,9 @@ function getSlidesPath() {
3343
3371
  function getUpstreamPath() {
3344
3372
  return (0, import_node_path2.join)(process.cwd(), UPSTREAM_FILE);
3345
3373
  }
3374
+ function configExists() {
3375
+ return (0, import_node_fs2.existsSync)(getConfigPath());
3376
+ }
3346
3377
  function readConfig() {
3347
3378
  const path = getConfigPath();
3348
3379
  if (!(0, import_node_fs2.existsSync)(path)) {
@@ -3669,6 +3700,118 @@ async function share() {
3669
3700
  info("4. Run: vslides get");
3670
3701
  }
3671
3702
 
3703
+ // src/commands/list.ts
3704
+ async function list() {
3705
+ const auth = getCachedAuth();
3706
+ if (!auth) {
3707
+ error("Not logged in");
3708
+ instructions(["Run `vslides login` to authenticate"]);
3709
+ process.exit(ExitCode.AuthRequired);
3710
+ }
3711
+ if (!isAuthValid(auth)) {
3712
+ error("Login expired");
3713
+ instructions(["Run `vslides login` to re-authenticate"]);
3714
+ process.exit(ExitCode.AuthRequired);
3715
+ }
3716
+ const result = await getPresentations(auth.token);
3717
+ if (!result.ok) {
3718
+ if (result.status === 401) {
3719
+ error("Authentication failed");
3720
+ instructions(["Run `vslides login` to re-authenticate"]);
3721
+ process.exit(ExitCode.AuthRequired);
3722
+ }
3723
+ error(`Failed to fetch presentations: ${JSON.stringify(result.data)}`);
3724
+ process.exit(ExitCode.NetworkError);
3725
+ }
3726
+ const { presentations } = result.data;
3727
+ if (presentations.length === 0) {
3728
+ info("No presentations found");
3729
+ instructions(["Run `vslides init` to create a new presentation"]);
3730
+ return;
3731
+ }
3732
+ const formatDate = (timestamp) => {
3733
+ const date = new Date(timestamp);
3734
+ return date.toLocaleDateString("en-US", {
3735
+ month: "short",
3736
+ day: "numeric",
3737
+ year: "numeric"
3738
+ });
3739
+ };
3740
+ const baseUrl = getBaseUrl();
3741
+ const headers = ["TITLE", "SLUG", "CREATED", "PREVIEW"];
3742
+ const rows = presentations.map((p) => [
3743
+ p.title.length > 30 ? p.title.substring(0, 27) + "..." : p.title,
3744
+ p.slug,
3745
+ formatDate(p.createdAt),
3746
+ `${baseUrl}${p.url}`
3747
+ ]);
3748
+ table(headers, rows);
3749
+ }
3750
+
3751
+ // src/commands/clone.ts
3752
+ async function clone(slug) {
3753
+ if (configExists()) {
3754
+ error("This directory already has a .vslides.json file");
3755
+ instructions([
3756
+ "Remove .vslides.json to clone a different presentation",
3757
+ "Or use a different directory"
3758
+ ]);
3759
+ process.exit(ExitCode.ValidationError);
3760
+ }
3761
+ const auth = getCachedAuth();
3762
+ if (!auth) {
3763
+ error("Not logged in");
3764
+ instructions(["Run `vslides login` to authenticate"]);
3765
+ process.exit(ExitCode.AuthRequired);
3766
+ }
3767
+ if (!isAuthValid(auth)) {
3768
+ error("Login expired");
3769
+ instructions(["Run `vslides login` to re-authenticate"]);
3770
+ process.exit(ExitCode.AuthRequired);
3771
+ }
3772
+ const result = await reconnectSession(slug, auth.token);
3773
+ if (!result.ok) {
3774
+ if (result.status === 401) {
3775
+ error("Authentication failed");
3776
+ instructions(["Run `vslides login` to re-authenticate"]);
3777
+ process.exit(ExitCode.AuthRequired);
3778
+ }
3779
+ if (result.status === 403) {
3780
+ error("You do not own this presentation");
3781
+ instructions(["You can only clone your own presentations"]);
3782
+ process.exit(ExitCode.AuthRequired);
3783
+ }
3784
+ if (result.status === 404) {
3785
+ error(`Presentation not found: ${slug}`);
3786
+ instructions(["Run `vslides list` to see your presentations"]);
3787
+ process.exit(ExitCode.ValidationError);
3788
+ }
3789
+ error(`Failed to reconnect: ${JSON.stringify(result.data)}`);
3790
+ process.exit(ExitCode.NetworkError);
3791
+ }
3792
+ const { pollSecret, token, previewUrl } = result.data;
3793
+ const baseUrl = getBaseUrl();
3794
+ writeConfig({
3795
+ slug,
3796
+ pollSecret,
3797
+ token,
3798
+ previewUrl: `${baseUrl}${previewUrl}`
3799
+ });
3800
+ const slidesResult = await getSlides(slug, token);
3801
+ if (slidesResult.ok) {
3802
+ const { markdown, version } = slidesResult.data;
3803
+ writeSlides(markdown);
3804
+ updateConfig({ version });
3805
+ success(`Cloned presentation: ${slug}`);
3806
+ info(`Downloaded slides.md (version ${version})`);
3807
+ } else {
3808
+ success(`Cloned presentation: ${slug}`);
3809
+ info("Session is not running - slides.md not downloaded");
3810
+ instructions(["Run `vslides check --wait` to start the session", "Then run `vslides get` to download slides"]);
3811
+ }
3812
+ url("PREVIEW_URL", `${baseUrl}${previewUrl}`);
3813
+ }
3814
+
3672
3815
  // src/commands/preview.ts
3673
3816
  var import_node_child_process = require("node:child_process");
3674
3817
  async function preview(options = {}) {
@@ -4087,6 +4230,21 @@ async function revert(version) {
4087
4230
  info(`REVERTED: Now at version ${newVersion} (content from version ${revertedFrom})`);
4088
4231
  }
4089
4232
 
4233
+ // src/commands/deploy.ts
4234
+ async function deploy2() {
4235
+ const { config: cfg, token } = requireToken();
4236
+ info("Deploying presentation...");
4237
+ const result = await deploy(cfg.slug, token);
4238
+ if (!result.ok) {
4239
+ const errorData = result.data;
4240
+ error(`Deploy failed: ${errorData.message || errorData.error || "Unknown error"}`);
4241
+ process.exit(ExitCode.NetworkError);
4242
+ }
4243
+ info(`DEPLOYED: ${result.data.url}`);
4244
+ info(`VERSION: ${result.data.version}`);
4245
+ info(`DEPLOYED_AT: ${new Date(result.data.deployedAt).toISOString()}`);
4246
+ }
4247
+
4090
4248
  // src/commands/login.ts
4091
4249
  var POLL_INTERVAL2 = 2e3;
4092
4250
  var POLL_TIMEOUT2 = 12e4;
@@ -4210,6 +4368,8 @@ program.command("init").description("Create a new session").action(wrapCommand(i
4210
4368
  program.command("check").description("Check session status").option("--wait", "Poll until running (60s timeout)").action(wrapCommand((options) => check(options)));
4211
4369
  program.command("join <url>").description("Join a shared session").action(wrapCommand(join3));
4212
4370
  program.command("share").description("Get join URL for collaborators").action(wrapCommand(share));
4371
+ program.command("list").description("List all your presentations").action(wrapCommand(list));
4372
+ program.command("clone <slug>").description("Set up an existing presentation in current directory").action(wrapCommand(clone));
4213
4373
  program.command("preview").description("Print or open the preview URL").option("--open", "Open in browser").action(wrapCommand((options) => preview(options)));
4214
4374
  program.command("guide").description("Print the slide layout guide").option("--refresh", "Force fresh fetch").action(wrapCommand((options) => guide(options)));
4215
4375
  program.command("get").description("Download current slides from server").action(wrapCommand(get));
@@ -4217,6 +4377,7 @@ program.command("push").description("Upload slides.md to server").option("--forc
4217
4377
  program.command("sync").description("Smart bidirectional sync").action(wrapCommand(sync));
4218
4378
  program.command("upload <file>").description("Upload an image or media file").action(wrapCommand(upload));
4219
4379
  program.command("export <format>").description("Export presentation to PDF or PPTX").action(wrapCommand(exportSlides2));
4380
+ program.command("deploy").description("Deploy presentation as static site").action(wrapCommand(deploy2));
4220
4381
  program.command("history").description("List saved versions").action(wrapCommand(history));
4221
4382
  program.command("revert <version>").description("Revert to a previous version").action(wrapCommand(revert));
4222
4383
  program.parse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vslides",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "CLI for Vercel Slides API",
5
5
  "license": "MIT",
6
6
  "author": "Vercel",