@editframe/cli 0.16.7-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.
- package/dist/VERSION.d.ts +1 -1
- package/dist/VERSION.js +2 -4
- package/dist/commands/auth.js +16 -25
- package/dist/commands/check.js +81 -108
- package/dist/commands/mux.d.ts +1 -0
- package/dist/commands/preview.js +4 -1
- package/dist/commands/process-file.js +18 -34
- package/dist/commands/process.js +28 -31
- package/dist/commands/render.js +117 -157
- package/dist/commands/sync.js +3 -5
- package/dist/commands/webhook.js +48 -52
- package/dist/index.js +3 -7
- package/dist/operations/processRenderInfo.js +25 -31
- package/dist/operations/syncAssetsDirectory/SubAssetSync.js +11 -18
- package/dist/operations/syncAssetsDirectory/SyncCaption.js +46 -73
- package/dist/operations/syncAssetsDirectory/SyncFragmentIndex.js +53 -83
- package/dist/operations/syncAssetsDirectory/SyncImage.js +72 -99
- package/dist/operations/syncAssetsDirectory/SyncStatus.js +30 -37
- package/dist/operations/syncAssetsDirectory/SyncTrack.js +107 -143
- package/dist/operations/syncAssetsDirectory/doAssetSync.js +42 -46
- package/dist/operations/syncAssetsDirectory.js +55 -78
- package/dist/utils/createReadableStreamFromReadable.js +61 -78
- package/dist/utils/index.js +10 -16
- package/dist/utils/launchBrowserAndWaitForSDK.js +31 -43
- package/dist/utils/startDevServer.d.ts +1 -1
- package/dist/utils/startPreviewServer.d.ts +1 -1
- package/dist/utils/startPreviewServer.js +28 -34
- package/dist/utils/validateVideoResolution.js +19 -23
- package/dist/utils/withSpinner.js +10 -12
- package/package.json +8 -8
- package/src/commands/check.ts +2 -2
- package/src/commands/mux.ts +10 -0
- package/src/utils/createReadableStreamFromReadable.ts +3 -7
- package/src/utils/startDevServer.ts +5 -5
- package/src/utils/startPreviewServer.ts +1 -1
- package/test-fixtures/network.ts +38 -9
package/dist/VERSION.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.17.6-beta.0";
|
package/dist/VERSION.js
CHANGED
package/dist/commands/auth.js
CHANGED
|
@@ -1,33 +1,24 @@
|
|
|
1
|
-
import
|
|
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
|
-
|
|
9
|
-
|
|
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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
};
|
package/dist/commands/check.js
CHANGED
|
@@ -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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
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 {};
|
package/dist/commands/preview.js
CHANGED
|
@@ -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
|
-
|
|
4
|
+
spawn("npx", ["vite", "dev"], {
|
|
5
|
+
cwd: projectDirectory,
|
|
6
|
+
stdio: "inherit"
|
|
7
|
+
});
|
|
5
8
|
});
|
|
@@ -1,38 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getClient } from "../utils/index.js";
|
|
2
2
|
import { withSpinner } from "../utils/withSpinner.js";
|
|
3
|
-
import {
|
|
3
|
+
import { program } from "commander";
|
|
4
4
|
import ora from "ora";
|
|
5
|
-
import {
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
});
|
package/dist/commands/process.js
CHANGED
|
@@ -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 {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
});
|