Skip to content

🎥 Make videos programmatically with React

standardising params as input name

Matt McGillivray087c84bda4a4
diff --git a/packages/cloudrun/src/api/create-bucket.ts b/packages/cloudrun/src/api/create-bucket.ts
index 6876e30f3f..823903d69c 100644
--- a/packages/cloudrun/src/api/create-bucket.ts
+++ b/packages/cloudrun/src/api/create-bucket.ts
@@ -8,8 +8,8 @@ type CreateBucketInput = {
/**
* @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.
+ * @param params.region The region for the bucket to be deployed to.
+ * @param params.bucketName The name of the bucket.
* @returns {Promise<void>} Nothing. Throws if the bucket creation failed.
*/
export const createBucket = async ({region, bucketName}: CreateBucketInput) => {
diff --git a/packages/cloudrun/src/api/delete-service.ts b/packages/cloudrun/src/api/delete-service.ts
index 82c3217a91..341367b0b8 100644
--- a/packages/cloudrun/src/api/delete-service.ts
+++ b/packages/cloudrun/src/api/delete-service.ts
@@ -8,17 +8,17 @@ export type DeleteServiceInput = {
/**
* @description Deletes a service from GCP Cloud Run
* @see [Documentation](https://remotion.dev/docs/cloudrun/deleteservice)
- * @param options.serviceName The name of the service to delete.
- * @param options.region The region of the service to delete.
+ * @param params.serviceName The name of the service to delete.
+ * @param params.region The region of the service to delete.
* @returns {Promise<void>} Nothing. Throws if the service failed to delete.
*/
export const deleteService = async (
- options: DeleteServiceInput
+ params: DeleteServiceInput
): Promise<void> => {
const cloudRunClient = getCloudRunClient();
// Run request
await cloudRunClient.deleteService({
- name: `projects/${process.env.REMOTION_GCP_PROJECT_ID}/locations/${options.region}/services/${options.serviceName}`,
+ name: `projects/${process.env.REMOTION_GCP_PROJECT_ID}/locations/${params.region}/services/${params.serviceName}`,
});
};
diff --git a/packages/cloudrun/src/api/delete-site.ts b/packages/cloudrun/src/api/delete-site.ts
index 613c99be6f..bdc90f4274 100644
--- a/packages/cloudrun/src/api/delete-site.ts
+++ b/packages/cloudrun/src/api/delete-site.ts
@@ -9,8 +9,8 @@ export type DeleteSiteInput = {
*
* @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.
+ * @param params.bucketName The name of the Cloud Storage bucket where the site resides in.
+ * @param params.siteName The ID of the site to delete.
* @returns {Promise<void>} Nothing. Throws if the site failed to delete.
*/
export const deleteSite = ({
diff --git a/packages/cloudrun/src/api/get-or-create-bucket.ts b/packages/cloudrun/src/api/get-or-create-bucket.ts
index 2e1f086d01..b23df792dc 100644
--- a/packages/cloudrun/src/api/get-or-create-bucket.ts
+++ b/packages/cloudrun/src/api/get-or-create-bucket.ts
@@ -21,13 +21,14 @@ 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/cloudrun/getorcreatebucket
- * @param options.region The region in which you want your Storage bucket to reside in.
+ * @param params.region The region in which you want your Storage bucket to reside in.
+ * @param params.updateBucketState A function that gets called whenever the state of the bucket changes. This is useful for CLI updates.
* @returns {Promise<GetOrCreateBucketOutput>} An object containing the `bucketName`.
*/
export const getOrCreateBucket = async (
- options: GetOrCreateBucketInput
+ params: GetOrCreateBucketInput
): Promise<GetOrCreateBucketOutput> => {
- const {remotionBuckets} = await getRemotionStorageBuckets(options.region);
+ const {remotionBuckets} = await getRemotionStorageBuckets(params.region);
if (remotionBuckets.length > 1) {
throw new Error(
@@ -38,22 +39,22 @@ export const getOrCreateBucket = async (
}
if (remotionBuckets.length === 1) {
- options?.updateBucketState?.('Using existing bucket');
+ params?.updateBucketState?.('Using existing bucket');
return {
bucketName: remotionBuckets[0].name,
};
}
- if (options?.region) {
- options.updateBucketState?.('Creating new bucket');
+ if (params?.region) {
+ params.updateBucketState?.('Creating new bucket');
const bucketName = makeBucketName();
await createBucket({
bucketName,
- region: options.region,
+ region: params.region,
});
- options.updateBucketState?.('Created bucket');
+ params.updateBucketState?.('Created bucket');
return {bucketName};
}
diff --git a/packages/cloudrun/src/api/get-service-info.ts b/packages/cloudrun/src/api/get-service-info.ts
index ec820f9aeb..5a0a4c6578 100644
--- a/packages/cloudrun/src/api/get-service-info.ts
+++ b/packages/cloudrun/src/api/get-service-info.ts
@@ -20,8 +20,8 @@ export type GetServiceInfoInput = {
/**
* @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.
+ * @param params.region The region in which the service resides in.
+ * @param params.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/get-services.ts b/packages/cloudrun/src/api/get-services.ts
index b0737846d0..3fa9af93fa 100644
--- a/packages/cloudrun/src/api/get-services.ts
+++ b/packages/cloudrun/src/api/get-services.ts
@@ -42,15 +42,15 @@ type v1Data = {
/**
* @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.
+ * @param params.region The region of which the services should be listed.
+ * @param params.compatibleOnly Whether only services compatible with the installed version of Remotion Cloud Run should be returned.
* @returns {Promise<ServiceInfo[]>} An array with the objects containing information about the deployed services.
*/
export const getServices = async (
- options: GetServicesInput
+ params: GetServicesInput
): Promise<ServiceInfo[]> => {
- if (options.region === 'all regions') {
+ if (params.region === 'all regions') {
const cloudRunEndpoint = `https://run.googleapis.com/apis/serving.knative.dev/v1/namespaces/${process.env.REMOTION_GCP_PROJECT_ID}/services`;
const client = new JWT({
@@ -87,7 +87,7 @@ export const getServices = async (
const cloudRunClient = getCloudRunClient();
- const parent = `projects/${process.env.REMOTION_GCP_PROJECT_ID}/locations/${options.region}`;
+ const parent = `projects/${process.env.REMOTION_GCP_PROJECT_ID}/locations/${params.region}`;
const [services] = await cloudRunClient.listServices({
parent,
@@ -95,7 +95,7 @@ export const getServices = async (
let remotionServices: IService[] = [];
- if (options.compatibleOnly) {
+ if (params.compatibleOnly) {
remotionServices = services.filter((s) => {
return s.name?.startsWith(
`${parent}/services/${RENDER_SERVICE_PREFIX}--${serviceVersionString()}--`
diff --git a/packages/cloudrun/src/api/iam-validation/testPermissions.ts b/packages/cloudrun/src/api/iam-validation/testPermissions.ts
index 0b06cf9e4b..1bfee798dd 100644
--- a/packages/cloudrun/src/api/iam-validation/testPermissions.ts
+++ b/packages/cloudrun/src/api/iam-validation/testPermissions.ts
@@ -23,11 +23,11 @@ type TestPermissionsOutput = {
* @description Test the permissions on the service account match the permissions required.
* @see [Remotion-Documentation](http://remotion.dev/docs/cloudrun/testpermissions)
* @see [Cloudrun-Documentation](https://cloud.google.com/resource-manager/reference/rest/v1/projects/testIamPermissions)
- * @param {(result: TestResult) => void} options.onTest Function to run on each test result
+ * @param {(result: TestResult) => void} params.onTest Function to run on each test result
* @returns {Promise<TestPermissionsOutput>} Returns array of TestResult objects
*/
export const testPermissions = async (
- options: TestPermissionsInput
+ params: TestPermissionsInput
): Promise<TestPermissionsOutput> => {
const auth = new GoogleAuth({
credentials: {
@@ -67,11 +67,11 @@ export const testPermissions = async (
if (response?.data?.permissions.includes(permission)) {
const thisResult = {decision: true, permissionName: permission};
results.push(thisResult);
- options.onTest?.(thisResult);
+ params.onTest?.(thisResult);
} else {
const thisResult = {decision: false, permissionName: permission};
results.push(thisResult);
- options.onTest?.(thisResult);
+ params.onTest?.(thisResult);
}
});