🎥 Make videos programmatically with React
`@remotion/lambda`: throwIfSiteExists option
Jonny Burgerdd373abeaf82
diff --git a/packages/docs/docs/lambda/cli/sites.md b/packages/docs/docs/lambda/cli/sites.mddeleted file mode 100644index dfcd979ecb..0000000000--- a/packages/docs/docs/lambda/cli/sites.md+++ /dev/null@@ -1,297 +0,0 @@-----image: /generated/articles-docs-lambda-cli-sites.png-id: sites-sidebar_label: sites-title: "npx remotion lambda sites"-slug: /lambda/cli/sites-crumb: "Lambda CLI Reference"------The `npx remotion lambda sites` command allows to create, view and delete Remotion projects in your S3 bucket.--- [`create`](#create)-- [`ls`](#ls)-- [`rm`](#rm)-- [`rmall`](#rmall)--## create--```-npx remotion lambda sites create <entry-point>?-```--You may pass an [entry point](/docs/terminology/entry-point) as the first argument, otherwise the entry point will be [determined](/docs/terminology/entry-point#which-entry-point-is-being-used).--Bundle and upload a Remotion video to an S3 bucket.--The result will be a URL such as `https://remotionlambda-12345.s3.eu-central-1.amazonaws.com/sites/abcdef/index.html`.--:::note-If you make changes locally, you need to redeploy the site. Use [`--site-name`](#--site-name) to overwrite an existing site.-:::--You can use this "Serve URL" to render a video on Remotion Lambda using:--- The [`npx remotion lambda render`](/docs/lambda/cli/render) and [`npx remotion lambda still`](/docs/lambda/cli/still) commands-- The [`renderMediaOnLambda()`](/docs/lambda/rendermediaonlambda) and [`renderStillOnLambda()`](/docs/lambda/renderstillonlambda) functions.-- Locally using the [`renderMedia()`](/docs/renderer/render-media) and [`renderStill()`](/docs/renderer/render-still) functions.-- Locally using the [`npx remotion render`](/docs/cli) and [`npx remotion still`](/docs/cli) commands--If you are rendering on Lambda, you can also pass the site Name (in this case `abcdef`) as an abbreviation.--<details>-<summary>-Example output-</summary>-<pre>-(1/3) [====================] Bundled video 3975ms<br/>-(2/3) [====================] Created bucket 457ms<br/>-(3/3) [====================] Uploaded to S3 25118ms<br/>-<br/>-Deployed to S3!<br/>-Serve URL: https://remotionlambda-12345.s3.eu-central-1.amazonaws.com/sites/abcdef/index.html<br/>-Site Name: abcdef<br/>-</pre>-</details>--### `--region`--The [AWS region](/docs/lambda/region-selection) to select. Both project and function should be in this region.--### `--site-name`--Uploads the project to a specific directory and returns a deterministic URL. If a site already existed under this name, it will be overwritten. Can only contain the following characters: `0-9`, `a-z`, `A-Z`, `-`, `!`, `_`, `.`, `*`, `'`, `(`, `)`--```-npx remotion lambda sites create src/index.ts --site-name=my-project-```--### `--force-bucket-name`<AvailableFrom v="3.3.42" />--Specify a specific bucket name to be used. [This is not recommended](/docs/lambda/multiple-buckets), instead let Remotion discover the right bucket automatically.--### `--privacy`<AvailableFrom v="3.3.97" />--Either `public` (default) or `no-acl` if you are not using ACL. Sites must have a public URL to be able to be rendered on Lambda, since the headless browser opens that URL.--### `--public-dir`<AvailableFrom v="4.0.140" />--<Options id="public-dir" />--### `--enable-folder-expiry`<AvailableFrom v="4.0.32" />--<Options id="enable-folder-expiry"/>-<br/>-<br/>--<details>-<summary>-Example output-</summary>-<pre>-(1/3) [====================] Bundled video 3975ms<br/>-(2/3) [====================] Created bucket 457ms<br/>-(3/3) [====================] Uploaded to S3 25118ms<br/>-<br/>-Deployed to S3!<br/>-https://remotionlambda-12345.s3.eu-central-1.amazonaws.com/sites/my-project/index.html<br/>--</pre>-</details>--## ls--```-npx remotion lambda sites ls-```--Get a list of sites. The URL that is printed can be passed to the `render` command to render a video.--<details>-<summary>-Example output-</summary>-<pre>-Site Name Bucket Size Last updated<br/>-pr6fwglz05 remotionlambda-abcdefg 14.7 MB 2021-12-02<br/>-https://remotionlambda-abcdefg.s3.eu-central-1.amazonaws.com/sites/pr6fwglz05/index.html<br/><br/>-testbed remotionlambda-abcdefg 14.7 MB 2021-12-02 <br/>-https://remotionlambda-abcdefg.s3.eu-central-1.amazonaws.com/sites/testbed/index.html<br/>-</pre>-</details>--### `--region`--The [AWS region](/docs/lambda/region-selection) to select. Both project and function should be in this region.--### `--quiet`, `-q`--Returns only a list of space-separated sites.--```-npx remotion lambda sites ls -q-```--<details>-<summary>-Example output-</summary>-<pre>-pr6fwglz05 testbed<br/>-</pre>-</details>--## rm--Removes a site (or multiple) from S3 by its ID.--```bash-npx remotion lambda sites rm abcdef-npx remotion lambda sites rm abcdef my-project # multiple at once-```--<details>-<summary>-Example output-</summary>-<pre>Site abcdef in bucket remotionlambda-gc1w0xbfzl (14.7 MB): Delete? (Y/n): Y-<br/>Deleted sites/abcdef/052787b08233d85edebfc4ce4610944e.mp4-<br/>Deleted sites/abcdef/258.bundle.js-<br/>Deleted sites/abcdef/15.bundle.js-<br/>Deleted sites/abcdef/249.bundle.js.map-<br/>Deleted sites/abcdef/263.bundle.js-<br/>Deleted sites/abcdef/143.bundle.js-<br/>Deleted sites/abcdef/258.bundle.js.map-<br/>Deleted sites/abcdef/15.bundle.js.map-<br/>Deleted sites/abcdef/185.bundle.js.map-<br/>Deleted sites/abcdef/249.bundle.js-<br/>Deleted sites/abcdef/143.bundle.js.map-<br/>Deleted sites/abcdef/185.bundle.js-<br/>Deleted sites/abcdef/1f2d09019ff34eed846a5151b8561d5b.mp4-<br/>Deleted sites/abcdef/263.bundle.js.map-<br/>Deleted sites/abcdef/268.bundle.js-<br/>Deleted sites/abcdef/378.bundle.js.map-<br/>Deleted sites/abcdef/268.bundle.js.map-<br/>Deleted sites/abcdef/378.bundle.js-<br/>Deleted sites/abcdef/2b91c5234e41d3c36d4bf6df37876958.webm-<br/>Deleted sites/abcdef/450.bundle.js-<br/>Deleted sites/abcdef/46.bundle.js.map-<br/>Deleted sites/abcdef/46.bundle.js-<br/>Deleted sites/abcdef/450.bundle.js.map-<br/>Deleted sites/abcdef/534.bundle.js.map-<br/>Deleted sites/abcdef/569.bundle.js-<br/>Deleted sites/abcdef/3577958454aa99ad707b596f65151746.webm-<br/>Deleted sites/abcdef/534.bundle.js-<br/>Deleted sites/abcdef/575.bundle.js.map-<br/>Deleted sites/abcdef/575.bundle.js-<br/>Deleted sites/abcdef/569.bundle.js.map-<br/>Deleted sites/abcdef/801.bundle.js-<br/>Deleted sites/abcdef/7badbf53d3130d91b90c46181a2ecdc4.webm-<br/>Deleted sites/abcdef/801.bundle.js.map-<br/>Deleted sites/abcdef/873.bundle.js-<br/>Deleted sites/abcdef/98.bundle.js.map-<br/>Deleted sites/abcdef/bff822b868a2b87b31877f3606c9cc13.mp3-<br/>Deleted sites/abcdef/873.bundle.js.map-<br/>Deleted sites/abcdef/98.bundle.js-<br/>Deleted sites/abcdef/a2f36e3a48b4989e0da1fea9959fb35f.mp3-<br/>Deleted sites/abcdef/bundle.js-<br/>Deleted sites/abcdef/bundle.js.map-<br/>Deleted sites/abcdef/a7d87d9934059032eebb9c1536378a2a.webm-<br/>Deleted sites/abcdef/index.html-<br/>Deleted site abcdef and freed up 14.7 MB.-<br/>-</pre>-</details>--### `--region`--The [AWS region](/docs/lambda/region-selection) to select. Both project and function should be in this region.--### `--yes`, `-y`--Removes a site without asking for confirmation.--```-npx remotion lambda sites rm abcdef -y-```--### `--force-bucket-name`<AvailableFrom v="3.3.42" />--Specify a specific bucket name to be used. [This is not recommended](/docs/lambda/multiple-buckets), instead let Remotion discover the right bucket automatically.--## rmall--Remove all sites in the selected AWS region.--```bash-npx remotion lambda sites rmall-```--<details>-<summary>-Example output-</summary>-<pre>Site abcdef in bucket remotionlambda-gc1w0xbfzl (14.7 MB): Delete? (Y/n): Y-<br/>Deleted sites/abcdef/052787b08233d85edebfc4ce4610944e.mp4-<br/>Deleted sites/abcdef/258.bundle.js-<br/>Deleted sites/abcdef/15.bundle.js-<br/>Deleted sites/abcdef/249.bundle.js.map-<br/>Deleted sites/abcdef/263.bundle.js-<br/>Deleted sites/abcdef/143.bundle.js-<br/>Deleted sites/abcdef/258.bundle.js.map-<br/>Deleted sites/abcdef/15.bundle.js.map-<br/>Deleted sites/abcdef/185.bundle.js.map-<br/>Deleted sites/abcdef/249.bundle.js-<br/>Deleted sites/abcdef/143.bundle.js.map-<br/>Deleted sites/abcdef/185.bundle.js-<br/>Deleted sites/abcdef/1f2d09019ff34eed846a5151b8561d5b.mp4-<br/>Deleted sites/abcdef/263.bundle.js.map-<br/>Deleted sites/abcdef/268.bundle.js-<br/>Deleted sites/abcdef/378.bundle.js.map-<br/>Deleted sites/abcdef/268.bundle.js.map-<br/>Deleted sites/abcdef/378.bundle.js-<br/>Deleted sites/abcdef/2b91c5234e41d3c36d4bf6df37876958.webm-<br/>Deleted sites/abcdef/450.bundle.js-<br/>Deleted sites/abcdef/46.bundle.js.map-<br/>Deleted sites/abcdef/46.bundle.js-<br/>Deleted sites/abcdef/450.bundle.js.map-<br/>Deleted sites/abcdef/534.bundle.js.map-<br/>Deleted sites/abcdef/569.bundle.js-<br/>Deleted sites/abcdef/3577958454aa99ad707b596f65151746.webm-<br/>Deleted sites/abcdef/534.bundle.js-<br/>Deleted sites/abcdef/575.bundle.js.map-<br/>Deleted sites/abcdef/575.bundle.js-<br/>Deleted sites/abcdef/569.bundle.js.map-<br/>Deleted sites/abcdef/801.bundle.js-<br/>Deleted sites/abcdef/7badbf53d3130d91b90c46181a2ecdc4.webm-<br/>Deleted sites/abcdef/801.bundle.js.map-<br/>Deleted sites/abcdef/873.bundle.js-<br/>Deleted sites/abcdef/98.bundle.js.map-<br/>Deleted sites/abcdef/bff822b868a2b87b31877f3606c9cc13.mp3-<br/>Deleted sites/abcdef/873.bundle.js.map-<br/>Deleted sites/abcdef/98.bundle.js-<br/>Deleted sites/abcdef/a2f36e3a48b4989e0da1fea9959fb35f.mp3-<br/>Deleted sites/abcdef/bundle.js-<br/>Deleted sites/abcdef/bundle.js.map-<br/>Deleted sites/abcdef/a7d87d9934059032eebb9c1536378a2a.webm-<br/>Deleted sites/abcdef/index.html-<br/>Deleted site abcdef and freed up 14.7 MB.-<br/>-</pre>-</details>--### `--region`--The [AWS region](/docs/lambda/region-selection) to select. Both project and function should be in this region.--### `--yes`, `-y`--Removes all sites without asking for confirmation.--```-npx remotion lambda sites rmall -y-```--### `--force-bucket-name`<AvailableFrom v="3.3.42" />--Specify a specific bucket name to be used. [This is not recommended](/docs/lambda/multiple-buckets), instead let Remotion discover the right bucket automatically.diff --git a/packages/docs/docs/lambda/cli/sites.mdx b/packages/docs/docs/lambda/cli/sites.mdxnew file mode 100644index 0000000000..ccde86560f--- /dev/null+++ b/packages/docs/docs/lambda/cli/sites.mdx@@ -0,0 +1,379 @@+---+image: /generated/articles-docs-lambda-cli-sites.png+id: sites+sidebar_label: sites+title: "npx remotion lambda sites"+slug: /lambda/cli/sites+crumb: "Lambda CLI Reference"+---++The `npx remotion lambda sites` command allows to create, view and delete Remotion projects in your S3 bucket.++- [`create`](#create)+- [`ls`](#ls)+- [`rm`](#rm)+- [`rmall`](#rmall)++## create++```+npx remotion lambda sites create <entry-point>?+```++You may pass an [entry point](/docs/terminology/entry-point) as the first argument, otherwise the entry point will be [determined](/docs/terminology/entry-point#which-entry-point-is-being-used).++Bundle and upload a Remotion video to an S3 bucket.++The result will be a URL such as `https://remotionlambda-12345.s3.eu-central-1.amazonaws.com/sites/abcdef/index.html`.++:::note+If you make changes locally, you need to redeploy the site. Use [`--site-name`](#--site-name) to overwrite an existing site.+:::++You can use this "Serve URL" to render a video on Remotion Lambda using:++- The [`npx remotion lambda render`](/docs/lambda/cli/render) and [`npx remotion lambda still`](/docs/lambda/cli/still) commands+- The [`renderMediaOnLambda()`](/docs/lambda/rendermediaonlambda) and [`renderStillOnLambda()`](/docs/lambda/renderstillonlambda) functions.+- Locally using the [`renderMedia()`](/docs/renderer/render-media) and [`renderStill()`](/docs/renderer/render-still) functions.+- Locally using the [`npx remotion render`](/docs/cli) and [`npx remotion still`](/docs/cli) commands++If you are rendering on Lambda, you can also pass the site Name (in this case `abcdef`) as an abbreviation.++<details>+ <summary>Example output</summary>+ <pre>+ (1/3) [====================] Bundled video 3975ms+ <br />+ (2/3) [====================] Created bucket 457ms+ <br />+ (3/3) [====================] Uploaded to S3 25118ms+ <br />+ <br />+ Deployed to S3!+ <br />+ Serve URL: https://remotionlambda-12345.s3.eu-central-1.amazonaws.com/sites/abcdef/index.html+ <br />+ Site Name: abcdef+ <br />+ </pre>+</details>++### `--region`++The [AWS region](/docs/lambda/region-selection) to select. Both project and function should be in this region.++### `--site-name`++Uploads the project to a specific directory and returns a deterministic URL. If a site already existed under this name, it will be overwritten. Can only contain the following characters: `0-9`, `a-z`, `A-Z`, `-`, `!`, `_`, `.`, `*`, `'`, `(`, `)`++```+npx remotion lambda sites create src/index.ts --site-name=my-project+```++### `--force-bucket-name`<AvailableFrom v="3.3.42" />++Specify a specific bucket name to be used. [This is not recommended](/docs/lambda/multiple-buckets), instead let Remotion discover the right bucket automatically.++### `--privacy`<AvailableFrom v="3.3.97" />++Either `public` (default) or `no-acl` if you are not using ACL. Sites must have a public URL to be able to be rendered on Lambda, since the headless browser opens that URL.++### `--public-dir`<AvailableFrom v="4.0.140" />++<Options id="public-dir" />++### `--enable-folder-expiry`<AvailableFrom v="4.0.32" />++<Options id="enable-folder-expiry" />++### `--throw-if-site-exists`<AvailableFrom v="4.0.141"/>++<Options id="throw-if-site-exists" />+<br />+<br />+<hr />++## ls++```+npx remotion lambda sites ls+```++Get a list of sites. The URL that is printed can be passed to the `render` command to render a video.++<details>+ <summary>Example output</summary>+ <pre>+ Site Name Bucket Size Last updated+ <br />+ pr6fwglz05 remotionlambda-abcdefg 14.7 MB 2021-12-02+ <br />+ https://remotionlambda-abcdefg.s3.eu-central-1.amazonaws.com/sites/pr6fwglz05/index.html+ <br />+ <br />+ testbed remotionlambda-abcdefg 14.7 MB 2021-12-02 <br />+ https://remotionlambda-abcdefg.s3.eu-central-1.amazonaws.com/sites/testbed/index.html+ <br />+ </pre>+</details>++### `--region`++The [AWS region](/docs/lambda/region-selection) to select. Both project and function should be in this region.++### `--quiet`, `-q`++Returns only a list of space-separated sites.++```+npx remotion lambda sites ls -q+```++<details>+ <summary>Example output</summary>+ <pre>+ pr6fwglz05 testbed+ <br />+ </pre>+</details>++## rm++Removes a site (or multiple) from S3 by its ID.++```bash+npx remotion lambda sites rm abcdef+npx remotion lambda sites rm abcdef my-project # multiple at once+```++<details>+ <summary>Example output</summary>+ <pre>+ Site abcdef in bucket remotionlambda-gc1w0xbfzl (14.7 MB): Delete? (Y/n): Y+ <br />+ Deleted sites/abcdef/052787b08233d85edebfc4ce4610944e.mp4+ <br />+ Deleted sites/abcdef/258.bundle.js+ <br />+ Deleted sites/abcdef/15.bundle.js+ <br />+ Deleted sites/abcdef/249.bundle.js.map+ <br />+ Deleted sites/abcdef/263.bundle.js+ <br />+ Deleted sites/abcdef/143.bundle.js+ <br />+ Deleted sites/abcdef/258.bundle.js.map+ <br />+ Deleted sites/abcdef/15.bundle.js.map+ <br />+ Deleted sites/abcdef/185.bundle.js.map+ <br />+ Deleted sites/abcdef/249.bundle.js+ <br />+ Deleted sites/abcdef/143.bundle.js.map+ <br />+ Deleted sites/abcdef/185.bundle.js+ <br />+ Deleted sites/abcdef/1f2d09019ff34eed846a5151b8561d5b.mp4+ <br />+ Deleted sites/abcdef/263.bundle.js.map+ <br />+ Deleted sites/abcdef/268.bundle.js+ <br />+ Deleted sites/abcdef/378.bundle.js.map+ <br />+ Deleted sites/abcdef/268.bundle.js.map+ <br />+ Deleted sites/abcdef/378.bundle.js+ <br />+ Deleted sites/abcdef/2b91c5234e41d3c36d4bf6df37876958.webm+ <br />+ Deleted sites/abcdef/450.bundle.js+ <br />+ Deleted sites/abcdef/46.bundle.js.map+ <br />+ Deleted sites/abcdef/46.bundle.js+ <br />+ Deleted sites/abcdef/450.bundle.js.map+ <br />+ Deleted sites/abcdef/534.bundle.js.map+ <br />+ Deleted sites/abcdef/569.bundle.js+ <br />+ Deleted sites/abcdef/3577958454aa99ad707b596f65151746.webm+ <br />+ Deleted sites/abcdef/534.bundle.js+ <br />+ Deleted sites/abcdef/575.bundle.js.map+ <br />+ Deleted sites/abcdef/575.bundle.js+ <br />+ Deleted sites/abcdef/569.bundle.js.map+ <br />+ Deleted sites/abcdef/801.bundle.js+ <br />+ Deleted sites/abcdef/7badbf53d3130d91b90c46181a2ecdc4.webm+ <br />+ Deleted sites/abcdef/801.bundle.js.map+ <br />+ Deleted sites/abcdef/873.bundle.js+ <br />+ Deleted sites/abcdef/98.bundle.js.map+ <br />+ Deleted sites/abcdef/bff822b868a2b87b31877f3606c9cc13.mp3+ <br />+ Deleted sites/abcdef/873.bundle.js.map+ <br />+ Deleted sites/abcdef/98.bundle.js+ <br />+ Deleted sites/abcdef/a2f36e3a48b4989e0da1fea9959fb35f.mp3+ <br />+ Deleted sites/abcdef/bundle.js+ <br />+ Deleted sites/abcdef/bundle.js.map+ <br />+ Deleted sites/abcdef/a7d87d9934059032eebb9c1536378a2a.webm+ <br />+ Deleted sites/abcdef/index.html+ <br />+ Deleted site abcdef and freed up 14.7 MB.+ <br />+ </pre>+</details>++### `--region`++The [AWS region](/docs/lambda/region-selection) to select. Both project and function should be in this region.++### `--yes`, `-y`++Removes a site without asking for confirmation.++```+npx remotion lambda sites rm abcdef -y+```++### `--force-bucket-name`<AvailableFrom v="3.3.42" />++Specify a specific bucket name to be used. [This is not recommended](/docs/lambda/multiple-buckets), instead let Remotion discover the right bucket automatically.++## rmall++Remove all sites in the selected AWS region.++```bash+npx remotion lambda sites rmall+```++<details>+ <summary>Example output</summary>+ <pre>+ Site abcdef in bucket remotionlambda-gc1w0xbfzl (14.7 MB): Delete? (Y/n): Y+ <br />+ Deleted sites/abcdef/052787b08233d85edebfc4ce4610944e.mp4+ <br />+ Deleted sites/abcdef/258.bundle.js+ <br />+ Deleted sites/abcdef/15.bundle.js+ <br />+ Deleted sites/abcdef/249.bundle.js.map+ <br />+ Deleted sites/abcdef/263.bundle.js+ <br />+ Deleted sites/abcdef/143.bundle.js+ <br />+ Deleted sites/abcdef/258.bundle.js.map+ <br />+ Deleted sites/abcdef/15.bundle.js.map+ <br />+ Deleted sites/abcdef/185.bundle.js.map+ <br />+ Deleted sites/abcdef/249.bundle.js+ <br />+ Deleted sites/abcdef/143.bundle.js.map+ <br />+ Deleted sites/abcdef/185.bundle.js+ <br />+ Deleted sites/abcdef/1f2d09019ff34eed846a5151b8561d5b.mp4+ <br />+ Deleted sites/abcdef/263.bundle.js.map+ <br />+ Deleted sites/abcdef/268.bundle.js+ <br />+ Deleted sites/abcdef/378.bundle.js.map+ <br />+ Deleted sites/abcdef/268.bundle.js.map+ <br />+ Deleted sites/abcdef/378.bundle.js+ <br />+ Deleted sites/abcdef/2b91c5234e41d3c36d4bf6df37876958.webm+ <br />+ Deleted sites/abcdef/450.bundle.js+ <br />+ Deleted sites/abcdef/46.bundle.js.map+ <br />+ Deleted sites/abcdef/46.bundle.js+ <br />+ Deleted sites/abcdef/450.bundle.js.map+ <br />+ Deleted sites/abcdef/534.bundle.js.map+ <br />+ Deleted sites/abcdef/569.bundle.js+ <br />+ Deleted sites/abcdef/3577958454aa99ad707b596f65151746.webm+ <br />+ Deleted sites/abcdef/534.bundle.js+ <br />+ Deleted sites/abcdef/575.bundle.js.map+ <br />+ Deleted sites/abcdef/575.bundle.js+ <br />+ Deleted sites/abcdef/569.bundle.js.map+ <br />+ Deleted sites/abcdef/801.bundle.js+ <br />+ Deleted sites/abcdef/7badbf53d3130d91b90c46181a2ecdc4.webm+ <br />+ Deleted sites/abcdef/801.bundle.js.map+ <br />+ Deleted sites/abcdef/873.bundle.js+ <br />+ Deleted sites/abcdef/98.bundle.js.map+ <br />+ Deleted sites/abcdef/bff822b868a2b87b31877f3606c9cc13.mp3+ <br />+ Deleted sites/abcdef/873.bundle.js.map+ <br />+ Deleted sites/abcdef/98.bundle.js+ <br />+ Deleted sites/abcdef/a2f36e3a48b4989e0da1fea9959fb35f.mp3+ <br />+ Deleted sites/abcdef/bundle.js+ <br />+ Deleted sites/abcdef/bundle.js.map+ <br />+ Deleted sites/abcdef/a7d87d9934059032eebb9c1536378a2a.webm+ <br />+ Deleted sites/abcdef/index.html+ <br />+ Deleted site abcdef and freed up 14.7 MB.+ <br />+ </pre>+</details>++### `--region`++The [AWS region](/docs/lambda/region-selection) to select. Both project and function should be in this region.++### `--yes`, `-y`++Removes all sites without asking for confirmation.++```+npx remotion lambda sites rmall -y+```++### `--force-bucket-name`<AvailableFrom v="3.3.42" />++Specify a specific bucket name to be used. [This is not recommended](/docs/lambda/multiple-buckets), instead let Remotion discover the right bucket automatically.diff --git a/packages/docs/docs/lambda/deploysite.mdx b/packages/docs/docs/lambda/deploysite.mdxindex 266a0a72e4..ba5df8cb6b 100644--- a/packages/docs/docs/lambda/deploysite.mdx+++ b/packages/docs/docs/lambda/deploysite.mdx@@ -127,10 +127,9 @@ _available from v3.3.97_Either `public` (default) or `no-acl` if you are not using ACL. Sites must have a public URL to be able to be rendered on Lambda, since the headless browser opens that URL.-### `throwIfSiteExists`<AvailableFrom v="4.0.141"/>+### `throwIfSiteExists?`<AvailableFrom v="4.0.141"/>-Prevents accidential update of an existing site.-If there are any files in the subfolder where the site should be placed, this function will throw.+<Options id="throw-if-site-exists" />## Return valuediff --git a/packages/lambda/package.json b/packages/lambda/package.jsonindex 8a86032fd0..969d072381 100644--- a/packages/lambda/package.json+++ b/packages/lambda/package.json@@ -49,6 +49,7 @@"@types/mime-types": "2.1.1","@types/minimist": "1.2.2","@types/node": "18.14.6",+ "@types/react": "18.2.48","@types/prompt": "^1.1.0","eslint": "8.56.0","prettier": "3.2.5",diff --git a/packages/lambda/src/api/deploy-site.ts b/packages/lambda/src/api/deploy-site.tsindex a989b94974..0750ff59f1 100644--- a/packages/lambda/src/api/deploy-site.ts+++ b/packages/lambda/src/api/deploy-site.ts@@ -1,5 +1,6 @@import type {GitSource, WebpackOverrideFn} from '@remotion/bundler';-import type {LogLevel} from '@remotion/renderer';+import type {ToOptions} from '@remotion/renderer';+import type {BrowserSafeApis} from '@remotion/renderer/client';import {NoReactAPIs} from '@remotion/renderer/pure';import fs from 'node:fs';import {lambdaDeleteFile, lambdaLs} from '../functions/helpers/io';@@ -18,12 +19,15 @@ import {bucketExistsInRegion} from './bucket-exists';import type {UploadDirProgress} from './upload-dir';import {uploadDir} from './upload-dir';-export type DeploySiteInput = {+type MandatoryParameters = {entryPoint: string;bucketName: string;region: AwsRegion;- siteName?: string;- options?: {+};++type OptionalParameters = {+ siteName: string;+ options: {onBundleProgress?: (progress: number) => void;onUploadProgress?: (upload: UploadDirProgress) => void;webpackOverride?: WebpackOverrideFn;@@ -33,11 +37,12 @@ export type DeploySiteInput = {rootDir?: string;bypassBucketNameValidation?: boolean;};- privacy?: 'public' | 'no-acl';- gitSource?: GitSource | null;- logLevel?: LogLevel;- throwIfSiteExists?: boolean;-};+ privacy: 'public' | 'no-acl';+ gitSource: GitSource | null;+ indent: boolean;+} & ToOptions<typeof BrowserSafeApis.optionsMap.deploySiteLambda>;++export type DeploySiteInput = MandatoryParameters & Partial<OptionalParameters>;export type DeploySiteOutput = Promise<{serveUrl: string;@@ -49,27 +54,22 @@ export type DeploySiteOutput = Promise<{};}>;-const internalDeploySite = async ({+export const internalDeploySite = async ({bucketName,entryPoint,siteName,options,region,- privacy: passedPrivacy,+ privacy,gitSource,throwIfSiteExists,-}: DeploySiteInput & {- logLevel: LogLevel;- indent: boolean;-}): DeploySiteOutput => {+}: MandatoryParameters & OptionalParameters): DeploySiteOutput => {validateAwsRegion(region);validateBucketName(bucketName, {mustStartWithRemotion: !options?.bypassBucketNameValidation,});- const siteId = siteName ?? randomHash();- validateSiteName(siteId);- const privacy = passedPrivacy ?? 'public';+ validateSiteName(siteName);validatePrivacy(privacy, false);const accountId = await getAccountId({region});@@ -83,7 +83,7 @@ const internalDeploySite = async ({throw new Error(`No bucket with the name ${bucketName} exists`);}- const subFolder = getSitesKey(siteId);+ const subFolder = getSitesKey(siteName);const [files, bundled] = await Promise.all([lambdaLs({@@ -152,7 +152,7 @@ const internalDeploySite = async ({return {serveUrl: makeS3ServeUrl({bucketName, subFolder, region}),- siteName: siteId,+ siteName,stats: {uploadedFiles: toUpload.length,deletedFiles: toDelete.length,@@ -166,12 +166,13 @@ const deploySiteRaw = (args: DeploySiteInput) => {bucketName: args.bucketName,entryPoint: args.entryPoint,region: args.region,- gitSource: args.gitSource,- options: args.options,- privacy: args.privacy,- siteName: args.siteName,+ gitSource: args.gitSource ?? null,+ options: args.options ?? {},+ privacy: args.privacy ?? 'public',+ siteName: args.siteName ?? randomHash(),indent: false,logLevel: 'info',+ throwIfSiteExists: args.throwIfSiteExists ?? false,});};diff --git a/packages/lambda/src/cli/commands/sites/create.ts b/packages/lambda/src/cli/commands/sites/create.tsindex 7d65bc854e..2916337b40 100644--- a/packages/lambda/src/cli/commands/sites/create.ts+++ b/packages/lambda/src/cli/commands/sites/create.ts@@ -4,10 +4,11 @@ import type {LogLevel} from '@remotion/renderer';import {BrowserSafeApis} from '@remotion/renderer/client';import {NoReactInternals} from 'remotion/no-react';-import {deploySite} from '../../../api/deploy-site';import {internalGetOrCreateBucket} from '../../../api/get-or-create-bucket';+import {LambdaInternals} from '../../../internals';import type {Privacy} from '../../../shared/constants';import {BINARY_NAME} from '../../../shared/constants';+import {randomHash} from '../../../shared/random-hash';import {validateSiteName} from '../../../shared/validate-site-name';import {parsedLambdaCli} from '../../args';import {getAwsRegion} from '../../get-aws-region';@@ -26,7 +27,8 @@ import {Log} from '../../log';export const SITES_CREATE_SUBCOMMAND = 'create';-const {folderExpiryOption, publicDirOption} = BrowserSafeApis.options;+const {folderExpiryOption, publicDirOption, throwIfSiteExistsOption} =+ BrowserSafeApis.options;export const sitesCreateSubcommand = async (args: string[],@@ -132,9 +134,13 @@ export const sitesCreateSubcommand = async (commandLine: CliInternals.parsedCli,}).value;- const {serveUrl, siteName, stats} = await deploySite({+ const throwIfSiteExists = throwIfSiteExistsOption.getValue({+ commandLine: CliInternals.parsedCli,+ }).value;++ const {serveUrl, siteName, stats} = await LambdaInternals.internalDeploySite({entryPoint: file,- siteName: desiredSiteName,+ siteName: desiredSiteName ?? randomHash(),bucketName,options: {publicDir,@@ -164,9 +170,14 @@ export const sitesCreateSubcommand = async (bypassBucketNameValidation: Boolean(parsedLambdaCli['force-bucket-name']),},region: getAwsRegion(),- privacy: parsedLambdaCli.privacy as Exclude<Privacy, 'private'> | undefined,+ privacy:+ (parsedLambdaCli.privacy as Exclude<Privacy, 'private'>) ?? 'public',gitSource: null,+ indent: false,+ logLevel,+ throwIfSiteExists,});+const uploadDuration = Date.now() - uploadStart;multiProgress.deployProgress = {sizeUploaded: 1,diff --git a/packages/lambda/src/internals.ts b/packages/lambda/src/internals.tsindex 4a9f8f20b5..278d74f625 100644--- a/packages/lambda/src/internals.ts+++ b/packages/lambda/src/internals.ts@@ -1,3 +1,4 @@+import {internalDeploySite} from './api/deploy-site';import {getRenderProgressPayload,makeLambdaRenderMediaPayload,@@ -10,4 +11,5 @@ export const LambdaInternals = {makeLambdaRenderMediaPayload,getRenderProgressPayload,makeLambdaRenderStillPayload,+ internalDeploySite,};diff --git a/packages/renderer/src/options/index.tsx b/packages/renderer/src/options/index.tsxindex 0ac7e05ae9..1dfab10bc0 100644--- a/packages/renderer/src/options/index.tsx+++ b/packages/renderer/src/options/index.tsx@@ -28,6 +28,7 @@ import {publicPathOption} from './public-path';import {reproOption} from './repro';import {scaleOption} from './scale';import {separateAudioOption} from './separate-audio';+import {throwIfSiteExistsOption} from './throw-if-site-exists';import {delayRenderTimeoutInMillisecondsOption} from './timeout';import {videoBitrateOption} from './video-bitrate';import {videoCodecOption} from './video-codec';@@ -69,6 +70,7 @@ export const allOptions = {publicPathOption,publicDirOption,onBrowserDownloadOption,+ throwIfSiteExistsOption,};export type AvailableOptions = keyof typeof allOptions;diff --git a/packages/renderer/src/options/options-map.ts b/packages/renderer/src/options/options-map.tsindex afee6cff25..1c5c02f17e 100644--- a/packages/renderer/src/options/options-map.ts+++ b/packages/renderer/src/options/options-map.ts@@ -18,6 +18,7 @@ import {preferLosslessAudioOption} from './prefer-lossless';import {reproOption} from './repro';import {scaleOption} from './scale';import {separateAudioOption} from './separate-audio';+import {throwIfSiteExistsOption} from './throw-if-site-exists';import {delayRenderTimeoutInMillisecondsOption} from './timeout';import {videoBitrateOption} from './video-bitrate';import {videoCodecOption} from './video-codec';@@ -136,4 +137,8 @@ export const optionsMap = {logLevel: logLevelOption,onBrowserDownload: onBrowserDownloadOption,},+ deploySiteLambda: {+ logLevel: logLevelOption,+ throwIfSiteExists: throwIfSiteExistsOption,+ },} as const;diff --git a/packages/renderer/src/options/throw-if-site-exists.tsx b/packages/renderer/src/options/throw-if-site-exists.tsxnew file mode 100644index 0000000000..9432856155--- /dev/null+++ b/packages/renderer/src/options/throw-if-site-exists.tsx@@ -0,0 +1,31 @@+import type {AnyRemotionOption} from './option';++const DEFAULT = false;++const cliFlag = 'throw-if-site-exists';++export const throwIfSiteExistsOption = {+ cliFlag,+ description: () =>+ `Prevents accidential update of an existing site. If there are any files in the subfolder where the site should be placed, the function will throw.`,+ docLink: 'https://remotion.dev/docs/lambda/deploy-site',+ getValue: ({commandLine}) => {+ if (commandLine[cliFlag]) {+ return {+ source: 'cli',+ value: commandLine[cliFlag] as boolean,+ };+ }++ return {+ source: 'default',+ value: DEFAULT,+ };+ },+ name: 'Throw if site exists',+ setConfig: () => {+ throw new Error('Not implemented');+ },+ ssrName: 'throwIfSiteExists',+ type: false as boolean,+} satisfies AnyRemotionOption<boolean>;diff --git a/pnpm-lock.yaml b/pnpm-lock.yamlindex 1626a588fd..5c839fbbd3 100644--- a/pnpm-lock.yaml+++ b/pnpm-lock.yaml@@ -1310,6 +1310,9 @@ importers:'@types/prompt':specifier: ^1.1.0version: 1.1.2+ '@types/react':+ specifier: 18.2.48+ version: 18.2.48eslint:specifier: 8.56.0version: 8.56.0