@opul/cli 0.1.3 → 0.1.5
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/index.js +23 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -274,6 +274,9 @@ function overlayInitSource() {
|
|
|
274
274
|
}
|
|
275
275
|
function build() {
|
|
276
276
|
ensureFont();
|
|
277
|
+
const stale = document.getElementById("__opul_root");
|
|
278
|
+
if (stale)
|
|
279
|
+
stale.remove();
|
|
277
280
|
root = document.createElement("div");
|
|
278
281
|
root.id = "__opul_root";
|
|
279
282
|
root.style.cssText = "position:fixed;inset:0;z-index:2147483647;pointer-events:none;font-family:'Plus Jakarta Sans',system-ui,sans-serif;";
|
|
@@ -293,11 +296,11 @@ function overlayInitSource() {
|
|
|
293
296
|
function ready() {
|
|
294
297
|
return new Promise((res) => {
|
|
295
298
|
if (document.body) {
|
|
296
|
-
|
|
299
|
+
ensure();
|
|
297
300
|
res();
|
|
298
301
|
} else {
|
|
299
302
|
document.addEventListener("DOMContentLoaded", () => {
|
|
300
|
-
|
|
303
|
+
ensure();
|
|
301
304
|
res();
|
|
302
305
|
});
|
|
303
306
|
}
|
|
@@ -1249,6 +1252,9 @@ async function demoCommand(opts) {
|
|
|
1249
1252
|
console.log(` ${rel(result.posterPath)}`);
|
|
1250
1253
|
console.log(`
|
|
1251
1254
|
next: ${ink.bold(`opul publish ${rel(result.videoPath)}`)}`);
|
|
1255
|
+
console.log(
|
|
1256
|
+
` ${ink.dim("\u21B3 turns it into a shareable link. needs a free account \u2014 run")} ${ink.bold("opul login")} ${ink.dim("first.")}`
|
|
1257
|
+
);
|
|
1252
1258
|
} catch (e) {
|
|
1253
1259
|
progress.stop();
|
|
1254
1260
|
if (e instanceof ChromeNotFoundError) fail(e.message);
|
|
@@ -1374,9 +1380,11 @@ async function publishCommand(file2, opts) {
|
|
|
1374
1380
|
body: JSON.stringify({ title, hasPoster: !!poster, byteSize: size })
|
|
1375
1381
|
}).catch(() => null);
|
|
1376
1382
|
if (!presign || !presign.ok) {
|
|
1377
|
-
return fail3(
|
|
1378
|
-
|
|
1379
|
-
|
|
1383
|
+
if (!presign) return fail3("could not reach opul.dev \u2014 check your connection.");
|
|
1384
|
+
const body = await parseError(presign);
|
|
1385
|
+
const hint = presign.status === 403 ? `
|
|
1386
|
+
${ink.dim("\u21B3 upgrade or manage your plan:")} ${ink.bold(`${base}/account/billing`)}` : "";
|
|
1387
|
+
return fail3(`publish failed (${presign.status}): ${body}${hint}`);
|
|
1380
1388
|
}
|
|
1381
1389
|
const { id, slug, uploadUrl, posterUploadUrl } = await presign.json();
|
|
1382
1390
|
process.stderr.write(ink.dim(`uploading ${fmtSize(size)}\u2026`));
|
|
@@ -1407,6 +1415,15 @@ async function publishCommand(file2, opts) {
|
|
|
1407
1415
|
console.log(`${ink.green("\u2713")} published`);
|
|
1408
1416
|
console.log(` ${ink.bold(`${base}/d/${slug}`)}`);
|
|
1409
1417
|
}
|
|
1418
|
+
async function parseError(res) {
|
|
1419
|
+
const text = await res.text().catch(() => "");
|
|
1420
|
+
try {
|
|
1421
|
+
const j = JSON.parse(text);
|
|
1422
|
+
if (j && typeof j.error === "string") return j.error;
|
|
1423
|
+
} catch {
|
|
1424
|
+
}
|
|
1425
|
+
return text || res.statusText;
|
|
1426
|
+
}
|
|
1410
1427
|
function fail3(msg) {
|
|
1411
1428
|
console.error(`${ink.red("\u2717")} ${msg}`);
|
|
1412
1429
|
process.exit(1);
|
|
@@ -1467,7 +1484,7 @@ function fail4(msg) {
|
|
|
1467
1484
|
|
|
1468
1485
|
// src/index.ts
|
|
1469
1486
|
var program = new Command();
|
|
1470
|
-
program.name("opul").description("Record a product demo from your running web app.").version("0.1.
|
|
1487
|
+
program.name("opul").description("Record a product demo from your running web app.").version("0.1.5");
|
|
1471
1488
|
program.command("init").description("Create an opul.steps.json stub").option("--out <file>", "output path", "opul.steps.json").action(initCommand);
|
|
1472
1489
|
program.command("doctor").description("Check that Chrome and ffmpeg are installed").action(doctorCommand);
|
|
1473
1490
|
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);
|