@editframe/cli 0.12.0-beta.6 → 0.13.0-beta.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.d.ts +1 -1
- package/dist/VERSION.js +1 -1
- package/dist/commands/process-file.js +1 -1
- package/dist/commands/process.js +3 -3
- package/dist/commands/render.js +1 -4
- package/dist/commands/webhook.js +3 -3
- package/dist/operations/getRenderInfo.d.ts +2 -2
- package/dist/operations/processRenderInfo.d.ts +1 -1
- package/dist/operations/syncAssetsDirectory/SubAssetSync.d.ts +5 -5
- package/dist/operations/syncAssetsDirectory/SyncCaption.d.ts +2 -2
- package/dist/operations/syncAssetsDirectory/SyncFragmentIndex.d.ts +2 -2
- package/dist/operations/syncAssetsDirectory/SyncImage.d.ts +2 -2
- package/dist/operations/syncAssetsDirectory/SyncTrack.d.ts +8 -4
- package/dist/operations/syncAssetsDirectory/SyncTrack.js +6 -0
- package/dist/operations/syncAssetsDirectory/doAssetSync.d.ts +1 -1
- package/dist/utils/getFolderSize.d.ts +1 -1
- package/dist/utils/startPreviewServer.js +1 -1
- package/dist/utils/validateVideoResolution.d.ts +1 -1
- package/package.json +5 -5
- package/src/commands/auth.ts +1 -1
- package/src/commands/process-file.ts +3 -3
- package/src/commands/process.ts +5 -5
- package/src/commands/render.ts +10 -13
- package/src/commands/sync.ts +1 -1
- package/src/commands/webhook.ts +4 -4
- package/src/operations/processRenderInfo.ts +2 -2
- package/src/operations/syncAssetsDirectory/SubAssetSync.ts +5 -5
- package/src/operations/syncAssetsDirectory/SyncCaption.test.ts +4 -4
- package/src/operations/syncAssetsDirectory/SyncCaption.ts +4 -4
- package/src/operations/syncAssetsDirectory/SyncFragmentIndex.test.ts +4 -4
- package/src/operations/syncAssetsDirectory/SyncFragmentIndex.ts +4 -4
- package/src/operations/syncAssetsDirectory/SyncImage.test.ts +4 -4
- package/src/operations/syncAssetsDirectory/SyncImage.ts +4 -4
- package/src/operations/syncAssetsDirectory/SyncTrack.test.ts +4 -4
- package/src/operations/syncAssetsDirectory/SyncTrack.ts +11 -7
- package/src/operations/syncAssetsDirectory/doAssetSync.test.ts +3 -3
- package/src/operations/syncAssetsDirectory/doAssetSync.ts +1 -1
- package/src/operations/syncAssetsDirectory.test.ts +3 -3
- package/src/operations/syncAssetsDirectory.ts +2 -2
- package/src/utils/getFolderSize.ts +12 -16
- package/src/utils/launchBrowserAndWaitForSDK.ts +1 -1
- package/src/utils/startDevServer.ts +1 -1
- package/src/utils/startPreviewServer.ts +2 -2
- package/test-fixtures/fixture.ts +2 -2
- package/test-fixtures/network.ts +1 -1
- package/dist/utils/getFolderSize.js +0 -22
package/dist/VERSION.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.13.0-beta.1";
|
package/dist/VERSION.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { program } from "commander";
|
|
2
2
|
import { withSpinner } from "../utils/withSpinner.js";
|
|
3
|
-
import { uploadUnprocessedFile, getIsobmffProcessProgress, getIsobmffProcessInfo, createUnprocessedFileFromPath, processIsobmffFile } from "@editframe/api";
|
|
3
|
+
import { uploadUnprocessedFile, getIsobmffProcessProgress, getIsobmffProcessInfo, createUnprocessedFileFromPath, processIsobmffFile } from "@editframe/api/node";
|
|
4
4
|
import ora from "ora";
|
|
5
5
|
import { getClient } from "../utils/index.js";
|
|
6
6
|
program.command("process-file <file>").description("Upload a audio/video to Editframe for processing.").action(async (path) => {
|
package/dist/commands/process.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { spawnSync } from "node:child_process";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { program } from "commander";
|
|
4
|
-
import { withSpinner } from "../utils/withSpinner.js";
|
|
5
|
-
import { launchBrowserAndWaitForSDK } from "../utils/launchBrowserAndWaitForSDK.js";
|
|
6
|
-
import { PreviewServer } from "../utils/startPreviewServer.js";
|
|
7
4
|
import { getRenderInfo } from "../operations/getRenderInfo.js";
|
|
8
5
|
import { processRenderInfo } from "../operations/processRenderInfo.js";
|
|
6
|
+
import { launchBrowserAndWaitForSDK } from "../utils/launchBrowserAndWaitForSDK.js";
|
|
7
|
+
import { PreviewServer } from "../utils/startPreviewServer.js";
|
|
8
|
+
import { withSpinner } from "../utils/withSpinner.js";
|
|
9
9
|
program.command("process [directory]").description(
|
|
10
10
|
"Process's a directory's index.html file, analyzing assets and processing them for rendering"
|
|
11
11
|
).action(async (directory) => {
|
package/dist/commands/render.js
CHANGED
|
@@ -14,7 +14,6 @@ import { processRenderInfo } from "../operations/processRenderInfo.js";
|
|
|
14
14
|
import { syncAssetDirectory } from "../operations/syncAssetsDirectory.js";
|
|
15
15
|
import { SyncStatus } from "../operations/syncAssetsDirectory/SyncStatus.js";
|
|
16
16
|
import { createReadableStreamFromReadable } from "../utils/createReadableStreamFromReadable.js";
|
|
17
|
-
import { getFolderSize } from "../utils/getFolderSize.js";
|
|
18
17
|
import { getClient } from "../utils/index.js";
|
|
19
18
|
import { launchBrowserAndWaitForSDK } from "../utils/launchBrowserAndWaitForSDK.js";
|
|
20
19
|
import { PreviewServer } from "../utils/startPreviewServer.js";
|
|
@@ -152,12 +151,10 @@ program.command("render [directory]").description(
|
|
|
152
151
|
);
|
|
153
152
|
const readable = new PassThrough();
|
|
154
153
|
tarStream.pipe(readable);
|
|
155
|
-
const folderSize = await getFolderSize(distDir);
|
|
156
154
|
await uploadRender(
|
|
157
155
|
getClient(),
|
|
158
156
|
render.id,
|
|
159
|
-
createReadableStreamFromReadable(readable)
|
|
160
|
-
folderSize
|
|
157
|
+
createReadableStreamFromReadable(readable)
|
|
161
158
|
);
|
|
162
159
|
process.stderr.write("Render assets uploaded\n");
|
|
163
160
|
process.stderr.write(inspect(render));
|
package/dist/commands/webhook.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import ora from "ora";
|
|
1
|
+
import { input, select } from "@inquirer/prompts";
|
|
3
2
|
import chalk from "chalk";
|
|
3
|
+
import { program, Option } from "commander";
|
|
4
4
|
import debug from "debug";
|
|
5
|
-
import
|
|
5
|
+
import ora from "ora";
|
|
6
6
|
import { getClient } from "../utils/index.js";
|
|
7
7
|
const log = debug("ef:cli:auth");
|
|
8
8
|
const topics = [
|
|
@@ -18,8 +18,8 @@ export declare const RenderInfo: z.ZodObject<{
|
|
|
18
18
|
efImage: string[];
|
|
19
19
|
}>;
|
|
20
20
|
}, "strip", z.ZodTypeAny, {
|
|
21
|
-
width: number;
|
|
22
21
|
height: number;
|
|
22
|
+
width: number;
|
|
23
23
|
fps: number;
|
|
24
24
|
assets: {
|
|
25
25
|
efMedia: Record<string, any>;
|
|
@@ -28,8 +28,8 @@ export declare const RenderInfo: z.ZodObject<{
|
|
|
28
28
|
};
|
|
29
29
|
durationMs: number;
|
|
30
30
|
}, {
|
|
31
|
-
width: number;
|
|
32
31
|
height: number;
|
|
32
|
+
width: number;
|
|
33
33
|
fps: number;
|
|
34
34
|
assets: {
|
|
35
35
|
efMedia: Record<string, any>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { getRenderInfo } from './getRenderInfo.
|
|
1
|
+
import { getRenderInfo } from './getRenderInfo.js';
|
|
2
2
|
export declare const processRenderInfo: (renderInfo: Awaited<ReturnType<typeof getRenderInfo>>) => Promise<void>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { SyncStatus } from './SyncStatus.
|
|
2
|
-
import { SyncCaption } from './SyncCaption.
|
|
3
|
-
import { SyncFragmentIndex } from './SyncFragmentIndex.
|
|
4
|
-
import { SyncImage } from './SyncImage.
|
|
5
|
-
import { SyncTrack } from './SyncTrack.
|
|
1
|
+
import { SyncStatus } from './SyncStatus.js';
|
|
2
|
+
import { SyncCaption } from './SyncCaption.js';
|
|
3
|
+
import { SyncFragmentIndex } from './SyncFragmentIndex.js';
|
|
4
|
+
import { SyncImage } from './SyncImage.js';
|
|
5
|
+
import { SyncTrack } from './SyncTrack.js';
|
|
6
6
|
export interface SubAssetSync<CreationType> {
|
|
7
7
|
icon: string;
|
|
8
8
|
label: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CreateCaptionFileResult, LookupCaptionFileByMd5Result } from '../../../../api/src/index.ts';
|
|
2
|
-
import { SubAssetSync } from './SubAssetSync.
|
|
3
|
-
import { SyncStatus } from './SyncStatus.
|
|
2
|
+
import { SubAssetSync } from './SubAssetSync.js';
|
|
3
|
+
import { SyncStatus } from './SyncStatus.js';
|
|
4
4
|
export declare class SyncCaption implements SubAssetSync<CreateCaptionFileResult> {
|
|
5
5
|
path: string;
|
|
6
6
|
md5: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CreateISOBMFFFileResult, LookupISOBMFFFileByMd5Result } from '../../../../api/src/index.ts';
|
|
2
|
-
import { SubAssetSync } from './SubAssetSync.
|
|
3
|
-
import { SyncStatus } from './SyncStatus.
|
|
2
|
+
import { SubAssetSync } from './SubAssetSync.js';
|
|
3
|
+
import { SyncStatus } from './SyncStatus.js';
|
|
4
4
|
export declare class SyncFragmentIndex implements SubAssetSync<CreateISOBMFFFileResult> {
|
|
5
5
|
path: string;
|
|
6
6
|
md5: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CreateImageFileResult, LookupImageFileByMd5Result } from '../../../../api/src/index.ts';
|
|
2
2
|
import { Probe } from '../../../../assets/src/index.ts';
|
|
3
|
-
import { SubAssetSync } from './SubAssetSync.
|
|
4
|
-
import { SyncStatus } from './SyncStatus.
|
|
3
|
+
import { SubAssetSync } from './SubAssetSync.js';
|
|
4
|
+
import { SyncStatus } from './SyncStatus.js';
|
|
5
5
|
export declare class SyncImage implements SubAssetSync<CreateImageFileResult> {
|
|
6
6
|
path: string;
|
|
7
7
|
md5: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CreateISOBMFFFileResult, CreateISOBMFFTrackResult, LookupISOBMFFFileByMd5Result } from '../../../../api/src/index.ts';
|
|
2
2
|
import { Probe } from '../../../../assets/src/index.ts';
|
|
3
|
-
import { SubAssetSync } from './SubAssetSync.
|
|
4
|
-
import { SyncStatus } from './SyncStatus.
|
|
3
|
+
import { SubAssetSync } from './SubAssetSync.js';
|
|
4
|
+
import { SyncStatus } from './SyncStatus.js';
|
|
5
5
|
export declare class SyncTrack implements SubAssetSync<CreateISOBMFFTrackResult> {
|
|
6
6
|
path: string;
|
|
7
7
|
md5: string;
|
|
@@ -39,6 +39,8 @@ export declare class SyncTrack implements SubAssetSync<CreateISOBMFFTrackResult>
|
|
|
39
39
|
disposition: Record<string, unknown>;
|
|
40
40
|
initial_padding?: number | undefined;
|
|
41
41
|
} | {
|
|
42
|
+
height: number;
|
|
43
|
+
width: number;
|
|
42
44
|
index: number;
|
|
43
45
|
codec_name: string;
|
|
44
46
|
codec_long_name: string;
|
|
@@ -49,8 +51,6 @@ export declare class SyncTrack implements SubAssetSync<CreateISOBMFFTrackResult>
|
|
|
49
51
|
avg_frame_rate: string;
|
|
50
52
|
time_base: string;
|
|
51
53
|
disposition: Record<string, unknown>;
|
|
52
|
-
width: number;
|
|
53
|
-
height: number;
|
|
54
54
|
coded_width: number;
|
|
55
55
|
coded_height: number;
|
|
56
56
|
start_pts?: number | undefined;
|
|
@@ -58,6 +58,10 @@ export declare class SyncTrack implements SubAssetSync<CreateISOBMFFTrackResult>
|
|
|
58
58
|
duration_ts?: number | undefined;
|
|
59
59
|
duration?: number | undefined;
|
|
60
60
|
bit_rate?: string | undefined;
|
|
61
|
+
} | {
|
|
62
|
+
index: number;
|
|
63
|
+
codec_type: "data";
|
|
64
|
+
duration?: string | undefined;
|
|
61
65
|
};
|
|
62
66
|
prepare(): Promise<void>;
|
|
63
67
|
get trackId(): string;
|
|
@@ -64,6 +64,9 @@ class SyncTrack {
|
|
|
64
64
|
if (!track.duration) {
|
|
65
65
|
throw new Error(`No duration found in track: ${this.path}`);
|
|
66
66
|
}
|
|
67
|
+
if (typeof track.duration === "string") {
|
|
68
|
+
return Number.parseFloat(track.duration);
|
|
69
|
+
}
|
|
67
70
|
return track.duration;
|
|
68
71
|
}
|
|
69
72
|
async validate() {
|
|
@@ -74,6 +77,9 @@ class SyncTrack {
|
|
|
74
77
|
async create() {
|
|
75
78
|
const track = this.track;
|
|
76
79
|
const isoFile = this.isoFile;
|
|
80
|
+
if (track.codec_type === "data") {
|
|
81
|
+
throw new Error(`Unsupported codec type: ${track.codec_type}`);
|
|
82
|
+
}
|
|
77
83
|
const createPayload = track.codec_type === "audio" ? {
|
|
78
84
|
type: track.codec_type,
|
|
79
85
|
file_id: isoFile.id,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare
|
|
1
|
+
export declare function getFolderSize(dir: string): Promise<number>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@editframe/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0-beta.1",
|
|
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.
|
|
27
|
-
"@editframe/assets": "0.
|
|
28
|
-
"@editframe/elements": "0.
|
|
29
|
-
"@editframe/vite-plugin": "0.
|
|
26
|
+
"@editframe/api": "0.13.0-beta.1",
|
|
27
|
+
"@editframe/assets": "0.13.0-beta.1",
|
|
28
|
+
"@editframe/elements": "0.13.0-beta.1",
|
|
29
|
+
"@editframe/vite-plugin": "0.13.0-beta.1",
|
|
30
30
|
"@inquirer/prompts": "^5.3.8",
|
|
31
31
|
"axios": "^1.6.8",
|
|
32
32
|
"chalk": "^5.3.0",
|
package/src/commands/auth.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { program } from "commander";
|
|
2
2
|
|
|
3
|
-
import { withSpinner } from "../utils/withSpinner.
|
|
3
|
+
import { withSpinner } from "../utils/withSpinner.js";
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
6
|
createUnprocessedFileFromPath,
|
|
@@ -8,9 +8,9 @@ import {
|
|
|
8
8
|
getIsobmffProcessProgress,
|
|
9
9
|
processIsobmffFile,
|
|
10
10
|
uploadUnprocessedFile,
|
|
11
|
-
} from "@editframe/api";
|
|
11
|
+
} from "@editframe/api/node";
|
|
12
12
|
import ora from "ora";
|
|
13
|
-
import { getClient } from "../utils/index.
|
|
13
|
+
import { getClient } from "../utils/index.js";
|
|
14
14
|
|
|
15
15
|
program
|
|
16
16
|
.command("process-file <file>")
|
package/src/commands/process.ts
CHANGED
|
@@ -3,11 +3,11 @@ import path from "node:path";
|
|
|
3
3
|
|
|
4
4
|
import { program } from "commander";
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
6
|
+
import { getRenderInfo } from "../operations/getRenderInfo.js";
|
|
7
|
+
import { processRenderInfo } from "../operations/processRenderInfo.js";
|
|
8
|
+
import { launchBrowserAndWaitForSDK } from "../utils/launchBrowserAndWaitForSDK.js";
|
|
9
|
+
import { PreviewServer } from "../utils/startPreviewServer.js";
|
|
10
|
+
import { withSpinner } from "../utils/withSpinner.js";
|
|
11
11
|
|
|
12
12
|
program
|
|
13
13
|
.command("process [directory]")
|
package/src/commands/render.ts
CHANGED
|
@@ -12,17 +12,16 @@ import { md5Directory, md5FilePath } from "@editframe/assets";
|
|
|
12
12
|
import { spawnSync } from "node:child_process";
|
|
13
13
|
import { createRender, uploadRender } from "@editframe/api";
|
|
14
14
|
import debug from "debug";
|
|
15
|
-
import { RenderInfo, getRenderInfo } from "../operations/getRenderInfo.
|
|
16
|
-
import { processRenderInfo } from "../operations/processRenderInfo.
|
|
17
|
-
import { syncAssetDirectory } from "../operations/syncAssetsDirectory.
|
|
18
|
-
import { SyncStatus } from "../operations/syncAssetsDirectory/SyncStatus.
|
|
19
|
-
import { createReadableStreamFromReadable } from "../utils/createReadableStreamFromReadable.
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import { withSpinner } from "../utils/withSpinner.ts";
|
|
15
|
+
import { RenderInfo, getRenderInfo } from "../operations/getRenderInfo.js";
|
|
16
|
+
import { processRenderInfo } from "../operations/processRenderInfo.js";
|
|
17
|
+
import { syncAssetDirectory } from "../operations/syncAssetsDirectory.js";
|
|
18
|
+
import { SyncStatus } from "../operations/syncAssetsDirectory/SyncStatus.js";
|
|
19
|
+
import { createReadableStreamFromReadable } from "../utils/createReadableStreamFromReadable.js";
|
|
20
|
+
import { getClient } from "../utils/index.js";
|
|
21
|
+
import { launchBrowserAndWaitForSDK } from "../utils/launchBrowserAndWaitForSDK.js";
|
|
22
|
+
import { PreviewServer } from "../utils/startPreviewServer.js";
|
|
23
|
+
import { validateVideoResolution } from "../utils/validateVideoResolution.js";
|
|
24
|
+
import { withSpinner } from "../utils/withSpinner.js";
|
|
26
25
|
|
|
27
26
|
const log = debug("ef:cli:render");
|
|
28
27
|
|
|
@@ -181,12 +180,10 @@ program
|
|
|
181
180
|
const readable = new PassThrough();
|
|
182
181
|
tarStream.pipe(readable);
|
|
183
182
|
|
|
184
|
-
const folderSize = await getFolderSize(distDir);
|
|
185
183
|
await uploadRender(
|
|
186
184
|
getClient(),
|
|
187
185
|
render.id,
|
|
188
186
|
createReadableStreamFromReadable(readable),
|
|
189
|
-
folderSize,
|
|
190
187
|
);
|
|
191
188
|
process.stderr.write("Render assets uploaded\n");
|
|
192
189
|
process.stderr.write(inspect(render));
|
package/src/commands/sync.ts
CHANGED
package/src/commands/webhook.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import ora from "ora";
|
|
1
|
+
import { input, select } from "@inquirer/prompts";
|
|
3
2
|
import chalk from "chalk";
|
|
3
|
+
import { Option, program } from "commander";
|
|
4
4
|
import debug from "debug";
|
|
5
|
-
import
|
|
5
|
+
import ora from "ora";
|
|
6
6
|
|
|
7
|
-
import { getClient } from "../utils/index.
|
|
7
|
+
import { getClient } from "../utils/index.js";
|
|
8
8
|
|
|
9
9
|
const log = debug("ef:cli:auth");
|
|
10
10
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
-
generateTrack,
|
|
3
2
|
cacheImage,
|
|
4
3
|
findOrCreateCaptions,
|
|
4
|
+
generateTrack,
|
|
5
5
|
} from "@editframe/assets";
|
|
6
|
-
import type { getRenderInfo } from "./getRenderInfo.
|
|
6
|
+
import type { getRenderInfo } from "./getRenderInfo.js";
|
|
7
7
|
|
|
8
8
|
export const processRenderInfo = async (
|
|
9
9
|
renderInfo: Awaited<ReturnType<typeof getRenderInfo>>,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import debug from "debug";
|
|
2
|
-
import type { SyncStatus } from "./SyncStatus.
|
|
2
|
+
import type { SyncStatus } from "./SyncStatus.js";
|
|
3
3
|
|
|
4
|
-
import { SyncCaption } from "./SyncCaption.
|
|
5
|
-
import { SyncFragmentIndex } from "./SyncFragmentIndex.
|
|
6
|
-
import { SyncImage } from "./SyncImage.
|
|
7
|
-
import { SyncTrack } from "./SyncTrack.
|
|
4
|
+
import { SyncCaption } from "./SyncCaption.js";
|
|
5
|
+
import { SyncFragmentIndex } from "./SyncFragmentIndex.js";
|
|
6
|
+
import { SyncImage } from "./SyncImage.js";
|
|
7
|
+
import { SyncTrack } from "./SyncTrack.js";
|
|
8
8
|
|
|
9
9
|
export interface SubAssetSync<CreationType> {
|
|
10
10
|
icon: string;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { useMSW } from "TEST/useMSW.
|
|
1
|
+
import { useMSW } from "TEST/useMSW.js";
|
|
2
2
|
import { describe, expect, test } from "vitest";
|
|
3
|
-
import { fixture, withFixtures } from "../../../test-fixtures/fixture.
|
|
3
|
+
import { fixture, withFixtures } from "../../../test-fixtures/fixture.js";
|
|
4
4
|
import {
|
|
5
5
|
mockCreateCaptionFile,
|
|
6
6
|
mockLookupCaptionFileByMd5,
|
|
7
7
|
mockLookupCaptionFileByMd5NotFound,
|
|
8
8
|
mockUploadCaptionFile,
|
|
9
|
-
} from "../../../test-fixtures/network.
|
|
10
|
-
import { SyncCaption } from "./SyncCaption.
|
|
9
|
+
} from "../../../test-fixtures/network.js";
|
|
10
|
+
import { SyncCaption } from "./SyncCaption.js";
|
|
11
11
|
describe("SyncCaption", async () => {
|
|
12
12
|
const server = useMSW();
|
|
13
13
|
await withFixtures(
|
|
@@ -9,12 +9,12 @@ import {
|
|
|
9
9
|
} from "@editframe/api";
|
|
10
10
|
|
|
11
11
|
import { Readable } from "node:stream";
|
|
12
|
-
import { getClient } from "../../utils/index.
|
|
12
|
+
import { getClient } from "../../utils/index.js";
|
|
13
13
|
|
|
14
14
|
import { basename } from "node:path";
|
|
15
|
-
import { createReadableStreamFromReadable } from "../../utils/createReadableStreamFromReadable.
|
|
16
|
-
import type { SubAssetSync } from "./SubAssetSync.
|
|
17
|
-
import { SyncStatus } from "./SyncStatus.
|
|
15
|
+
import { createReadableStreamFromReadable } from "../../utils/createReadableStreamFromReadable.js";
|
|
16
|
+
import type { SubAssetSync } from "./SubAssetSync.js";
|
|
17
|
+
import { SyncStatus } from "./SyncStatus.js";
|
|
18
18
|
export class SyncCaption implements SubAssetSync<CreateCaptionFileResult> {
|
|
19
19
|
icon = "📝";
|
|
20
20
|
label = "captions";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { useMSW } from "TEST/useMSW.
|
|
1
|
+
import { useMSW } from "TEST/useMSW.js";
|
|
2
2
|
import { describe, expect, test } from "vitest";
|
|
3
|
-
import { fixture, withFixtures } from "../../../test-fixtures/fixture.
|
|
3
|
+
import { fixture, withFixtures } from "../../../test-fixtures/fixture.js";
|
|
4
4
|
import {
|
|
5
5
|
mockCreateIsobmffFile,
|
|
6
6
|
mockLookupISOBMFFFileByMd5,
|
|
7
7
|
mockLookupISOBMFFFileByMd5NotFound,
|
|
8
8
|
mockUploadIsobmffFileIndex,
|
|
9
|
-
} from "../../../test-fixtures/network.
|
|
10
|
-
import { SyncFragmentIndex } from "./SyncFragmentIndex.
|
|
9
|
+
} from "../../../test-fixtures/network.js";
|
|
10
|
+
import { SyncFragmentIndex } from "./SyncFragmentIndex.js";
|
|
11
11
|
|
|
12
12
|
describe("SyncFragmentIndex", async () => {
|
|
13
13
|
const server = useMSW();
|
|
@@ -10,10 +10,10 @@ import {
|
|
|
10
10
|
uploadFragmentIndex,
|
|
11
11
|
} from "@editframe/api";
|
|
12
12
|
|
|
13
|
-
import { createReadableStreamFromReadable } from "../../utils/createReadableStreamFromReadable.
|
|
14
|
-
import { getClient } from "../../utils/index.
|
|
15
|
-
import type { SubAssetSync } from "./SubAssetSync.
|
|
16
|
-
import { SyncStatus } from "./SyncStatus.
|
|
13
|
+
import { createReadableStreamFromReadable } from "../../utils/createReadableStreamFromReadable.js";
|
|
14
|
+
import { getClient } from "../../utils/index.js";
|
|
15
|
+
import type { SubAssetSync } from "./SubAssetSync.js";
|
|
16
|
+
import { SyncStatus } from "./SyncStatus.js";
|
|
17
17
|
|
|
18
18
|
export class SyncFragmentIndex
|
|
19
19
|
implements SubAssetSync<CreateISOBMFFFileResult>
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { useMSW } from "TEST/useMSW.
|
|
1
|
+
import { useMSW } from "TEST/useMSW.js";
|
|
2
2
|
import { describe, expect, test } from "vitest";
|
|
3
|
-
import { fixture, withFixtures } from "../../../test-fixtures/fixture.
|
|
3
|
+
import { fixture, withFixtures } from "../../../test-fixtures/fixture.js";
|
|
4
4
|
import {
|
|
5
5
|
mockCreateImageFile,
|
|
6
6
|
mockGetUploadImageFile,
|
|
7
7
|
mockLookupImageFileByMd5,
|
|
8
8
|
mockLookupImageFileByMd5NotFound,
|
|
9
|
-
} from "../../../test-fixtures/network.
|
|
10
|
-
import { SyncImage } from "./SyncImage.
|
|
9
|
+
} from "../../../test-fixtures/network.js";
|
|
10
|
+
import { SyncImage } from "./SyncImage.js";
|
|
11
11
|
describe("SyncImage", async () => {
|
|
12
12
|
const server = useMSW();
|
|
13
13
|
await withFixtures(
|
|
@@ -12,10 +12,10 @@ import {
|
|
|
12
12
|
|
|
13
13
|
import { Probe } from "@editframe/assets";
|
|
14
14
|
|
|
15
|
-
import { createReadableStreamFromReadable } from "../../utils/createReadableStreamFromReadable.
|
|
16
|
-
import { getClient } from "../../utils/index.
|
|
17
|
-
import type { SubAssetSync } from "./SubAssetSync.
|
|
18
|
-
import { SyncStatus } from "./SyncStatus.
|
|
15
|
+
import { createReadableStreamFromReadable } from "../../utils/createReadableStreamFromReadable.js";
|
|
16
|
+
import { getClient } from "../../utils/index.js";
|
|
17
|
+
import type { SubAssetSync } from "./SubAssetSync.js";
|
|
18
|
+
import { SyncStatus } from "./SyncStatus.js";
|
|
19
19
|
|
|
20
20
|
export class SyncImage implements SubAssetSync<CreateImageFileResult> {
|
|
21
21
|
icon = "🖼️";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { useMSW } from "TEST/useMSW.
|
|
1
|
+
import { useMSW } from "TEST/useMSW.js";
|
|
2
2
|
import { describe, expect, test } from "vitest";
|
|
3
|
-
import { fixture, withFixtures } from "../../../test-fixtures/fixture.
|
|
3
|
+
import { fixture, withFixtures } from "../../../test-fixtures/fixture.js";
|
|
4
4
|
import {
|
|
5
5
|
mockCreateIsobmffFile,
|
|
6
6
|
mockCreateIsobmffTrack,
|
|
7
7
|
mockGetIsobmffTrackUpload,
|
|
8
8
|
mockLookupISOBMFFFileByMd5,
|
|
9
9
|
mockLookupISOBMFFFileByMd5NotFound,
|
|
10
|
-
} from "../../../test-fixtures/network.
|
|
11
|
-
import { SyncTrack } from "./SyncTrack.
|
|
10
|
+
} from "../../../test-fixtures/network.js";
|
|
11
|
+
import { SyncTrack } from "./SyncTrack.js";
|
|
12
12
|
|
|
13
13
|
describe("SyncTrack", async () => {
|
|
14
14
|
const server = useMSW();
|
|
@@ -2,8 +2,6 @@ import { createReadStream } from "node:fs";
|
|
|
2
2
|
import fs from "node:fs/promises";
|
|
3
3
|
import { basename, dirname, join } from "node:path";
|
|
4
4
|
|
|
5
|
-
import type { z } from "zod";
|
|
6
|
-
|
|
7
5
|
import {
|
|
8
6
|
type CreateISOBMFFFileResult,
|
|
9
7
|
type CreateISOBMFFTrackPayload,
|
|
@@ -16,10 +14,10 @@ import {
|
|
|
16
14
|
} from "@editframe/api";
|
|
17
15
|
import { Probe } from "@editframe/assets";
|
|
18
16
|
|
|
19
|
-
import { createReadableStreamFromReadable } from "../../utils/createReadableStreamFromReadable.
|
|
20
|
-
import { getClient } from "../../utils/index.
|
|
21
|
-
import type { SubAssetSync } from "./SubAssetSync.
|
|
22
|
-
import { SyncStatus } from "./SyncStatus.
|
|
17
|
+
import { createReadableStreamFromReadable } from "../../utils/createReadableStreamFromReadable.js";
|
|
18
|
+
import { getClient } from "../../utils/index.js";
|
|
19
|
+
import type { SubAssetSync } from "./SubAssetSync.js";
|
|
20
|
+
import { SyncStatus } from "./SyncStatus.js";
|
|
23
21
|
|
|
24
22
|
export class SyncTrack implements SubAssetSync<CreateISOBMFFTrackResult> {
|
|
25
23
|
icon = "📼";
|
|
@@ -91,6 +89,9 @@ export class SyncTrack implements SubAssetSync<CreateISOBMFFTrackResult> {
|
|
|
91
89
|
if (!track.duration) {
|
|
92
90
|
throw new Error(`No duration found in track: ${this.path}`);
|
|
93
91
|
}
|
|
92
|
+
if (typeof track.duration === "string") {
|
|
93
|
+
return Number.parseFloat(track.duration);
|
|
94
|
+
}
|
|
94
95
|
return track.duration;
|
|
95
96
|
}
|
|
96
97
|
|
|
@@ -104,7 +105,10 @@ export class SyncTrack implements SubAssetSync<CreateISOBMFFTrackResult> {
|
|
|
104
105
|
const track = this.track;
|
|
105
106
|
const isoFile = this.isoFile;
|
|
106
107
|
|
|
107
|
-
|
|
108
|
+
if (track.codec_type === "data") {
|
|
109
|
+
throw new Error(`Unsupported codec type: ${track.codec_type}`);
|
|
110
|
+
}
|
|
111
|
+
const createPayload: CreateISOBMFFTrackPayload =
|
|
108
112
|
track.codec_type === "audio"
|
|
109
113
|
? {
|
|
110
114
|
type: track.codec_type,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { describe, expect, test, vi } from "vitest";
|
|
2
|
-
import type { SubAssetSync } from "./SubAssetSync.
|
|
3
|
-
import type { SyncStatusInfo } from "./SyncStatus.
|
|
4
|
-
import { doAssetSync } from "./doAssetSync.
|
|
2
|
+
import type { SubAssetSync } from "./SubAssetSync.js";
|
|
3
|
+
import type { SyncStatusInfo } from "./SyncStatus.js";
|
|
4
|
+
import { doAssetSync } from "./doAssetSync.js";
|
|
5
5
|
|
|
6
6
|
const collectAsyncGenerator = async (
|
|
7
7
|
generator: SubAssetSync<unknown>,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { describe, it } from "vitest";
|
|
2
2
|
|
|
3
|
-
import { useMSW } from "TEST/useMSW.
|
|
4
|
-
import { fixture, withFixtures } from "../../test-fixtures/fixture.
|
|
3
|
+
import { useMSW } from "TEST/useMSW.js";
|
|
4
|
+
import { fixture, withFixtures } from "../../test-fixtures/fixture.js";
|
|
5
5
|
import {
|
|
6
6
|
mockCreateImageFile,
|
|
7
7
|
mockCreateIsobmffFile,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
mockLookupISOBMFFFileByMd5NotFound,
|
|
11
11
|
mockLookupImageFileByMd5NotFound,
|
|
12
12
|
mockUploadIsobmffFileIndex,
|
|
13
|
-
} from "../../test-fixtures/network.
|
|
13
|
+
} from "../../test-fixtures/network.js";
|
|
14
14
|
|
|
15
15
|
describe("syncAssetsDirectory", () => {
|
|
16
16
|
const server = useMSW();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import { getAssetSync } from "./syncAssetsDirectory/SubAssetSync.
|
|
4
|
-
import { doAssetSync } from "./syncAssetsDirectory/doAssetSync.
|
|
3
|
+
import { getAssetSync } from "./syncAssetsDirectory/SubAssetSync.js";
|
|
4
|
+
import { doAssetSync } from "./syncAssetsDirectory/doAssetSync.js";
|
|
5
5
|
|
|
6
6
|
export const syncAssetDirectory = async (
|
|
7
7
|
/**
|
|
@@ -1,24 +1,20 @@
|
|
|
1
1
|
import { promises as fs } from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
|
|
4
|
-
export
|
|
5
|
-
|
|
4
|
+
export async function getFolderSize(dir: string): Promise<number> {
|
|
5
|
+
const files = await fs.readdir(dir);
|
|
6
|
+
let size = 0;
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
const
|
|
8
|
+
for (const file of files) {
|
|
9
|
+
const filePath = path.join(dir, file);
|
|
10
|
+
const stats = await fs.stat(filePath);
|
|
9
11
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if (stats.isDirectory()) {
|
|
15
|
-
await calculateSize(filePath);
|
|
16
|
-
} else {
|
|
17
|
-
totalSize += stats.size;
|
|
18
|
-
}
|
|
12
|
+
if (stats.isDirectory()) {
|
|
13
|
+
size += await getFolderSize(filePath);
|
|
14
|
+
} else {
|
|
15
|
+
size += stats.size;
|
|
19
16
|
}
|
|
20
17
|
}
|
|
21
18
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
19
|
+
return size;
|
|
20
|
+
}
|
|
@@ -2,7 +2,7 @@ import chalk from "chalk";
|
|
|
2
2
|
import debug from "debug";
|
|
3
3
|
import { type Browser, type Page, chromium } from "playwright";
|
|
4
4
|
|
|
5
|
-
import { withSpinner } from "./withSpinner.
|
|
5
|
+
import { withSpinner } from "./withSpinner.js";
|
|
6
6
|
|
|
7
7
|
const browserLog = debug("ef:cli::browser");
|
|
8
8
|
|
|
@@ -5,7 +5,7 @@ import { type ViteDevServer, createServer } from "vite";
|
|
|
5
5
|
|
|
6
6
|
import { vitePluginEditframe as editframe } from "@editframe/vite-plugin";
|
|
7
7
|
|
|
8
|
-
import { withSpinner } from "./withSpinner.
|
|
8
|
+
import { withSpinner } from "./withSpinner.js";
|
|
9
9
|
|
|
10
10
|
export class DevServer {
|
|
11
11
|
static async start(directory: string) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { type ViteDevServer, createServer } from "vite";
|
|
2
1
|
import path from "node:path";
|
|
2
|
+
import { type ViteDevServer, createServer } from "vite";
|
|
3
3
|
|
|
4
4
|
import { vitePluginEditframe as editframe } from "@editframe/vite-plugin";
|
|
5
5
|
|
|
6
|
-
import { withSpinner } from "./withSpinner.
|
|
6
|
+
import { withSpinner } from "./withSpinner.js";
|
|
7
7
|
|
|
8
8
|
export class PreviewServer {
|
|
9
9
|
static async start(directory: string) {
|
package/test-fixtures/fixture.ts
CHANGED
|
@@ -7,8 +7,8 @@ import { expect } from "vitest";
|
|
|
7
7
|
|
|
8
8
|
import { md5Buffer } from "@editframe/assets";
|
|
9
9
|
|
|
10
|
-
import { syncAssetDirectory } from "../src/operations/syncAssetsDirectory.
|
|
11
|
-
import type { SyncStatusInfo } from "../src/operations/syncAssetsDirectory/SyncStatus.
|
|
10
|
+
import { syncAssetDirectory } from "../src/operations/syncAssetsDirectory.js";
|
|
11
|
+
import type { SyncStatusInfo } from "../src/operations/syncAssetsDirectory/SyncStatus.js";
|
|
12
12
|
|
|
13
13
|
export const fixture = async (
|
|
14
14
|
fixture: string,
|
package/test-fixtures/network.ts
CHANGED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { promises } from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
const getFolderSize = async (folderPath) => {
|
|
4
|
-
let totalSize = 0;
|
|
5
|
-
async function calculateSize(dir) {
|
|
6
|
-
const files = await promises.readdir(dir);
|
|
7
|
-
for (const file of files) {
|
|
8
|
-
const filePath = path.join(dir, file);
|
|
9
|
-
const stats = await promises.stat(filePath);
|
|
10
|
-
if (stats.isDirectory()) {
|
|
11
|
-
await calculateSize(filePath);
|
|
12
|
-
} else {
|
|
13
|
-
totalSize += stats.size;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
await calculateSize(folderPath);
|
|
18
|
-
return totalSize;
|
|
19
|
-
};
|
|
20
|
-
export {
|
|
21
|
-
getFolderSize
|
|
22
|
-
};
|