🎥 Make videos programmatically with React
resolve the public dir relative to the directory of the entry point
Jonny Burger4ae4014420c1
diff --git a/packages/bundler/src/bundle.ts b/packages/bundler/src/bundle.tsindex bc12a6d29c..6bcfa66406 100644--- a/packages/bundler/src/bundle.ts+++ b/packages/bundler/src/bundle.ts@@ -111,9 +111,29 @@ const convertArgumentsIntoOptions = (args: Arguments): BundleOptions => {return firstArg;};+const recursionLimit = 5;++const findClosestPackageJson = (currentDir: string): string | null => {+ let possiblePackageJson = '';+ for (let i = 0; i < recursionLimit; i++) {+ possiblePackageJson = path.join(currentDir, 'package.json');+ const exists = fs.existsSync(possiblePackageJson);+ if (exists) {+ return possiblePackageJson;+ }++ currentDir = path.dirname(currentDir);+ }++ return null;+};+export async function bundle(...args: Arguments): Promise<string> {const actualArgs = convertArgumentsIntoOptions(args);- const resolvedRemotionRoot = actualArgs?.rootDir ?? process.cwd();+ const resolvedRemotionRoot =+ actualArgs?.rootDir ??+ findClosestPackageJson(actualArgs.entryPoint) ??+ process.cwd();const outDir = await prepareOutDir(actualArgs?.outDir ?? null);