@opul/cli 0.1.3 → 0.1.4

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 (2) hide show
  1. package/dist/index.js +18 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1249,6 +1249,9 @@ async function demoCommand(opts) {
1249
1249
  console.log(` ${rel(result.posterPath)}`);
1250
1250
  console.log(`
1251
1251
  next: ${ink.bold(`opul publish ${rel(result.videoPath)}`)}`);
1252
+ console.log(
1253
+ ` ${ink.dim("\u21B3 turns it into a shareable link. needs a free account \u2014 run")} ${ink.bold("opul login")} ${ink.dim("first.")}`
1254
+ );
1252
1255
  } catch (e) {
1253
1256
  progress.stop();
1254
1257
  if (e instanceof ChromeNotFoundError) fail(e.message);
@@ -1374,9 +1377,11 @@ async function publishCommand(file2, opts) {
1374
1377
  body: JSON.stringify({ title, hasPoster: !!poster, byteSize: size })
1375
1378
  }).catch(() => null);
1376
1379
  if (!presign || !presign.ok) {
1377
- return fail3(
1378
- presign ? `publish failed (${presign.status}): ${await presign.text()}` : "could not reach opul.dev \u2014 check your connection."
1379
- );
1380
+ if (!presign) return fail3("could not reach opul.dev \u2014 check your connection.");
1381
+ const body = await parseError(presign);
1382
+ const hint = presign.status === 403 ? `
1383
+ ${ink.dim("\u21B3 upgrade or manage your plan:")} ${ink.bold(`${base}/account/billing`)}` : "";
1384
+ return fail3(`publish failed (${presign.status}): ${body}${hint}`);
1380
1385
  }
1381
1386
  const { id, slug, uploadUrl, posterUploadUrl } = await presign.json();
1382
1387
  process.stderr.write(ink.dim(`uploading ${fmtSize(size)}\u2026`));
@@ -1407,6 +1412,15 @@ async function publishCommand(file2, opts) {
1407
1412
  console.log(`${ink.green("\u2713")} published`);
1408
1413
  console.log(` ${ink.bold(`${base}/d/${slug}`)}`);
1409
1414
  }
1415
+ async function parseError(res) {
1416
+ const text = await res.text().catch(() => "");
1417
+ try {
1418
+ const j = JSON.parse(text);
1419
+ if (j && typeof j.error === "string") return j.error;
1420
+ } catch {
1421
+ }
1422
+ return text || res.statusText;
1423
+ }
1410
1424
  function fail3(msg) {
1411
1425
  console.error(`${ink.red("\u2717")} ${msg}`);
1412
1426
  process.exit(1);
@@ -1467,7 +1481,7 @@ function fail4(msg) {
1467
1481
 
1468
1482
  // src/index.ts
1469
1483
  var program = new Command();
1470
- program.name("opul").description("Record a product demo from your running web app.").version("0.1.3");
1484
+ program.name("opul").description("Record a product demo from your running web app.").version("0.1.4");
1471
1485
  program.command("init").description("Create an opul.steps.json stub").option("--out <file>", "output path", "opul.steps.json").action(initCommand);
1472
1486
  program.command("doctor").description("Check that Chrome and ffmpeg are installed").action(doctorCommand);
1473
1487
  program.command("record").description("Click through your app to generate a steps file").option("--url <url>", "app URL to open").option("--out <file>", "steps file to write", "opul.steps.json").option("--name <name>", "product/demo name").option("--chrome <path>", "path to Chrome executable").action(recordCommand);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opul/cli",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Record a polished product-demo video from your running web app — from the terminal.",
5
5
  "type": "module",
6
6
  "bin": {