Skip to content

🎥 Make videos programmatically with React

updating jsdoc comments

Matt McGillivrayf8156f592ec0
diff --git a/packages/cloudrun/src/api/create-bucket.ts b/packages/cloudrun/src/api/create-bucket.ts
index 140384be1e..6876e30f3f 100644
--- a/packages/cloudrun/src/api/create-bucket.ts
+++ b/packages/cloudrun/src/api/create-bucket.ts
@@ -1,13 +1,18 @@
import type {GcpRegion} from '../pricing/gcp-regions';
import {getCloudStorageClient} from './helpers/get-cloud-storage-client';
-export const createBucket = async ({
- region,
- bucketName,
-}: {
+type CreateBucketInput = {
region: GcpRegion;
bucketName: string;
-}) => {
+};
+
+/**
+ * @description Creates a bucket for GCP Cloud Run.
+ * @param options.region The region for the bucket to be deployed to.
+ * @param options.bucketName The name of the bucket.
+ * @returns {Promise<void>} Nothing. Throws if the bucket creation failed.
+ */
+export const createBucket = async ({region, bucketName}: CreateBucketInput) => {
const cloudStorageClient = getCloudStorageClient();
// metadata: https://googleapis.dev/nodejs/storage/latest/global.html#CreateBucketRequest
diff --git a/packages/cloudrun/src/api/delete-site.ts b/packages/cloudrun/src/api/delete-site.ts
index 6fb3c049a0..613c99be6f 100644
--- a/packages/cloudrun/src/api/delete-site.ts
+++ b/packages/cloudrun/src/api/delete-site.ts
@@ -7,7 +7,7 @@ export type DeleteSiteInput = {
/**
*
- * @description Deletes a deployed site from your S3 bucket. The opposite of deploySite().
+ * @description Deletes a deployed site from your Cloud Run bucket. The opposite of deploySite().
* @see [Documentation](https://remotion.dev/docs/cloudrun/deletesite)
* @param options.bucketName The name of the Cloud Storage bucket where the site resides in.
* @param options.siteName The ID of the site to delete.
diff --git a/packages/cloudrun/src/api/deploy-service.ts b/packages/cloudrun/src/api/deploy-service.ts
index 094d8d961b..33a492cb9f 100644
--- a/packages/cloudrun/src/api/deploy-service.ts
+++ b/packages/cloudrun/src/api/deploy-service.ts
@@ -24,14 +24,17 @@ export type DeployServiceOutput = {
/**
* @description Creates a Cloud Run service in your project that will be able to render a video in GCP.
- * @link https://remotion.dev/docs/lambda/deployfunction
- * @param remotionVersion Which version of Remotion to use within the Cloud Run service.
- * @param projectID GCP Project ID to deploy the Cloud Run service to.
- * @param region The region you want to deploy your Cloud Run service to.
- * @returns {Promise<IService>} An object that contains the `functionName` property
+ * @link https://remotion.dev/docs/cloudrun/deployservice
+ * @param params.performImageVersionValidation Validate that an image exists in the public Artifact Registry that matches the Remotion Version. Default true
+ * @param params.memoryLimit Memory limit of Cloud Run service to deploy.
+ * @param params.cpuLimit CPU limit of Cloud Run service to deploy.
+ * @param params.timeoutSeconds After how many seconds the Cloud Run service should be killed if it does not end itself.
+ * @param params.projectID GCP Project ID to deploy the Cloud Run service to.
+ * @param params.region GCP region to deploy the Cloud Run service to.
+ * @returns {Promise<DeployServiceOutput>} See documentation for detailed structure
*/
export const deployService = async ({
- performImageVersionValidation = true, // default value set here
+ performImageVersionValidation = true,
memoryLimit,
cpuLimit,
timeoutSeconds,
diff --git a/packages/cloudrun/src/api/deploy-site.ts b/packages/cloudrun/src/api/deploy-site.ts
index a1f512560c..9d3d22977d 100644
--- a/packages/cloudrun/src/api/deploy-site.ts
+++ b/packages/cloudrun/src/api/deploy-site.ts
@@ -44,8 +44,8 @@ export type DeploySiteOutput = Promise<{
* @param {object} params.options Further options, see documentation page for this function.
*/
export const deploySite = async ({
- bucketName,
entryPoint,
+ bucketName,
siteName,
options,
}: DeploySiteInput): DeploySiteOutput => {
diff --git a/packages/cloudrun/src/api/download-file.ts b/packages/cloudrun/src/api/download-file.ts
index 3d5efcd7fd..93686338dd 100644
--- a/packages/cloudrun/src/api/download-file.ts
+++ b/packages/cloudrun/src/api/download-file.ts
@@ -1,6 +1,14 @@
import fs from 'fs';
import {getCloudStorageClient} from './helpers/get-cloud-storage-client';
+/**
+ * @description Downloads a file from a GCP storage bucket.
+ * @see [Documentation](https://remotion.dev/docs/lambda/downloadmedia)
+ * @param params.bucketName The name of the bucket to download the file from.
+ * @param params.gsutilURI The Google Cloud Storage URL of the file to download.
+ * @param params.downloadName The name of the file once downloaded.
+ * @returns {void}
+ */
export const downloadFile = async ({
bucketName,
gsutilURI,
diff --git a/packages/cloudrun/src/api/get-buckets.ts b/packages/cloudrun/src/api/get-buckets.ts
index d25a3bd74e..22172e337e 100644
--- a/packages/cloudrun/src/api/get-buckets.ts
+++ b/packages/cloudrun/src/api/get-buckets.ts
@@ -3,6 +3,11 @@ import type {GcpRegion} from '../pricing/gcp-regions';
import {REMOTION_BUCKET_PREFIX} from '../shared/constants';
import {getCloudStorageClient} from './helpers/get-cloud-storage-client';
+/**
+ * @description Get a list of all buckets that were created by Remotion.
+ * @param params.region GCP region to check. If not passed, all regions will be checked.
+ * @returns {Promise<Bucket[]>} List of buckets returned by GCP.
+ */
export const getRemotionStorageBuckets = async (
region: GcpRegion | 'all regions'
): Promise<{
diff --git a/packages/cloudrun/src/api/get-or-create-bucket.ts b/packages/cloudrun/src/api/get-or-create-bucket.ts
index d620429c48..2e1f086d01 100644
--- a/packages/cloudrun/src/api/get-or-create-bucket.ts
+++ b/packages/cloudrun/src/api/get-or-create-bucket.ts
@@ -20,7 +20,7 @@ export type GetOrCreateBucketOutput = {
};
/**
* @description Creates a bucket for Remotion Cloud Run in your GCP Project, in a particular region. If one already exists, it will get returned instead.
- * @link https://remotion.dev/docs/lambda/getorcreatebucket
+ * @link https://remotion.dev/docs/cloudrun/getorcreatebucket
* @param options.region The region in which you want your Storage bucket to reside in.
* @returns {Promise<GetOrCreateBucketOutput>} An object containing the `bucketName`.
*/
diff --git a/packages/cloudrun/src/api/get-regions.ts b/packages/cloudrun/src/api/get-regions.ts
index fe94f56720..78f95f035c 100644
--- a/packages/cloudrun/src/api/get-regions.ts
+++ b/packages/cloudrun/src/api/get-regions.ts
@@ -4,7 +4,7 @@ import {GCP_REGIONS} from '../regions';
/**
* @description Gets an array of all supported GCP regions of this release of Remotion Cloudrun.
* @see [Documentation](https://remotion.dev/docs/cloudrun/getregions)
- * @returns {AwsRegion[]} A list of GCP regions.
+ * @returns {GcpRegion[]} A list of GCP regions.
*/
export const getRegions = (): readonly GcpRegion[] => {
return GCP_REGIONS;
diff --git a/packages/cloudrun/src/api/get-service-info.ts b/packages/cloudrun/src/api/get-service-info.ts
index 6a672a39c8..ec820f9aeb 100644
--- a/packages/cloudrun/src/api/get-service-info.ts
+++ b/packages/cloudrun/src/api/get-service-info.ts
@@ -18,10 +18,10 @@ export type GetServiceInfoInput = {
serviceName: string;
};
/**
- * @description Lists Remotion Cloud Run render services deployed to GCP Cloud Run.
- * @see [Documentation](https://remotion.dev/docs/cloudrun/getservices)
- * @param options.region The region of which the services should be listed.
- * @param options.compatibleOnly Whether only services compatible with the installed version of Remotion Cloud Run should be returned.
+ * @description Given a region and service name, returns information about the service such as version, memory limit and timeout.
+ * @see [Documentation](https://remotion.dev/docs/cloudrun/getserviceinfo)
+ * @param options.region The region in which the service resides in.
+ * @param options.serviceName The name of the service.
* @returns {Promise<ServiceInfo[]>} An array with the objects containing information about the deployed services.
*/
diff --git a/packages/cloudrun/src/api/render-media-on-cloudrun.ts b/packages/cloudrun/src/api/render-media-on-cloudrun.ts
index 79c90e18fc..3cd75fa779 100644
--- a/packages/cloudrun/src/api/render-media-on-cloudrun.ts
+++ b/packages/cloudrun/src/api/render-media-on-cloudrun.ts
@@ -60,16 +60,35 @@ export type RenderMediaOnCloudrunInput = {
/**
* @description Triggers a render on a GCP Cloud Run service given a composition and a Cloud Run URL.
* @see [Documentation](https://remotion.dev/docs/lambda/renderMediaOnGcp)
- * @param params.authenticatedRequest If this is an authenticated request, .env file will be checked for GCP credentials
- * @param params.cloudRunUrl The url of the Cloud Run service that should be used
- * @param params.serviceName The name of the Cloud Run service that should be used
+ * @param params.cloudRunUrl The URL of the Cloud Run service that should be used. Use either this or serviceName.
+ * @param params.serviceName The name of the Cloud Run service that should be used. Use either this or cloudRunUrl.
+ * @param params.region The region that the Cloud Run service is deployed in.
* @param params.serveUrl The URL of the deployed project
* @param params.composition The ID of the composition which should be rendered.
* @param params.inputProps The input props that should be passed to the composition.
* @param params.codec The media codec which should be used for encoding.
- * @param params.outputBucket The name of the GCP Storage Bucket that will store the rendered media output.
- * @param params.outputFolderPath The folder path of the GCP Storage Bucket that will store the rendered media output.
- * @param params.outName The file name of the rendered media output.
+ * @param params.outputBucket The name of the bucket that the output file should be uploaded to.
+ * @param params.privacy Whether the output file should be public or private.
+ * @param params.outputFile The name of the output file.
+ * @param params.updateRenderProgress A callback that is called with the progress of the render.
+ * @param params.jpegQuality JPEG quality if JPEG was selected as the image format.
+ * @param params.audioCodec The encoding of the audio of the output video.
+ * @param params.audioBitrate The target bitrate for the audio of the generated video.
+ * @param params.videoBitrate The target bitrate of the generated video.
+ * @param params.proResProfile Sets a ProRes profile. Only applies to videos rendered with prores codec.
+ * @param params.crf Constant Rate Factor, controlling the quality.
+ * @param params.pixelFormat Custom pixel format to use. Usually used for special use cases like transparent videos.
+ * @param params.imageFormat Which image format the frames should be rendered in.
+ * @param params.scale Scales the output dimensions by a factor.
+ * @param params.everyNthFrame Only used if rendering gigs - renders only every nth frame.
+ * @param params.numberOfGifLoops Only used if rendering gigs - how many times the gif should loop. Null means infinite.
+ * @param params.frameRange Specify a single frame (a number) or a range of frames (a tuple [number, number]) to be rendered.
+ * @param params.envVariables Object containing environment variables to be injected in your project.
+ * @param params.chromiumOptions Allows you to set certain Chromium / Google Chrome flags.
+ * @param params.muted If set to true, no audio is rendered.
+ * @param params.forceWidth Overrides default composition width.
+ * @param params.forceHeight Overrides default composition height.
+ * @param params.logLevel Level of logging that Cloud Run service should perform. Default "info".
* @returns {Promise<RenderMediaOnCloudrunOutput>} See documentation for detailed structure
*/
diff --git a/packages/cloudrun/src/api/render-still-on-cloudrun.ts b/packages/cloudrun/src/api/render-still-on-cloudrun.ts
index 30c873b4e2..483d65d719 100644
--- a/packages/cloudrun/src/api/render-still-on-cloudrun.ts
+++ b/packages/cloudrun/src/api/render-still-on-cloudrun.ts
@@ -36,15 +36,24 @@ export type RenderStillOnCloudrunInput = {
/**
* @description Triggers a render on a GCP Cloud Run service given a composition and a Cloud Run URL.
* @see [Documentation](https://remotion.dev/docs/cloudrun/renderstilloncloudrun)
- * @param params.authenticatedRequest If this is an authenticated request, .env file will be checked for GCP credentials
- * @param params.cloudRunUrl The url of the Cloud Run service that should be used
- * @param params.serviceName The name of the Cloud Run service that should be used
+ * @param params.cloudRunUrl The URL of the Cloud Run service that should be used. Use either this or serviceName.
+ * @param params.serviceName The name of the Cloud Run service that should be used. Use either this or cloudRunUrl.
+ * @param params.region The region that the Cloud Run service is deployed in.
* @param params.serveUrl The URL of the deployed project
* @param params.composition The ID of the composition which should be rendered.
* @param params.inputProps The input props that should be passed to the composition.
- * @param params.outputBucket The name of the GCP Storage Bucket that will store the rendered media output.
- * @param params.outputFolderPath The folder path of the GCP Storage Bucket that will store the rendered media output.
- * @param params.outName The file name of the rendered media output.
+ * @param params.outputBucket The name of the bucket that the output file should be uploaded to.
+ * @param params.privacy Whether the output file should be public or private.
+ * @param params.outputFile The name of the output file.
+ * @param params.imageFormat Which image format the frame should be rendered in.
+ * @param params.envVariables Object containing environment variables to be injected in your project.
+ * @param params.frame Which frame of the composition should be rendered. Frames are zero-indexed.
+ * @param params.jpegQuality JPEG quality if JPEG was selected as the image format.
+ * @param params.chromiumOptions Allows you to set certain Chromium / Google Chrome flags.
+ * @param params.scale Scales the output dimensions by a factor.
+ * @param params.forceWidth Overrides default composition width.
+ * @param params.forceHeight Overrides default composition height.
+ * @param params.logLevel Level of logging that Cloud Run service should perform. Default "info".
* @returns {Promise<RenderStillOnCloudrunOutput>} See documentation for detailed structure
*/
diff --git a/packages/cloudrun/src/api/speculate-service-name.ts b/packages/cloudrun/src/api/speculate-service-name.ts
index 9229b74ba7..eda11a412d 100644
--- a/packages/cloudrun/src/api/speculate-service-name.ts
+++ b/packages/cloudrun/src/api/speculate-service-name.ts
@@ -1,15 +1,14 @@
import {generateServiceName} from '../shared/generate-service-name';
/**
- * @description Speculate the name of a cloud run service that will be created when you call `deployService`, based on the service configuration.
+ * @description Speculate the name of a Cloud Run service that will be created when you call `deployService`, based on the service configuration.
* @see [Documentation](https://www.remotion.dev/docs/cloudrun/speculateservicename)
* @param memoryLimit The upper bound on the amount of RAM that the Cloud Run service can consume.
* @param cpuLimit The maximum number of CPU cores that the Cloud Run service can use to process requests.
* @param timeoutInSeconds How long the Cloud Run Service may run before it gets killed.
- * @param remotionVersion The Remotion version of the service.
- * @returns {string} The speculated cloud run service name
+ * @returns {string} The speculated Cloud Run service name
*/
-export const speculateFunctionName = ({
+export const speculateServiceName = ({
memoryLimit,
cpuLimit,
timeoutSeconds,
diff --git a/packages/cloudrun/src/gcpInstaller/gcpInstaller.tar b/packages/cloudrun/src/gcpInstaller/gcpInstaller.tar
index 2a4ccd99e3..91eae6b0aa 100644
Binary files a/packages/cloudrun/src/gcpInstaller/gcpInstaller.tar and b/packages/cloudrun/src/gcpInstaller/gcpInstaller.tar differ
diff --git a/packages/cloudrun/src/gcpInstaller/installerScripts/tasks/setupGcpProject.mts b/packages/cloudrun/src/gcpInstaller/installerScripts/tasks/setupGcpProject.mts
index 0fc201da8a..4040d16194 100644
--- a/packages/cloudrun/src/gcpInstaller/installerScripts/tasks/setupGcpProject.mts
+++ b/packages/cloudrun/src/gcpInstaller/installerScripts/tasks/setupGcpProject.mts
@@ -301,7 +301,7 @@ export async function setupGcpProject(projectID: string) {
}
);
- // If cloud run service already in tfstate file, skip this step. Otherwise, import it to the state file
+ // If Cloud Run service already in tfstate file, skip this step. Otherwise, import it to the state file
try {
execSync('terraform state list google_project_service.cloud_run', {
stdio: 'pipe',