@editframe/cli 0.20.4-beta.0 → 0.23.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 CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "0.20.4-beta.0";
1
+ export declare const VERSION = "0.23.6-beta.0";
package/dist/VERSION.js CHANGED
@@ -1,2 +1,2 @@
1
- const VERSION = "0.20.4-beta.0";
1
+ const VERSION = "0.23.6-beta.0";
2
2
  export { VERSION };
@@ -3,14 +3,12 @@ import { program } from "commander";
3
3
  import chalk from "chalk";
4
4
  import debug from "debug";
5
5
  import ora from "ora";
6
- const log = debug("ef:cli:auth");
6
+ var log = debug("ef:cli:auth");
7
7
  const getApiData = async () => {
8
- const response = await getClient().authenticatedFetch("/api/v1/organization");
9
- return response.json();
8
+ return (await getClient().authenticatedFetch("/api/v1/organization")).json();
10
9
  };
11
- const authCommand = program.command("auth").description("Fetch organization data using API token").action(async () => {
12
- const options = authCommand.opts();
13
- log("Options:", options);
10
+ var authCommand = program.command("auth").description("Fetch organization data using API token").action(async () => {
11
+ log("Options:", authCommand.opts());
14
12
  const spinner = ora("Loading...").start();
15
13
  try {
16
14
  const apiData = await getApiData();
@@ -22,3 +20,4 @@ const authCommand = program.command("auth").description("Fetch organization data
22
20
  log("Error:", error);
23
21
  }
24
22
  });
23
+ export {};
@@ -3,36 +3,32 @@ import chalk from "chalk";
3
3
  import ora from "ora";
4
4
  import { exec } from "node:child_process";
5
5
  import os from "node:os";
6
- const checks = {
6
+ var checks = {
7
7
  ffmpeg: {
8
8
  message: () => {
9
9
  const platform = os.platform();
10
10
  const message = ["Processing assets for <ef-video>, <ef-audio>, <ef-captions>, and <ef-waveform>\n elements requires ffmpeg to be installed."];
11
11
  switch (platform) {
12
- case "darwin": {
12
+ case "darwin":
13
13
  message.push("On platform=darwin you can install ffmpeg using Homebrew:");
14
14
  message.push(" - brew install ffmpeg");
15
15
  message.push("Or you can download ffmpeg from https://ffmpeg.org/download.html");
16
16
  break;
17
- }
18
- case "linux": {
17
+ case "linux":
19
18
  message.push("You can install ffmpeg using your distribution's package manager.");
20
19
  break;
21
- }
22
- case "win32": {
20
+ case "win32":
23
21
  message.push("You can download ffmpeg from https://ffmpeg.org/download.html");
24
22
  message.push("You can use package managers like Chocolatey or Scoop to install ffmpeg.");
25
23
  message.push(" - choco install ffmpeg-full");
26
24
  message.push(" - scoop install ffmpeg");
27
25
  message.push(" - winget install ffmpeg");
28
26
  break;
29
- }
30
- default: {
27
+ default:
31
28
  message.push(`Unrecognized platform ${platform}`);
32
29
  message.push("You can download ffmpeg from https://ffmpeg.org/download.html");
33
30
  message.push("Or try installing it from your operating system's package manager");
34
31
  break;
35
- }
36
32
  }
37
33
  return message;
38
34
  },
@@ -85,3 +81,4 @@ program.command("check").description("Check on dependencies and other requiremen
85
81
  }
86
82
  }
87
83
  });
84
+ export {};
@@ -6,3 +6,4 @@ program.command("preview [directory]").description("Preview a directory's index.
6
6
  stdio: "inherit"
7
7
  });
8
8
  });
9
+ export {};
@@ -20,3 +20,4 @@ program.command("process-file <file>").description("Upload a audio/video to Edit
20
20
  console.log("Processed file info");
21
21
  console.log(info);
22
22
  });
23
+ export {};
@@ -26,7 +26,7 @@ program.command("process [directory]").description("Process's a directory's inde
26
26
  interactive: false,
27
27
  headless: true
28
28
  }, async (page) => {
29
- const renderInfo = await page.evaluate(getRenderInfo);
30
- await processRenderInfo(renderInfo);
29
+ await processRenderInfo(await page.evaluate(getRenderInfo));
31
30
  });
32
31
  });
32
+ export {};
@@ -19,12 +19,10 @@ import { inspect } from "node:util";
19
19
  import { RenderInfo, getRenderInfo } from "@editframe/elements";
20
20
  import { parse } from "node-html-parser";
21
21
  import * as tar from "tar";
22
- const log = debug("ef:cli:render");
22
+ var log = debug("ef:cli:render");
23
23
  const buildAssetId = async (srcDir, src, basename$1) => {
24
24
  log(`Building image asset id for ${src}\n`);
25
- const assetPath = path.join(srcDir, src);
26
- const assetMd5 = await md5FilePath(assetPath);
27
- const syncStatus = new SyncStatus(join(srcDir, "assets", ".cache", assetMd5, basename$1));
25
+ const syncStatus = new SyncStatus(join(srcDir, "assets", ".cache", await md5FilePath(path.join(srcDir, src)), basename$1));
28
26
  const info = await syncStatus.readInfo();
29
27
  if (!info) throw new Error(`SyncStatus info is not found for ${syncStatus.infoPath}`);
30
28
  return info.id;
@@ -106,13 +104,6 @@ program.command("render [directory]").description("Render a directory's index.ht
106
104
  process.stderr.write(`Render is in '${render?.status}' status. It cannot be recreated while in this status.\n`);
107
105
  return;
108
106
  }
109
- /**
110
- * This tar stream is created with the dist directory as the root.
111
- * This is acheived by setting the cwd option to the dist directory.
112
- * And the files to be included in the tar stream are all files in the dist directory.
113
- *
114
- * The renderer expects to find the index.html file at the root of the tar stream.
115
- */
116
107
  const tarStream = tar.create({
117
108
  gzip: true,
118
109
  cwd: distDir
@@ -125,3 +116,4 @@ program.command("render [directory]").description("Render a directory's index.ht
125
116
  process.stderr.write("\n");
126
117
  });
127
118
  });
119
+ export {};
@@ -4,3 +4,4 @@ import { join } from "node:path";
4
4
  program.command("sync").description("Sync assets to Editframe servers for rendering").argument("[directory]", "Path to project directory to sync.").action(async (directory = ".") => {
5
5
  await syncAssetDirectory(join(process.cwd(), directory, "src", "assets", ".cache"));
6
6
  });
7
+ export {};
@@ -4,8 +4,8 @@ import chalk from "chalk";
4
4
  import debug from "debug";
5
5
  import ora from "ora";
6
6
  import { input, select } from "@inquirer/prompts";
7
- const log = debug("ef:cli:auth");
8
- const topics = [
7
+ var log = debug("ef:cli:auth");
8
+ var topics = [
9
9
  "render.created",
10
10
  "render.rendering",
11
11
  "render.pending",
@@ -13,33 +13,26 @@ const topics = [
13
13
  "render.completed"
14
14
  ];
15
15
  const testWebhookURL = async ({ webhookURL, topic }) => {
16
- const response = await getClient().authenticatedFetch("/api/v1/test_webhook", {
16
+ return (await getClient().authenticatedFetch("/api/v1/test_webhook", {
17
17
  method: "POST",
18
18
  body: JSON.stringify({
19
19
  webhookURL,
20
20
  topic
21
21
  })
22
- });
23
- return response.json();
22
+ })).json();
24
23
  };
25
- const webhookCommand = program.command("webhook").description("Test webhook URL with a topic").option("-u, --webhookURL <webhookURL>", "Webhook URL").addOption(new Option("-t, --topic <topic>", "Topic").choices(topics)).action(async () => {
24
+ var webhookCommand = program.command("webhook").description("Test webhook URL with a topic").option("-u, --webhookURL <webhookURL>", "Webhook URL").addOption(new Option("-t, --topic <topic>", "Topic").choices(topics)).action(async () => {
26
25
  const options = webhookCommand.opts();
27
26
  log("Options:", options);
28
27
  let { webhookURL, topic } = options;
29
- if (!webhookURL) {
30
- const answer = await input({ message: "Enter a webhook URL:" });
31
- webhookURL = answer;
32
- }
33
- if (!topic) {
34
- const answer = await select({
35
- message: "Select a topic:",
36
- choices: [...topics.map((topic$1) => ({
37
- title: topic$1,
38
- value: topic$1
39
- }))]
40
- });
41
- topic = answer;
42
- }
28
+ if (!webhookURL) webhookURL = await input({ message: "Enter a webhook URL:" });
29
+ if (!topic) topic = await select({
30
+ message: "Select a topic:",
31
+ choices: [...topics.map((topic$1) => ({
32
+ title: topic$1,
33
+ value: topic$1
34
+ }))]
35
+ });
43
36
  const spinner = ora("Testing...").start();
44
37
  try {
45
38
  const apiData = await testWebhookURL({
@@ -55,3 +48,4 @@ const webhookCommand = program.command("webhook").description("Test webhook URL
55
48
  log("Error:", error);
56
49
  }
57
50
  });
51
+ export {};
package/dist/index.js CHANGED
@@ -12,3 +12,4 @@ import "dotenv/config";
12
12
  import { Option, program } from "commander";
13
13
  program.name("editframe").addOption(new Option("-t, --token <token>", "API Token").env("EF_TOKEN")).addOption(new Option("--ef-host <host>", "Editframe Host").env("EF_HOST").default("https://editframe.dev")).addOption(new Option("--ef-render-host <host>", "Editframe Render Host").env("EF_RENDER_HOST").default("https://editframe.dev")).version(VERSION);
14
14
  program.parse(process.argv);
15
+ export {};
@@ -3,11 +3,11 @@ import { SyncFragmentIndex } from "./SyncFragmentIndex.js";
3
3
  import { SyncImage } from "./SyncImage.js";
4
4
  import { SyncTrack } from "./SyncTrack.js";
5
5
  import debug from "debug";
6
- const trackMatch = /\.track-[\d]+.mp4$/i;
7
- const fragmentIndexMatch = /\.tracks.json$/i;
8
- const captionsMatch = /\.captions.json$/i;
9
- const imageMatch = /\.(png|jpe?g|gif|webp)$/i;
10
- const log = debug("ef:SubAssetSync");
6
+ var trackMatch = /\.track-[\d]+.mp4$/i;
7
+ var fragmentIndexMatch = /\.tracks.json$/i;
8
+ var captionsMatch = /\.captions.json$/i;
9
+ var imageMatch = /\.(png|jpe?g|gif|webp)$/i;
10
+ var log = debug("ef:SubAssetSync");
11
11
  const getAssetSync = (subAssetPath, md5) => {
12
12
  log("getAssetSync", {
13
13
  subAssetPath,
@@ -57,7 +57,7 @@ var SyncImage = class {
57
57
  if (!this.created) throw new Error("Image not created. Should have been prevented by .isComplete()");
58
58
  await uploadImageFile(getClient(), {
59
59
  id: this.created.id,
60
- byte_size: Number.parseInt(this.probeResult.format.size || "0")
60
+ byte_size: Number.parseInt(this.probeResult.format.size || "0", 10)
61
61
  }, createReadableStreamFromReadable(createReadStream(this.path))).whenUploaded();
62
62
  }
63
63
  async markSynced() {
@@ -1,7 +1,7 @@
1
1
  import fs from "node:fs/promises";
2
2
  import { z } from "zod";
3
- const SYNC_VERSION = "1";
4
- const SyncStatusSchema = z.object({
3
+ var SYNC_VERSION = "1";
4
+ var SyncStatusSchema = z.object({
5
5
  version: z.string(),
6
6
  complete: z.boolean(),
7
7
  id: z.string(),
@@ -16,7 +16,6 @@ var SyncStatus = class {
16
16
  async isSynced() {
17
17
  const syncInfo = await this.readInfo();
18
18
  if (!syncInfo) return false;
19
- console.log("syncInfo.infoPath", this.infoPath);
20
19
  return syncInfo.version === SYNC_VERSION && syncInfo.complete;
21
20
  }
22
21
  async readInfo() {
@@ -39,6 +39,5 @@ const doAssetSync = async function* (assetSync) {
39
39
  status: "success",
40
40
  message: `Synced ${assetSync.label}: ${assetSync.path}`
41
41
  };
42
- return;
43
42
  };
44
43
  export { doAssetSync };
@@ -3,11 +3,10 @@ import { getAssetSync } from "./syncAssetsDirectory/SubAssetSync.js";
3
3
  import path from "node:path";
4
4
  import fs from "node:fs/promises";
5
5
  const syncAssetDirectory = async (cacheDir) => {
6
- const stat = await fs.stat(cacheDir).catch((error) => {
6
+ if (!(await fs.stat(cacheDir).catch((error) => {
7
7
  if (error.code === "ENOENT") return;
8
8
  throw error;
9
- });
10
- if (!stat?.isDirectory()) {
9
+ }))?.isDirectory()) {
11
10
  console.error(`No assets cache directory found at ${cacheDir}`);
12
11
  return;
13
12
  }
@@ -28,8 +27,7 @@ const syncAssetDirectory = async (cacheDir) => {
28
27
  for (const assetMd5 of assets) {
29
28
  reportInfo(assetMd5, `Syncing asset: ${assetMd5}`);
30
29
  const assetDir = path.join(cacheDir, assetMd5);
31
- const stat$1 = await fs.stat(assetDir);
32
- if (!stat$1.isDirectory()) {
30
+ if (!(await fs.stat(assetDir)).isDirectory()) {
33
31
  reportError(assetMd5, "Invalid asset. Did not find asset directory.");
34
32
  return;
35
33
  }
@@ -1,8 +1,7 @@
1
1
  import { Stream } from "node:stream";
2
2
  const createReadableStreamFromReadable = (source) => {
3
3
  const pump = new StreamPump(source);
4
- const stream = new ReadableStream(pump, pump);
5
- return stream;
4
+ return new ReadableStream(pump, pump);
6
5
  };
7
6
  var StreamPump = class {
8
7
  constructor(stream) {
@@ -1,7 +1,7 @@
1
1
  import "dotenv/config";
2
2
  import { program } from "commander";
3
3
  import { Client } from "@editframe/api";
4
- let client;
4
+ var client;
5
5
  const getClient = () => {
6
6
  if (!client) {
7
7
  const programOpts = program.opts();
@@ -2,7 +2,7 @@ import { withSpinner } from "./withSpinner.js";
2
2
  import chalk from "chalk";
3
3
  import debug from "debug";
4
4
  import { chromium } from "playwright";
5
- const browserLog = debug("ef:cli::browser");
5
+ var browserLog = debug("ef:cli::browser");
6
6
  async function launchBrowserAndWaitForSDK(options, fn) {
7
7
  const browser = await withSpinner("Launching chrome", async () => {
8
8
  return chromium.launch({
@@ -11,24 +11,23 @@ async function launchBrowserAndWaitForSDK(options, fn) {
11
11
  devtools: options.interactive === true
12
12
  });
13
13
  });
14
- const page = await withSpinner("Loading Editframe SDK", async () => {
14
+ await fn(await withSpinner("Loading Editframe SDK", async () => {
15
15
  const pageOptions = {};
16
16
  if (options.interactive === true) pageOptions.viewport = null;
17
- const page$1 = await browser.newPage(pageOptions);
18
- page$1.on("console", (msg) => {
17
+ const page = await browser.newPage(pageOptions);
18
+ page.on("console", (msg) => {
19
19
  browserLog(chalk.blue(`browser (${msg.type()}) |`), msg.text());
20
20
  });
21
21
  const url = options.url + (options.efInteractive ? "" : "?EF_NONINTERACTIVE=1");
22
22
  process.stderr.write("\nLoading url: ");
23
23
  process.stderr.write(url);
24
24
  process.stderr.write("\n");
25
- await page$1.goto(url);
26
- await page$1.waitForFunction(() => {
25
+ await page.goto(url);
26
+ await page.waitForFunction(() => {
27
27
  return window.EF_REGISTERED;
28
28
  }, [], { timeout: 1e4 });
29
- return page$1;
30
- });
31
- await fn(page);
29
+ return page;
30
+ }));
32
31
  if (options.interactive !== true) {
33
32
  await browser.close();
34
33
  process.exit(0);
@@ -13,16 +13,15 @@ var PreviewServer = class PreviewServer {
13
13
  return `http://localhost:${this.previewServer.config.server.port}`;
14
14
  }
15
15
  };
16
- const startPreviewServer = async (directory) => {
16
+ var startPreviewServer = async (directory) => {
17
17
  return await withSpinner("Starting vite...", async () => {
18
18
  const resolvedDirectory = path.resolve(process.cwd(), directory);
19
- const cacheRoot = path.join(resolvedDirectory, "assets");
20
19
  const devServer = await createServer({
21
20
  server: { watch: null },
22
21
  root: resolvedDirectory,
23
22
  plugins: [vitePluginEditframe({
24
23
  root: resolvedDirectory,
25
- cacheRoot
24
+ cacheRoot: path.join(resolvedDirectory, "assets")
26
25
  })]
27
26
  });
28
27
  await devServer.listen();
@@ -1,8 +1,8 @@
1
1
  import debug from "debug";
2
2
  import ora from "ora";
3
3
  import { z } from "zod";
4
- const log = debug("ef:cli:validateVideoResolution");
5
- const schema = z.object({
4
+ var log = debug("ef:cli:validateVideoResolution");
5
+ var schema = z.object({
6
6
  width: z.number().int(),
7
7
  height: z.number().int()
8
8
  }).refine((data) => data.width % 2 === 0, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@editframe/cli",
3
- "version": "0.20.4-beta.0",
3
+ "version": "0.23.6-beta.0",
4
4
  "description": "Command line interface for EditFrame",
5
5
  "bin": {
6
6
  "editframe": "./dist/index.js"
@@ -23,10 +23,10 @@
23
23
  "vite-tsconfig-paths": "^4.3.2"
24
24
  },
25
25
  "dependencies": {
26
- "@editframe/api": "0.20.4-beta.0",
27
- "@editframe/assets": "0.20.4-beta.0",
28
- "@editframe/elements": "0.20.4-beta.0",
29
- "@editframe/vite-plugin": "0.20.4-beta.0",
26
+ "@editframe/api": "0.23.6-beta.0",
27
+ "@editframe/assets": "0.23.6-beta.0",
28
+ "@editframe/elements": "0.23.6-beta.0",
29
+ "@editframe/vite-plugin": "0.23.6-beta.0",
30
30
  "@inquirer/prompts": "^5.3.8",
31
31
  "axios": "^1.6.8",
32
32
  "chalk": "^5.3.0",
@@ -40,7 +40,7 @@
40
40
  "parse5-html-rewriting-stream": "^7.0.0",
41
41
  "playwright": "^1.53.0",
42
42
  "promptly": "^3.2.0",
43
- "rolldown-vite": "^6.3.21",
43
+ "rolldown-vite": "^7.1.15",
44
44
  "tailwindcss": "^3.4.3",
45
45
  "tar": "^7.1.0",
46
46
  "zod": "^3.23.8"
@@ -100,7 +100,7 @@ export class SyncImage implements SubAssetSync<CreateImageFileResult> {
100
100
  getClient(),
101
101
  {
102
102
  id: this.created.id,
103
- byte_size: Number.parseInt(this.probeResult.format.size || "0"),
103
+ byte_size: Number.parseInt(this.probeResult.format.size || "0", 10),
104
104
  },
105
105
  createReadableStreamFromReadable(createReadStream(this.path)),
106
106
  ).whenUploaded();
@@ -24,7 +24,6 @@ export class SyncStatus {
24
24
  if (!syncInfo) {
25
25
  return false;
26
26
  }
27
- console.log("syncInfo.infoPath", this.infoPath);
28
27
  return syncInfo.version === SYNC_VERSION && syncInfo.complete;
29
28
  }
30
29