Skip to content

🎥 Make videos programmatically with React

docs + specify out dir

Jonny Burger2f083a699c10
diff --git a/packages/cli/src/bundle.ts b/packages/cli/src/bundle.ts
index 056a9a2106..07d8a687f7 100644
--- a/packages/cli/src/bundle.ts
+++ b/packages/cli/src/bundle.ts
@@ -7,7 +7,7 @@ import {chalk} from './chalk';
import {findEntryPoint} from './entry-point';
import {getCliOptions} from './get-cli-options';
import {Log} from './log';
-import {quietFlagProvided} from './parse-command-line';
+import {parsedCli, quietFlagProvided} from './parse-command-line';
import {bundleOnCli} from './setup-cache';
import {shouldUseNonOverlayingLogger} from './should-use-non-overlaying-logger';
import {yesOrNo} from './yes-or-no';
@@ -51,7 +51,10 @@ export const bundleCommand = async (
logLevel,
});
- const outputPath = path.join(remotionRoot, 'build');
+ const outputPath = parsedCli['out-dir']
+ ? path.resolve(process.cwd(), parsedCli['out-dir'])
+ : path.join(remotionRoot, 'build');
+
const gitignoreFolder = BundlerInternals.findClosestFolderWithFile(
outputPath,
'.gitignore',
diff --git a/packages/cli/src/parse-command-line.ts b/packages/cli/src/parse-command-line.ts
index 57c2a36486..b79ab13c3e 100644
--- a/packages/cli/src/parse-command-line.ts
+++ b/packages/cli/src/parse-command-line.ts
@@ -87,6 +87,7 @@ type CommandLineOptions = {
['browser']: string;
['browser-args']: string;
['user-agent']: string;
+ ['out-dir']: string;
[deleteAfterOption.cliFlag]: string | undefined;
[folderExpiryOption.cliFlag]: boolean | undefined;
[enableMultiprocessOnLinuxOption.cliFlag]: boolean;
diff --git a/packages/docs/docs/cli/bundle.md b/packages/docs/docs/cli/bundle.md
new file mode 100644
index 0000000000..b8a77e2f1d
--- /dev/null
+++ b/packages/docs/docs/cli/bundle.md
@@ -0,0 +1,38 @@
+---
+image: /generated/articles-docs-cli-bundle.png
+title: npx remotion bundle
+sidebar_label: bundle
+crumb: CLI Reference
+---
+
+_available from v4.0.89_
+
+Creates a [Remotion Bundle](/docs/terminology#bundle) on the command line. Equivalent to the [`bundle()`](/docs/bundle) Node.JS API.
+
+```bash
+npx remotion bundle <entry-file?>
+```
+
+If `entry-file` is not passed, Remotion will try to detect the entry file with the following priority order:
+
+1. Get the path from the Config (Can be set using `Config.setEntryPoint("<entry-point>")`).
+2. Look for some common paths i.e. `src/index.ts`, `src/index.tsx`, `src/index.js`, `remotion/index.js`.
+3. Fail as entry point could not be determined.
+
+## Flags
+
+### `--config`
+
+Specify a location for the Remotion config file.
+
+### `--log`
+
+[Set the log level](/docs/config#setlevel). Increase or decrease the amount of output. Acceptable values: `error`, `warn`, `info` (_default_), `verbose`
+
+### `--public-dir`
+
+[Define the location of the `public/` directory.](/docs/config#setpublicdir). If not defined, Remotion will assume the location is the `public` folder in your Remotion root.
+
+### `--out-dir`
+
+Define the location of the resulting bundle. By default it is a folder called `./build`, adjacent to the [Remotion Root](/docs/terminology#remotion-root).
diff --git a/packages/docs/sidebars.js b/packages/docs/sidebars.js
index 179b28e404..2250e91fec 100644
--- a/packages/docs/sidebars.js
+++ b/packages/docs/sidebars.js
@@ -14,6 +14,7 @@ module.exports = {
"cli/render",
"cli/still",
"cli/compositions",
+ "cli/bundle",
{
type: "category",
label: "lambda",
diff --git a/packages/docs/src/data/articles.ts b/packages/docs/src/data/articles.ts
index 036999c0a6..8b201688a5 100644
--- a/packages/docs/src/data/articles.ts
+++ b/packages/docs/src/data/articles.ts
@@ -146,6 +146,13 @@ export const articles = [
compId: "articles-docs-cli-benchmark",
crumb: "CLI Reference",
},
+ {
+ id: "cli/bundle",
+ title: "npx remotion bundle",
+ relativePath: "docs/cli/bundle.md",
+ compId: "articles-docs-cli-bundle",
+ crumb: "CLI Reference",
+ },
{
id: "cli",
title: "Command line reference",
diff --git a/packages/docs/static/generated/articles-docs-cli-bundle.png b/packages/docs/static/generated/articles-docs-cli-bundle.png
new file mode 100644
index 0000000000..3875c201c6
Binary files /dev/null and b/packages/docs/static/generated/articles-docs-cli-bundle.png differ