@editframe/cli 0.7.0-beta.10 → 0.7.0-beta.11
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.cjs +1 -1
- package/dist/VERSION.js +1 -1
- package/dist/commands/render.cjs +5 -0
- package/dist/commands/render.js +5 -0
- package/dist/utils/validateVideoResolution.cjs +27 -0
- package/dist/utils/validateVideoResolution.js +27 -0
- package/package.json +5 -5
- package/src/commands/render.ts +7 -0
- package/src/utils/validateVideoResolution.ts +33 -0
package/dist/VERSION.cjs
CHANGED
package/dist/VERSION.js
CHANGED
package/dist/commands/render.cjs
CHANGED
|
@@ -16,6 +16,7 @@ const index = require("../utils/index.cjs");
|
|
|
16
16
|
const getRenderInfo = require("../operations/getRenderInfo.cjs");
|
|
17
17
|
const processRenderInfo = require("../operations/processRenderInfo.cjs");
|
|
18
18
|
const node_util = require("node:util");
|
|
19
|
+
const validateVideoResolution = require("../utils/validateVideoResolution.cjs");
|
|
19
20
|
function _interopNamespaceDefault(e) {
|
|
20
21
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
21
22
|
if (e) {
|
|
@@ -107,6 +108,10 @@ commander.program.command("render [directory]").description(
|
|
|
107
108
|
},
|
|
108
109
|
async (page) => {
|
|
109
110
|
const renderInfo = await page.evaluate(getRenderInfo.getRenderInfo);
|
|
111
|
+
validateVideoResolution.validateVideoResolution({
|
|
112
|
+
width: renderInfo.width,
|
|
113
|
+
height: renderInfo.height
|
|
114
|
+
});
|
|
110
115
|
await processRenderInfo.processRenderInfo(renderInfo);
|
|
111
116
|
const doc = nodeHtmlParser.parse(
|
|
112
117
|
await fs.readFile(path.join(distDir, "index.html"), "utf-8")
|
package/dist/commands/render.js
CHANGED
|
@@ -15,6 +15,7 @@ import { getClient } from "../utils/index.js";
|
|
|
15
15
|
import { getRenderInfo } from "../operations/getRenderInfo.js";
|
|
16
16
|
import { processRenderInfo } from "../operations/processRenderInfo.js";
|
|
17
17
|
import { inspect } from "node:util";
|
|
18
|
+
import { validateVideoResolution } from "../utils/validateVideoResolution.js";
|
|
18
19
|
const buildProductionUrl = async (origin, tagName, assetPath) => {
|
|
19
20
|
const md5Sum = await md5FilePath(assetPath);
|
|
20
21
|
const basename = path.basename(assetPath);
|
|
@@ -89,6 +90,10 @@ program.command("render [directory]").description(
|
|
|
89
90
|
},
|
|
90
91
|
async (page) => {
|
|
91
92
|
const renderInfo = await page.evaluate(getRenderInfo);
|
|
93
|
+
validateVideoResolution({
|
|
94
|
+
width: renderInfo.width,
|
|
95
|
+
height: renderInfo.height
|
|
96
|
+
});
|
|
92
97
|
await processRenderInfo(renderInfo);
|
|
93
98
|
const doc = parse(
|
|
94
99
|
await readFile(path.join(distDir, "index.html"), "utf-8")
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const zod = require("zod");
|
|
4
|
+
const ora = require("ora");
|
|
5
|
+
const debug = require("debug");
|
|
6
|
+
const log = debug("ef:cli:auth");
|
|
7
|
+
const schema = zod.z.object({
|
|
8
|
+
width: zod.z.number().int(),
|
|
9
|
+
height: zod.z.number().int()
|
|
10
|
+
}).refine((data) => data.width % 2 === 0 && data.height % 2 === 0, {
|
|
11
|
+
message: "Both width and height must be divisible by 2.",
|
|
12
|
+
path: ["width", "height"]
|
|
13
|
+
});
|
|
14
|
+
const validateVideoResolution = async (rawPayload) => {
|
|
15
|
+
const spinner = ora("Validating video resolution").start();
|
|
16
|
+
const result = schema.safeParse(rawPayload);
|
|
17
|
+
if (result.success) {
|
|
18
|
+
spinner.succeed("Video resolution is valid");
|
|
19
|
+
return result.data;
|
|
20
|
+
}
|
|
21
|
+
spinner.fail("Invalid video resolution");
|
|
22
|
+
process.stderr.write(result.error?.errors.map((e) => e.message).join("\n"));
|
|
23
|
+
process.stderr.write("\n");
|
|
24
|
+
log("Error:", result.error?.errors.map((e) => e.message).join("\n"));
|
|
25
|
+
process.exit(1);
|
|
26
|
+
};
|
|
27
|
+
exports.validateVideoResolution = validateVideoResolution;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import ora from "ora";
|
|
3
|
+
import debug from "debug";
|
|
4
|
+
const log = debug("ef:cli:auth");
|
|
5
|
+
const schema = z.object({
|
|
6
|
+
width: z.number().int(),
|
|
7
|
+
height: z.number().int()
|
|
8
|
+
}).refine((data) => data.width % 2 === 0 && data.height % 2 === 0, {
|
|
9
|
+
message: "Both width and height must be divisible by 2.",
|
|
10
|
+
path: ["width", "height"]
|
|
11
|
+
});
|
|
12
|
+
const validateVideoResolution = async (rawPayload) => {
|
|
13
|
+
const spinner = ora("Validating video resolution").start();
|
|
14
|
+
const result = schema.safeParse(rawPayload);
|
|
15
|
+
if (result.success) {
|
|
16
|
+
spinner.succeed("Video resolution is valid");
|
|
17
|
+
return result.data;
|
|
18
|
+
}
|
|
19
|
+
spinner.fail("Invalid video resolution");
|
|
20
|
+
process.stderr.write(result.error?.errors.map((e) => e.message).join("\n"));
|
|
21
|
+
process.stderr.write("\n");
|
|
22
|
+
log("Error:", result.error?.errors.map((e) => e.message).join("\n"));
|
|
23
|
+
process.exit(1);
|
|
24
|
+
};
|
|
25
|
+
export {
|
|
26
|
+
validateVideoResolution
|
|
27
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@editframe/cli",
|
|
3
|
-
"version": "0.7.0-beta.
|
|
3
|
+
"version": "0.7.0-beta.11",
|
|
4
4
|
"description": "Command line interface for EditFrame",
|
|
5
5
|
"bin": {
|
|
6
6
|
"editframe": "./dist/index.js"
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
"vite-tsconfig-paths": "^4.3.2"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@editframe/api": "0.7.0-beta.
|
|
26
|
-
"@editframe/assets": "0.7.0-beta.
|
|
27
|
-
"@editframe/elements": "0.7.0-beta.
|
|
28
|
-
"@editframe/vite-plugin": "0.7.0-beta.
|
|
25
|
+
"@editframe/api": "0.7.0-beta.11",
|
|
26
|
+
"@editframe/assets": "0.7.0-beta.11",
|
|
27
|
+
"@editframe/elements": "0.7.0-beta.11",
|
|
28
|
+
"@editframe/vite-plugin": "0.7.0-beta.11",
|
|
29
29
|
"axios": "^1.6.8",
|
|
30
30
|
"chalk": "^5.3.0",
|
|
31
31
|
"commander": "^12.0.0",
|
package/src/commands/render.ts
CHANGED
|
@@ -18,6 +18,7 @@ import { getClient } from "../utils";
|
|
|
18
18
|
import { getRenderInfo } from "../operations/getRenderInfo";
|
|
19
19
|
import { processRenderInfo } from "../operations/processRenderInfo";
|
|
20
20
|
import { inspect } from "node:util";
|
|
21
|
+
import { validateVideoResolution } from "../utils/validateVideoResolution";
|
|
21
22
|
|
|
22
23
|
interface StrategyBuilder {
|
|
23
24
|
buildProductionUrl: (tagName: string, assetPath: string) => Promise<string>;
|
|
@@ -114,6 +115,12 @@ program
|
|
|
114
115
|
},
|
|
115
116
|
async (page) => {
|
|
116
117
|
const renderInfo = await page.evaluate(getRenderInfo);
|
|
118
|
+
|
|
119
|
+
validateVideoResolution({
|
|
120
|
+
width: renderInfo.width,
|
|
121
|
+
height: renderInfo.height,
|
|
122
|
+
});
|
|
123
|
+
|
|
117
124
|
await processRenderInfo(renderInfo);
|
|
118
125
|
|
|
119
126
|
const doc = parseHTML(
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import ora from "ora";
|
|
3
|
+
import debug from "debug";
|
|
4
|
+
|
|
5
|
+
const log = debug("ef:cli:auth");
|
|
6
|
+
|
|
7
|
+
type VideoPayload = {
|
|
8
|
+
width: number;
|
|
9
|
+
height: number;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const schema = z
|
|
13
|
+
.object({
|
|
14
|
+
width: z.number().int(),
|
|
15
|
+
height: z.number().int(),
|
|
16
|
+
})
|
|
17
|
+
.refine((data) => data.width % 2 === 0 && data.height % 2 === 0, {
|
|
18
|
+
message: "Both width and height must be divisible by 2.",
|
|
19
|
+
path: ["width", "height"],
|
|
20
|
+
});
|
|
21
|
+
export const validateVideoResolution = async (rawPayload: VideoPayload) => {
|
|
22
|
+
const spinner = ora("Validating video resolution").start();
|
|
23
|
+
const result = schema.safeParse(rawPayload);
|
|
24
|
+
if (result.success) {
|
|
25
|
+
spinner.succeed("Video resolution is valid");
|
|
26
|
+
return result.data;
|
|
27
|
+
}
|
|
28
|
+
spinner.fail("Invalid video resolution");
|
|
29
|
+
process.stderr.write(result.error?.errors.map((e) => e.message).join("\n"));
|
|
30
|
+
process.stderr.write("\n");
|
|
31
|
+
log("Error:", result.error?.errors.map((e) => e.message).join("\n"));
|
|
32
|
+
process.exit(1);
|
|
33
|
+
};
|