🎥 Make videos programmatically with React
test: allow bundling
Jonny Burger721a0894aec0
diff --git a/packages/it-tests/package.json b/packages/it-tests/package.jsonindex ee2096f0ed..6325e9cce9 100644--- a/packages/it-tests/package.json+++ b/packages/it-tests/package.json@@ -14,6 +14,7 @@"@remotion/lambda": "workspace:*","@remotion/cloudrun": "workspace:*","@remotion/renderer": "workspace:*",+ "@remotion/compositor-darwin-arm64": "workspace:*","@types/sharp": "^0.28.5","create-video": "workspace:*","execa": "5.1.1",diff --git a/packages/it-tests/src/rendering/bundle-renderer.test.ts b/packages/it-tests/src/rendering/bundle-renderer.test.tsnew file mode 100644index 0000000000..d640982c85--- /dev/null+++ b/packages/it-tests/src/rendering/bundle-renderer.test.ts@@ -0,0 +1,34 @@+import { BundlerInternals } from "@remotion/bundler";+import { execSync } from "node:child_process";+import { ffmpegCwd, binaryPath } from "@remotion/compositor-darwin-arm64";+import { tmpdir } from "node:os";+import path from "node:path";+import { expect, test } from "vitest";+import { exampleVideos } from "./example-videos";+import { copyFileSync, cpSync, rmSync } from "node:fs";++test("Should be able to bundle the renderer", () => {+ const outputdir = path.join(tmpdir(), `test-${Math.random()}`);+ const outfile = path.join(outputdir, "esbuild-test.js");++ const { errors, warnings } = BundlerInternals.esbuild.buildSync({+ platform: "node",+ target: "node16",+ bundle: true,+ outfile,+ entryPoints: [`${__dirname}/test-index.ts`],+ });+ expect(errors.length).toBe(0);+ expect(warnings.length).toBe(0);+ copyFileSync(binaryPath, path.join(outputdir, path.basename(binaryPath)));+ cpSync(ffmpegCwd, path.join(outputdir, path.basename(ffmpegCwd)), {+ recursive: true,+ });++ const out = execSync("node " + outfile + " " + exampleVideos.bigBuckBunny);+ expect(out.toString("utf8")).toBe("h264\n");++ rmSync(outputdir, {+ recursive: true,+ });+});diff --git a/packages/it-tests/src/rendering/test-index.ts b/packages/it-tests/src/rendering/test-index.tsnew file mode 100644index 0000000000..ad6da26e5e--- /dev/null+++ b/packages/it-tests/src/rendering/test-index.ts@@ -0,0 +1,5 @@+import { getVideoMetadata } from "@remotion/renderer";++getVideoMetadata(process.argv[2]).then((metadata) => {+ console.log(metadata.codec);+});diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex e719fdd1dd..ca91c306be 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -1043,6 +1043,9 @@ importers:'@remotion/cloudrun':specifier: workspace:*version: link:../cloudrun+ '@remotion/compositor-darwin-arm64':+ specifier: workspace:*+ version: link:../compositor-darwin-arm64'@remotion/lambda':specifier: workspace:*version: link:../lambda