feat: initial commit - Jhonny Editor
- Adicionado estrutura completa do projeto - Configurado MCP server para Premiere Pro - Adicionado documentação e skills - Configurado Gitignore para o projeto
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { gzipSync } from "node:zlib";
|
||||
|
||||
const outputDirectory = path.resolve(process.cwd(), "out");
|
||||
const homeDocument = path.join(outputDirectory, "index.html");
|
||||
const initialJavaScriptGzipBudget = 240_000;
|
||||
const homeDocumentGzipBudget = 75_000;
|
||||
|
||||
if (!fs.existsSync(homeDocument)) {
|
||||
throw new Error("Landing output is missing. Run next build before checking the performance budget.");
|
||||
}
|
||||
|
||||
const document = fs.readFileSync(homeDocument, "utf8");
|
||||
const scriptSources = [...document.matchAll(/<script[^>]+src="([^"]+)"/g)]
|
||||
.map((match) => match[1])
|
||||
.filter((source) => source.startsWith("/_next/"));
|
||||
const uniqueSources = [...new Set(scriptSources)];
|
||||
|
||||
let initialJavaScriptGzipBytes = 0;
|
||||
for (const source of uniqueSources) {
|
||||
const assetPath = path.resolve(outputDirectory, `.${source}`);
|
||||
if (!assetPath.startsWith(`${outputDirectory}${path.sep}`) || !fs.existsSync(assetPath)) {
|
||||
throw new Error(`Referenced initial JavaScript asset is missing: ${source}`);
|
||||
}
|
||||
initialJavaScriptGzipBytes += gzipSync(fs.readFileSync(assetPath)).byteLength;
|
||||
}
|
||||
|
||||
const homeDocumentGzipBytes = gzipSync(document).byteLength;
|
||||
const report = {
|
||||
initialJavaScriptGzipBytes,
|
||||
initialJavaScriptGzipBudget,
|
||||
homeDocumentGzipBytes,
|
||||
homeDocumentGzipBudget,
|
||||
initialScriptCount: uniqueSources.length,
|
||||
};
|
||||
|
||||
console.log(`[landing-performance] ${JSON.stringify(report)}`);
|
||||
|
||||
if (initialJavaScriptGzipBytes > initialJavaScriptGzipBudget) {
|
||||
throw new Error(`Initial JavaScript gzip budget exceeded: ${initialJavaScriptGzipBytes} > ${initialJavaScriptGzipBudget}`);
|
||||
}
|
||||
if (homeDocumentGzipBytes > homeDocumentGzipBudget) {
|
||||
throw new Error(`Home document gzip budget exceeded: ${homeDocumentGzipBytes} > ${homeDocumentGzipBudget}`);
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
import { execFileSync } from "node:child_process"
|
||||
import { mkdirSync, rmSync } from "node:fs"
|
||||
import { fileURLToPath } from "node:url"
|
||||
import path from "node:path"
|
||||
|
||||
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..")
|
||||
const source = path.join(root, "video-src", "demo.html")
|
||||
const frames = path.join(root, ".demo-frames")
|
||||
const output = path.join(root, "public", "premiere-pro-mcp-demo.mp4")
|
||||
const poster = path.join(root, "public", "premiere-pro-mcp-demo-poster.png")
|
||||
const chrome = "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
|
||||
const total = 120
|
||||
|
||||
rmSync(frames, { recursive: true, force: true })
|
||||
mkdirSync(frames, { recursive: true })
|
||||
|
||||
for (let frame = 0; frame < total; frame += 1) {
|
||||
const screenshot = path.join(frames, `${String(frame).padStart(4, "0")}.png`)
|
||||
const url = `file://${source}?frame=${frame}&total=${total}`
|
||||
execFileSync(chrome, [
|
||||
"--headless=new",
|
||||
"--hide-scrollbars",
|
||||
"--disable-gpu",
|
||||
"--no-first-run",
|
||||
"--window-size=1280,720",
|
||||
`--screenshot=${screenshot}`,
|
||||
url,
|
||||
], { stdio: "ignore" })
|
||||
}
|
||||
|
||||
execFileSync("ffmpeg", [
|
||||
"-y",
|
||||
"-framerate", "12",
|
||||
"-i", path.join(frames, "%04d.png"),
|
||||
"-vf", "fps=24,format=yuv420p",
|
||||
"-c:v", "libx264",
|
||||
"-preset", "slow",
|
||||
"-crf", "20",
|
||||
"-movflags", "+faststart",
|
||||
output,
|
||||
], { stdio: "inherit" })
|
||||
|
||||
execFileSync("ffmpeg", [
|
||||
"-y",
|
||||
"-i", output,
|
||||
"-ss", "00:00:08.5",
|
||||
"-frames:v", "1",
|
||||
poster,
|
||||
], { stdio: "ignore" })
|
||||
|
||||
rmSync(frames, { recursive: true, force: true })
|
||||
console.log(`Rendered ${output}`)
|
||||
Reference in New Issue
Block a user