@editframe/cli 0.51.9 → 0.52.1
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/VERSION.js
CHANGED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { program } from "commander";
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
import { Client, createURLToken } from "@editframe/api";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { cacheImage, findOrCreateCaptions, generateScrubTrack, generateTrack, generateTrackFragmentIndex, md5FilePath } from "@editframe/assets";
|
|
6
|
+
import { createEditframeDevServer, createProdEfHandlers } from "@editframe/dev-server";
|
|
7
|
+
//#region src/commands/dev-server.ts
|
|
8
|
+
program.command("dev-server [directory]").description("Start the Editframe dev media server as a standalone service").option("-p, --port <number>", "Port to listen on", String(3099)).option("--cache-root <path>", "Directory for cached transcoded assets").option("--public-origin <origin>", "Public-facing origin injected into JIT manifests").action(async (directory = ".", options) => {
|
|
9
|
+
const programOpts = program.opts();
|
|
10
|
+
const token = programOpts.token || process.env.EF_TOKEN;
|
|
11
|
+
const efHost = programOpts.efHost || process.env.EF_HOST;
|
|
12
|
+
const baseCwd = process.env.ORIGINAL_CWD || process.cwd();
|
|
13
|
+
const root = path.resolve(baseCwd, directory);
|
|
14
|
+
const cacheRoot = options.cacheRoot ? path.resolve(baseCwd, options.cacheRoot) : path.join(root, ".ef-cache");
|
|
15
|
+
const port = parseInt(options.port, 10);
|
|
16
|
+
const assetFns = {
|
|
17
|
+
generateTrack,
|
|
18
|
+
generateScrubTrack,
|
|
19
|
+
generateTrackFragmentIndex,
|
|
20
|
+
cacheImage,
|
|
21
|
+
findOrCreateCaptions,
|
|
22
|
+
md5FilePath
|
|
23
|
+
};
|
|
24
|
+
const efHandlers = createProdEfHandlers({
|
|
25
|
+
createURLToken,
|
|
26
|
+
getClient: () => {
|
|
27
|
+
if (!token) throw new Error("EF_TOKEN is required for URL signing. Set it via -t or EF_TOKEN env var.");
|
|
28
|
+
return new Client(token, efHost);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
const server = createEditframeDevServer({
|
|
32
|
+
root,
|
|
33
|
+
cacheRoot,
|
|
34
|
+
...options.publicOrigin && { publicOrigin: options.publicOrigin }
|
|
35
|
+
}, assetFns, efHandlers);
|
|
36
|
+
const origin = options.publicOrigin ?? `http://localhost:${port}`;
|
|
37
|
+
server.listen(port, () => {
|
|
38
|
+
process.stdout.write([
|
|
39
|
+
"",
|
|
40
|
+
` ${chalk.green("Editframe dev server")} running at ${chalk.cyan(origin)}`,
|
|
41
|
+
` ${chalk.dim("Root:")} ${root}`,
|
|
42
|
+
` ${chalk.dim("Cache:")} ${cacheRoot}`,
|
|
43
|
+
"",
|
|
44
|
+
` ${chalk.yellow("Note:")} This server runs on its own port, separate from your app.`,
|
|
45
|
+
` Elements won't find it automatically — set ${chalk.cyan("api-host")} so they know where to send`,
|
|
46
|
+
` transcode requests:`,
|
|
47
|
+
"",
|
|
48
|
+
` ${chalk.dim("HTML")}`,
|
|
49
|
+
` <ef-configuration api-host="${origin}">`,
|
|
50
|
+
` <ef-video src="./clip.mp4"></ef-video> ${chalk.dim(`<!-- local file relative to root -->`)}`,
|
|
51
|
+
` <ef-video src="https://example.com/clip.mp4"></ef-video> ${chalk.dim("<!-- remote URL -->")}`,
|
|
52
|
+
` </ef-configuration>`,
|
|
53
|
+
"",
|
|
54
|
+
` ${chalk.dim("React")}`,
|
|
55
|
+
` <Configuration apiHost="${origin}">`,
|
|
56
|
+
` <Video src="./clip.mp4" /> ${chalk.dim("{/* local file relative to root */}")}`,
|
|
57
|
+
` <Video src="https://example.com/clip.mp4" /> ${chalk.dim("{/* remote URL */}")}`,
|
|
58
|
+
` </Configuration>`,
|
|
59
|
+
"",
|
|
60
|
+
` ${chalk.dim("Or inject globally in your app entry:")}`,
|
|
61
|
+
` window.__EDITFRAME__ = { apiHost: "${origin}" };`,
|
|
62
|
+
""
|
|
63
|
+
].join("\n"));
|
|
64
|
+
});
|
|
65
|
+
const shutdown = () => {
|
|
66
|
+
server.close(() => process.exit(0));
|
|
67
|
+
};
|
|
68
|
+
process.on("SIGINT", shutdown);
|
|
69
|
+
process.on("SIGTERM", shutdown);
|
|
70
|
+
});
|
|
71
|
+
//#endregion
|
|
72
|
+
export {};
|
|
73
|
+
|
|
74
|
+
//# sourceMappingURL=dev-server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev-server.js","names":[],"sources":["../../src/commands/dev-server.ts"],"mappings":";;;;;;;AAgBA,QACG,QAAQ,yBAAyB,CACjC,YAAY,+DAA+D,CAC3E,OAAO,uBAAuB,qBAAqB,OALjC,KAKqD,CAAC,CACxE,OAAO,uBAAuB,yCAAyC,CACvE,OAAO,4BAA4B,mDAAmD,CACtF,OAAO,OAAO,YAAY,KAAK,YAAY;CAC1C,MAAM,cAAc,QAAQ,MAAM;CAClC,MAAM,QAA4B,YAAY,SAAS,QAAQ,IAAI;CACnE,MAAM,SAA6B,YAAY,UAAU,QAAQ,IAAI;CAErE,MAAM,UAAU,QAAQ,IAAI,gBAAgB,QAAQ,KAAK;CACzD,MAAM,OAAO,KAAK,QAAQ,SAAS,UAAU;CAC7C,MAAM,YAAY,QAAQ,YACtB,KAAK,QAAQ,SAAS,QAAQ,UAAU,GACxC,KAAK,KAAK,MAAM,YAAY;CAChC,MAAM,OAAO,SAAS,QAAQ,MAAM,GAAG;CAEvC,MAAM,WAAW;EACf;EACA;EACA;EACA;EACA;EACA;EACD;CAED,MAAM,aAAa,qBAAqB;EACtC;EACA,iBAAiB;AACf,OAAI,CAAC,MACH,OAAM,IAAI,MACR,2EACD;AAEH,UAAO,IAAI,OAAO,OAAO,OAAO;;EAEnC,CAAC;CAEF,MAAM,SAAS,yBACb;EACE;EACA;EACA,GAAI,QAAQ,gBAAgB,EAAE,cAAc,QAAQ,cAAc;EACnE,EACD,UACA,WACD;CAED,MAAM,SAAS,QAAQ,gBAAgB,oBAAoB;AAE3D,QAAO,OAAO,YAAY;AACxB,UAAQ,OAAO,MACb;GACE;GACA,KAAK,MAAM,MAAM,uBAAuB,CAAC,cAAc,MAAM,KAAK,OAAO;GACzE,KAAK,MAAM,IAAI,QAAQ,CAAC,MAAM;GAC9B,KAAK,MAAM,IAAI,SAAS,CAAC,KAAK;GAC9B;GACA,KAAK,MAAM,OAAO,QAAQ,CAAC;GAC3B,gDAAgD,MAAM,KAAK,WAAW,CAAC;GACvE;GACA;GACA,KAAK,MAAM,IAAI,OAAO;GACtB,mCAAmC,OAAO;GAC1C,mEAAmE,MAAM,IAAI,uCAAuC;GACpH,mEAAmE,MAAM,IAAI,sBAAsB;GACnG;GACA;GACA,KAAK,MAAM,IAAI,QAAQ;GACvB,+BAA+B,OAAO;GACtC,uDAAuD,MAAM,IAAI,sCAAsC;GACvG,uDAAuD,MAAM,IAAI,qBAAqB;GACtF;GACA;GACA,KAAK,MAAM,IAAI,wCAAwC;GACvD,0CAA0C,OAAO;GACjD;GACD,CAAC,KAAK,KAAK,CACb;GACD;CAEF,MAAM,iBAAiB;AACrB,SAAO,YAAY,QAAQ,KAAK,EAAE,CAAC;;AAGrC,SAAQ,GAAG,UAAU,SAAS;AAC9B,SAAQ,GAAG,WAAW,SAAS;EAC/B"}
|
package/dist/commands/webhook.js
CHANGED
|
@@ -3,7 +3,7 @@ import { Option, program } from "commander";
|
|
|
3
3
|
import chalk from "chalk";
|
|
4
4
|
import debug from "debug";
|
|
5
5
|
import ora from "ora";
|
|
6
|
-
import {
|
|
6
|
+
import { select } from "@inquirer/prompts";
|
|
7
7
|
//#region src/commands/webhook.ts
|
|
8
8
|
const log = debug("ef:cli:auth");
|
|
9
9
|
const topics = [
|
|
@@ -13,20 +13,16 @@ const topics = [
|
|
|
13
13
|
"render.failed",
|
|
14
14
|
"render.completed"
|
|
15
15
|
];
|
|
16
|
-
const
|
|
16
|
+
const testWebhook = async ({ topic }) => {
|
|
17
17
|
return (await getClient().authenticatedFetch("/api/v1/test_webhook", {
|
|
18
18
|
method: "POST",
|
|
19
|
-
body: JSON.stringify({
|
|
20
|
-
webhookURL,
|
|
21
|
-
topic
|
|
22
|
-
})
|
|
19
|
+
body: JSON.stringify({ topic })
|
|
23
20
|
})).json();
|
|
24
21
|
};
|
|
25
|
-
const webhookCommand = program.command("webhook").description("
|
|
22
|
+
const webhookCommand = program.command("webhook").description("Send a test webhook event to the URL configured on your API key").addOption(new Option("-t, --topic <topic>", "Topic").choices(topics)).action(async () => {
|
|
26
23
|
const options = webhookCommand.opts();
|
|
27
24
|
log("Options:", options);
|
|
28
|
-
let {
|
|
29
|
-
if (!webhookURL) webhookURL = await input({ message: "Enter a webhook URL:" });
|
|
25
|
+
let { topic } = options;
|
|
30
26
|
if (!topic) topic = await select({
|
|
31
27
|
message: "Select a topic:",
|
|
32
28
|
choices: topics.map((topic) => ({
|
|
@@ -36,14 +32,11 @@ const webhookCommand = program.command("webhook").description("Test webhook URL
|
|
|
36
32
|
});
|
|
37
33
|
const spinner = ora("Testing...").start();
|
|
38
34
|
try {
|
|
39
|
-
const apiData = await
|
|
40
|
-
|
|
41
|
-
topic
|
|
42
|
-
});
|
|
43
|
-
spinner.succeed("Webhook URL is working! 🎉");
|
|
35
|
+
const apiData = await testWebhook({ topic });
|
|
36
|
+
spinner.succeed("Test webhook dispatched!");
|
|
44
37
|
process.stderr.write(chalk.green(`${apiData.message}\n`));
|
|
45
38
|
} catch (error) {
|
|
46
|
-
spinner.fail("
|
|
39
|
+
spinner.fail("Failed to dispatch test webhook.");
|
|
47
40
|
process.stderr.write(error?.message);
|
|
48
41
|
process.stderr.write("\n");
|
|
49
42
|
log("Error:", error);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhook.js","names":[],"sources":["../../src/commands/webhook.ts"],"mappings":";;;;;;;AAQA,MAAM,MAAM,MAAM,cAAc;AAKhC,MAAM,SAAS;CACb;CACA;CACA;CACA;CACA;CACD;AAED,MAAa,
|
|
1
|
+
{"version":3,"file":"webhook.js","names":[],"sources":["../../src/commands/webhook.ts"],"mappings":";;;;;;;AAQA,MAAM,MAAM,MAAM,cAAc;AAKhC,MAAM,SAAS;CACb;CACA;CACA;CACA;CACA;CACD;AAED,MAAa,cAAc,OAAO,EAAE,YAA+B;AAKjE,SAJiB,MAAM,WAAW,CAAC,mBAAmB,wBAAwB;EAC5E,QAAQ;EACR,MAAM,KAAK,UAAU,EAAE,OAAO,CAAC;EAChC,CAAC,EACc,MAAM;;AAGxB,MAAM,iBAAiB,QACpB,QAAQ,UAAU,CAClB,YAAY,kEAAkE,CAC9E,UAAU,IAAI,OAAO,uBAAuB,QAAQ,CAAC,QAAQ,OAAO,CAAC,CACrE,OAAO,YAAY;CAClB,MAAM,UAAU,eAAe,MAAM;AACrC,KAAI,YAAY,QAAQ;CACxB,IAAI,EAAE,UAAU;AAEhB,KAAI,CAAC,MAKH,SAJe,MAAM,OAAO;EAC1B,SAAS;EACT,SAAS,OAAO,KAAK,WAAW;GAAE,OAAO;GAAO,OAAO;GAAO,EAAE;EACjE,CAAC;CAIJ,MAAM,UAAU,IAAI,aAAa,CAAC,OAAO;AACzC,KAAI;EACF,MAAM,UAAU,MAAM,YAAY,EAAE,OAAO,CAAC;AAC5C,UAAQ,QAAQ,2BAA2B;AAC3C,UAAQ,OAAO,MAAM,MAAM,MAAM,GAAG,QAAQ,QAAQ,IAAI,CAAC;UAClD,OAAY;AACnB,UAAQ,KAAK,mCAAmC;AAChD,UAAQ,OAAO,MAAM,OAAO,QAAQ;AACpC,UAAQ,OAAO,MAAM,KAAK;AAC1B,MAAI,UAAU,MAAM;;EAEtB"}
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import { VERSION } from "./VERSION.js";
|
|
|
3
3
|
import "./commands/auth.js";
|
|
4
4
|
import "./commands/sync.js";
|
|
5
5
|
import "./commands/cloud-render.js";
|
|
6
|
+
import "./commands/dev-server.js";
|
|
6
7
|
import "./commands/render.js";
|
|
7
8
|
import "./commands/preview.js";
|
|
8
9
|
import "./commands/process.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;;;;;;;;;;AAMA,QACG,KAAK,YAAY,CACjB,UAAU,IAAI,OAAO,uBAAuB,YAAY,CAAC,IAAI,WAAW,CAAC,CACzE,UACC,IAAI,OAAO,oBAAoB,iBAAiB,CAC7C,IAAI,UAAU,CACd,QAAQ,wBAAwB,CACpC,CACA,UACC,IAAI,OAAO,2BAA2B,wBAAwB,CAC3D,IAAI,iBAAiB,CACrB,QAAQ,wBAAwB,CACpC,CACA,QAAQ,QAAQ;AAcnB,QAAQ,MAAM,QAAQ,KAAK"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@editframe/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.52.1",
|
|
4
4
|
"description": "Command line interface for EditFrame",
|
|
5
5
|
"bin": {
|
|
6
6
|
"editframe": "./dist/index.js"
|
|
@@ -22,10 +22,11 @@
|
|
|
22
22
|
"typescript": "^5.9.3"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@editframe/api": "0.
|
|
26
|
-
"@editframe/assets": "0.
|
|
27
|
-
"@editframe/
|
|
28
|
-
"@editframe/
|
|
25
|
+
"@editframe/api": "0.52.1",
|
|
26
|
+
"@editframe/assets": "0.52.1",
|
|
27
|
+
"@editframe/dev-server": "0.52.1",
|
|
28
|
+
"@editframe/elements": "0.52.1",
|
|
29
|
+
"@editframe/vite-plugin": "0.52.1",
|
|
29
30
|
"@inquirer/prompts": "^7.0.0",
|
|
30
31
|
"chalk": "^5.3.0",
|
|
31
32
|
"commander": "^12.0.0",
|