@editframe/cli 0.16.8-beta.0 → 0.17.6-beta.0

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 (36) hide show
  1. package/dist/VERSION.d.ts +1 -1
  2. package/dist/VERSION.js +2 -4
  3. package/dist/commands/auth.js +16 -25
  4. package/dist/commands/check.js +81 -108
  5. package/dist/commands/mux.d.ts +1 -0
  6. package/dist/commands/preview.js +4 -1
  7. package/dist/commands/process-file.js +18 -34
  8. package/dist/commands/process.js +28 -31
  9. package/dist/commands/render.js +117 -157
  10. package/dist/commands/sync.js +3 -5
  11. package/dist/commands/webhook.js +48 -52
  12. package/dist/index.js +3 -7
  13. package/dist/operations/processRenderInfo.js +25 -31
  14. package/dist/operations/syncAssetsDirectory/SubAssetSync.js +11 -18
  15. package/dist/operations/syncAssetsDirectory/SyncCaption.js +46 -73
  16. package/dist/operations/syncAssetsDirectory/SyncFragmentIndex.js +53 -83
  17. package/dist/operations/syncAssetsDirectory/SyncImage.js +72 -99
  18. package/dist/operations/syncAssetsDirectory/SyncStatus.js +30 -37
  19. package/dist/operations/syncAssetsDirectory/SyncTrack.js +107 -143
  20. package/dist/operations/syncAssetsDirectory/doAssetSync.js +42 -46
  21. package/dist/operations/syncAssetsDirectory.js +55 -78
  22. package/dist/utils/createReadableStreamFromReadable.js +61 -78
  23. package/dist/utils/index.js +10 -16
  24. package/dist/utils/launchBrowserAndWaitForSDK.js +31 -43
  25. package/dist/utils/startDevServer.d.ts +1 -1
  26. package/dist/utils/startPreviewServer.d.ts +1 -1
  27. package/dist/utils/startPreviewServer.js +28 -34
  28. package/dist/utils/validateVideoResolution.js +19 -23
  29. package/dist/utils/withSpinner.js +10 -12
  30. package/package.json +8 -8
  31. package/src/commands/check.ts +2 -2
  32. package/src/commands/mux.ts +10 -0
  33. package/src/utils/createReadableStreamFromReadable.ts +3 -7
  34. package/src/utils/startDevServer.ts +5 -5
  35. package/src/utils/startPreviewServer.ts +1 -1
  36. package/test-fixtures/network.ts +38 -9
package/dist/VERSION.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "0.16.8-beta.0";
1
+ export declare const VERSION = "0.17.6-beta.0";
package/dist/VERSION.js CHANGED
@@ -1,4 +1,2 @@
1
- const VERSION = "0.16.8-beta.0";
2
- export {
3
- VERSION
4
- };
1
+ const VERSION = "0.17.6-beta.0";
2
+ export { VERSION };
@@ -1,33 +1,24 @@
1
- import chalk from "chalk";
1
+ import { getClient } from "../utils/index.js";
2
2
  import { program } from "commander";
3
+ import chalk from "chalk";
3
4
  import debug from "debug";
4
5
  import ora from "ora";
5
- import { getClient } from "../utils/index.js";
6
6
  const log = debug("ef:cli:auth");
7
7
  const getApiData = async () => {
8
- const response = await getClient().authenticatedFetch("/api/v1/organization");
9
- return response.json();
8
+ const response = await getClient().authenticatedFetch("/api/v1/organization");
9
+ return response.json();
10
10
  };
11
11
  const authCommand = program.command("auth").description("Fetch organization data using API token").action(async () => {
12
- const options = authCommand.opts();
13
- log("Options:", options);
14
- const spinner = ora("Loading...").start();
15
- try {
16
- const apiData = await getApiData();
17
- spinner.succeed("You are authenticated! 🎉");
18
- process.stderr.write(
19
- chalk.green(`You're using ${apiData.apiKeyName} API key 🚀
20
- `)
21
- );
22
- process.stderr.write(
23
- chalk.blue(`Welcome to ${apiData.displayName} organization 🎉
24
- `)
25
- );
26
- } catch (error) {
27
- spinner.fail("Authentication failed!");
28
- log("Error:", error);
29
- }
12
+ const options = authCommand.opts();
13
+ log("Options:", options);
14
+ const spinner = ora("Loading...").start();
15
+ try {
16
+ const apiData = await getApiData();
17
+ spinner.succeed("You are authenticated! 🎉");
18
+ process.stderr.write(chalk.green(`You're using ${apiData.apiKeyName} API key 🚀\n`));
19
+ process.stderr.write(chalk.blue(`Welcome to ${apiData.displayName} organization 🎉\n`));
20
+ } catch (error) {
21
+ spinner.fail("Authentication failed!");
22
+ log("Error:", error);
23
+ }
30
24
  });
31
- export {
32
- getApiData
33
- };
@@ -1,114 +1,87 @@
1
- import { exec } from "node:child_process";
2
- import os from "node:os";
3
1
  import { program } from "commander";
4
- import ora from "ora";
5
2
  import chalk from "chalk";
3
+ import ora from "ora";
4
+ import { exec } from "node:child_process";
5
+ import os from "node:os";
6
6
  const checks = {
7
- ffmpeg: {
8
- message: () => {
9
- const platform = os.platform();
10
- const message = [
11
- "Processing assets for <ef-video>, <ef-audio>, <ef-captions>, and <ef-waveform>\n elements requires ffmpeg to be installed."
12
- ];
13
- switch (platform) {
14
- case "darwin": {
15
- message.push(
16
- "On platform=darwin you can install ffmpeg using Homebrew:"
17
- );
18
- message.push(" - brew install ffmpeg");
19
- message.push(
20
- "Or you can download ffmpeg from https://ffmpeg.org/download.html"
21
- );
22
- break;
23
- }
24
- case "linux": {
25
- message.push(
26
- "You can install ffmpeg using your distribution's package manager."
27
- );
28
- break;
29
- }
30
- case "win32": {
31
- message.push(
32
- "You can download ffmpeg from https://ffmpeg.org/download.html"
33
- );
34
- message.push(
35
- "You can use package managers like Chocolatey or Scoop to install ffmpeg."
36
- );
37
- message.push(" - choco install ffmpeg-full");
38
- message.push(" - scoop install ffmpeg");
39
- message.push(" - winget install ffmpeg");
40
- break;
41
- }
42
- default: {
43
- message.push(`Unrecognized platform ${platform}`);
44
- message.push(
45
- "You can download ffmpeg from https://ffmpeg.org/download.html"
46
- );
47
- message.push(
48
- "Or try installing it from your operating system's package manager"
49
- );
50
- break;
51
- }
52
- }
53
- return message;
54
- },
55
- check: async () => {
56
- return new Promise((resolve, reject) => {
57
- exec("ffmpeg -version", (error, stdout, _stderr) => {
58
- if (error) {
59
- reject(error);
60
- return;
61
- }
62
- resolve(stdout);
63
- });
64
- });
65
- }
66
- },
67
- whisper_timestamped: {
68
- message: () => {
69
- const message = [
70
- "<ef-captions> Requires whisper_timestamped to be installed."
71
- ];
72
- message.push("whisper_timestamped depends on python3");
73
- message.push(" - pip3 install whisper_timestamped");
74
- message.push("Alternate installation instructions are availble at:");
75
- message.push(
76
- "https://github.com/linto-ai/whisper-timestamped#installation"
77
- );
78
- return message;
79
- },
80
- check: async () => {
81
- return new Promise((resolve, reject) => {
82
- exec(
83
- "whisper_timestamped --version",
84
- (error, stdout, _stderr) => {
85
- if (error) {
86
- reject(error);
87
- return;
88
- }
89
- resolve(stdout);
90
- }
91
- );
92
- });
93
- }
94
- }
7
+ ffmpeg: {
8
+ message: () => {
9
+ const platform = os.platform();
10
+ const message = ["Processing assets for <ef-video>, <ef-audio>, <ef-captions>, and <ef-waveform>\n elements requires ffmpeg to be installed."];
11
+ switch (platform) {
12
+ case "darwin": {
13
+ message.push("On platform=darwin you can install ffmpeg using Homebrew:");
14
+ message.push(" - brew install ffmpeg");
15
+ message.push("Or you can download ffmpeg from https://ffmpeg.org/download.html");
16
+ break;
17
+ }
18
+ case "linux": {
19
+ message.push("You can install ffmpeg using your distribution's package manager.");
20
+ break;
21
+ }
22
+ case "win32": {
23
+ message.push("You can download ffmpeg from https://ffmpeg.org/download.html");
24
+ message.push("You can use package managers like Chocolatey or Scoop to install ffmpeg.");
25
+ message.push(" - choco install ffmpeg-full");
26
+ message.push(" - scoop install ffmpeg");
27
+ message.push(" - winget install ffmpeg");
28
+ break;
29
+ }
30
+ default: {
31
+ message.push(`Unrecognized platform ${platform}`);
32
+ message.push("You can download ffmpeg from https://ffmpeg.org/download.html");
33
+ message.push("Or try installing it from your operating system's package manager");
34
+ break;
35
+ }
36
+ }
37
+ return message;
38
+ },
39
+ check: async () => {
40
+ return new Promise((resolve, reject) => {
41
+ exec("ffmpeg -version", (error, stdout, _stderr) => {
42
+ if (error) {
43
+ reject(error);
44
+ return;
45
+ }
46
+ resolve(stdout);
47
+ });
48
+ });
49
+ }
50
+ },
51
+ whisper_timestamped: {
52
+ message: () => {
53
+ const message = ["<ef-captions> Requires whisper_timestamped to be installed."];
54
+ message.push("whisper_timestamped depends on python3");
55
+ message.push(" - pip3 install whisper_timestamped");
56
+ message.push("Alternate installation instructions are availble at:");
57
+ message.push("https://github.com/linto-ai/whisper-timestamped#installation");
58
+ return message;
59
+ },
60
+ check: async () => {
61
+ return new Promise((resolve, reject) => {
62
+ exec("whisper_timestamped --version", (error, stdout, _stderr) => {
63
+ if (error) {
64
+ reject(error);
65
+ return;
66
+ }
67
+ resolve(stdout);
68
+ });
69
+ });
70
+ }
71
+ }
95
72
  };
96
73
  program.command("check").description("Check on dependencies and other requirements").action(async () => {
97
- for (const checkName in checks) {
98
- const check = checks[checkName];
99
- if (!check) {
100
- continue;
101
- }
102
- const spinner = ora(`Checking ${checkName}`).start();
103
- try {
104
- await check.check();
105
- spinner.succeed(
106
- chalk.white.bgGreen(` Check for ${checkName} passed `)
107
- );
108
- } catch (error) {
109
- spinner.fail(chalk.white.bgRed(` Check for ${checkName} failed `));
110
- process.stderr.write(chalk.red(check.message().join("\n\n")));
111
- process.stderr.write("\n");
112
- }
113
- }
74
+ for (const checkName in checks) {
75
+ const check = checks[checkName];
76
+ if (!check) continue;
77
+ const spinner = ora(`Checking ${checkName}`).start();
78
+ try {
79
+ await check.check();
80
+ spinner.succeed(chalk.white.bgGreen(` Check for ${checkName} passed `));
81
+ } catch (_error) {
82
+ spinner.fail(chalk.white.bgRed(` Check for ${checkName} failed `));
83
+ process.stderr.write(chalk.red(check.message().join("\n\n")));
84
+ process.stderr.write("\n");
85
+ }
86
+ }
114
87
  });
@@ -0,0 +1 @@
1
+ export {};
@@ -1,5 +1,8 @@
1
1
  import { program } from "commander";
2
2
  import { spawn } from "node:child_process";
3
3
  program.command("preview [directory]").description("Preview a directory's index.html file").action(async (projectDirectory = ".") => {
4
- spawn("npx", ["vite", "dev"], { cwd: projectDirectory, stdio: "inherit" });
4
+ spawn("npx", ["vite", "dev"], {
5
+ cwd: projectDirectory,
6
+ stdio: "inherit"
7
+ });
5
8
  });
@@ -1,38 +1,22 @@
1
- import { program } from "commander";
1
+ import { getClient } from "../utils/index.js";
2
2
  import { withSpinner } from "../utils/withSpinner.js";
3
- import { createUnprocessedFileFromPath, uploadUnprocessedFile, processIsobmffFile, getIsobmffProcessProgress, getIsobmffProcessInfo } from "@editframe/api/node";
3
+ import { program } from "commander";
4
4
  import ora from "ora";
5
- import { getClient } from "../utils/index.js";
5
+ import { createUnprocessedFileFromPath, getIsobmffProcessInfo, getIsobmffProcessProgress, processIsobmffFile, uploadUnprocessedFile } from "@editframe/api/node";
6
6
  program.command("process-file <file>").description("Upload a audio/video to Editframe for processing.").action(async (path) => {
7
- const client = getClient();
8
- const unprocessedFile = await withSpinner(
9
- "Creating unprocessed file record",
10
- () => createUnprocessedFileFromPath(client, path)
11
- );
12
- const upload = await uploadUnprocessedFile(client, unprocessedFile, path);
13
- const uploadSpinner = ora("Uploading file");
14
- for await (const event of upload) {
15
- uploadSpinner.text = `Uploading file: ${(100 * event.progress).toFixed(2)}%`;
16
- }
17
- uploadSpinner.succeed("Upload complete");
18
- const processorRecord = await withSpinner(
19
- "Marking for processing",
20
- async () => await processIsobmffFile(client, unprocessedFile.id)
21
- );
22
- const processSpinner = ora("Waiting for processing to complete");
23
- processSpinner.start();
24
- const progress = await getIsobmffProcessProgress(
25
- client,
26
- processorRecord.id
27
- );
28
- for await (const event of progress) {
29
- if (event.type === "progress") {
30
- processSpinner.text = `Processing: ${(100 * event.data.progress).toFixed(2)}%`;
31
- } else if (event.type === "complete") {
32
- processSpinner.succeed("Processing complete");
33
- }
34
- }
35
- const info = await getIsobmffProcessInfo(client, processorRecord.id);
36
- console.log("Processed file info");
37
- console.log(info);
7
+ const client = getClient();
8
+ const unprocessedFile = await withSpinner("Creating unprocessed file record", () => createUnprocessedFileFromPath(client, path));
9
+ const upload = await uploadUnprocessedFile(client, unprocessedFile, path);
10
+ const uploadSpinner = ora("Uploading file");
11
+ for await (const event of upload) uploadSpinner.text = `Uploading file: ${(100 * event.progress).toFixed(2)}%`;
12
+ uploadSpinner.succeed("Upload complete");
13
+ const processorRecord = await withSpinner("Marking for processing", async () => await processIsobmffFile(client, unprocessedFile.id));
14
+ const processSpinner = ora("Waiting for processing to complete");
15
+ processSpinner.start();
16
+ const progress = await getIsobmffProcessProgress(client, processorRecord.id);
17
+ for await (const event of progress) if (event.type === "progress") processSpinner.text = `Processing: ${(100 * event.data.progress).toFixed(2)}%`;
18
+ else if (event.type === "complete") processSpinner.succeed("Processing complete");
19
+ const info = await getIsobmffProcessInfo(client, processorRecord.id);
20
+ console.log("Processed file info");
21
+ console.log(info);
38
22
  });
@@ -1,35 +1,32 @@
1
- import { spawnSync } from "node:child_process";
2
- import path from "node:path";
3
- import { program } from "commander";
4
- import { getRenderInfo } from "@editframe/elements";
5
1
  import { processRenderInfo } from "../operations/processRenderInfo.js";
2
+ import { withSpinner } from "../utils/withSpinner.js";
6
3
  import { launchBrowserAndWaitForSDK } from "../utils/launchBrowserAndWaitForSDK.js";
7
4
  import { PreviewServer } from "../utils/startPreviewServer.js";
8
- import { withSpinner } from "../utils/withSpinner.js";
9
- program.command("process [directory]").description(
10
- "Process's a directory's index.html file, analyzing assets and processing them for rendering"
11
- ).action(async (directory) => {
12
- directory ??= ".";
13
- const distDir = path.join(directory, "dist");
14
- await withSpinner("Building\n", async () => {
15
- spawnSync("npx", ["vite", "build", directory], {
16
- stdio: "inherit"
17
- });
18
- });
19
- const previewServer = await PreviewServer.start(distDir);
20
- process.stderr.write("Preview server started at ");
21
- process.stderr.write(previewServer.url);
22
- process.stderr.write("\n");
23
- await launchBrowserAndWaitForSDK(
24
- {
25
- url: previewServer.url,
26
- efInteractive: false,
27
- interactive: false,
28
- headless: true
29
- },
30
- async (page) => {
31
- const renderInfo = await page.evaluate(getRenderInfo);
32
- await processRenderInfo(renderInfo);
33
- }
34
- );
5
+ import { program } from "commander";
6
+ import path from "node:path";
7
+ import { spawnSync } from "node:child_process";
8
+ import { getRenderInfo } from "@editframe/elements";
9
+ program.command("process [directory]").description("Process's a directory's index.html file, analyzing assets and processing them for rendering").action(async (directory) => {
10
+ directory ??= ".";
11
+ const distDir = path.join(directory, "dist");
12
+ await withSpinner("Building\n", async () => {
13
+ spawnSync("npx", [
14
+ "vite",
15
+ "build",
16
+ directory
17
+ ], { stdio: "inherit" });
18
+ });
19
+ const previewServer = await PreviewServer.start(distDir);
20
+ process.stderr.write("Preview server started at ");
21
+ process.stderr.write(previewServer.url);
22
+ process.stderr.write("\n");
23
+ await launchBrowserAndWaitForSDK({
24
+ url: previewServer.url,
25
+ efInteractive: false,
26
+ interactive: false,
27
+ headless: true
28
+ }, async (page) => {
29
+ const renderInfo = await page.evaluate(getRenderInfo);
30
+ await processRenderInfo(renderInfo);
31
+ });
35
32
  });