🎥 Make videos programmatically with React
fix typescript errors in install script
Jonny Burgere008e65ae484
diff --git a/packages/cloudrun/gcpInstaller/install.mts b/packages/cloudrun/gcpInstaller/install.mtsindex 408113eec1..052025918c 100644--- a/packages/cloudrun/gcpInstaller/install.mts+++ b/packages/cloudrun/gcpInstaller/install.mts@@ -13,44 +13,45 @@ import {setupGcpProject} from './installerScripts/tasks/setupGcpProject.mjs';****************************************/cloudRunSplashScreen();-/****************************************- * Set project ID for Terraform and gcloud commands- ****************************************/-execSync(`echo "Retrieving current Project ID..."`, {- stdio: 'inherit',-});--let projectID = execSync('gcloud config get-value project', {- stdio: ['inherit', 'pipe', 'pipe'],-})- .toString()- .trim();--if (!projectID) {- projectID = await projectIdPrompt();-}--execSync(- `echo "Project set to ${colorCode.blueText}${projectID}${colorCode.resetText}\n"`,- {+const start = async () => {+ /****************************************+ * Set project ID for Terraform and gcloud commands+ ****************************************/+ execSync(`echo "Retrieving current Project ID..."`, {stdio: 'inherit',+ });++ const projectID =+ execSync('gcloud config get-value project', {+ stdio: ['inherit', 'pipe', 'pipe'],+ })+ .toString()+ .trim() || (await projectIdPrompt());++ execSync(+ `echo "Project set to ${colorCode.blueText}${projectID}${colorCode.resetText}\n"`,+ {+ stdio: 'inherit',+ }+ );++ /****************************************+ * Check task the user is trying to complete+ ****************************************/+ const selection = await taskPrompt(projectID);++ switch (selection) {+ case 'runTerraform':+ await setupGcpProject(projectID);+ break;++ case 'generateEnv':+ await generateEnv(projectID);+ break;++ default:+ break;}-);--/****************************************- * Check task the user is trying to complete- ****************************************/-const selection = await taskPrompt(projectID);--switch (selection) {- case 'runTerraform':- await setupGcpProject(projectID);- break;-- case 'generateEnv':- await generateEnv(projectID);- break;+};- default:- break;-}+start();diff --git a/packages/cloudrun/gcpInstaller/installerScripts/components/checkEnvFile.mts b/packages/cloudrun/gcpInstaller/installerScripts/components/checkEnvFile.mtsindex 3011d75c3c..0282d758e8 100644--- a/packages/cloudrun/gcpInstaller/installerScripts/components/checkEnvFile.mts+++ b/packages/cloudrun/gcpInstaller/installerScripts/components/checkEnvFile.mts@@ -14,7 +14,7 @@ function deleteEnvPrompt() {`${colorCode.redText}.env file exists in this directory. Delete and create new .env file [yes, no]? ${colorCode.blueText}`,async (answer) => {// reset terminal color- rl.output.write(`\n${colorCode.resetText}`);+ rl.write(`\n${colorCode.resetText}`);rl.close();if (['yes', 'y'].indexOf(answer.trim().toLowerCase()) >= 0) {diff --git a/packages/cloudrun/gcpInstaller/installerScripts/components/checkTerraformStateFile.mts b/packages/cloudrun/gcpInstaller/installerScripts/components/checkTerraformStateFile.mtsindex 5c5a61ade7..18a7f0957d 100644--- a/packages/cloudrun/gcpInstaller/installerScripts/components/checkTerraformStateFile.mts+++ b/packages/cloudrun/gcpInstaller/installerScripts/components/checkTerraformStateFile.mts@@ -2,7 +2,7 @@ import {execSync} from 'child_process';import {existsSync, readFileSync} from 'fs';import {colorCode} from './colorCodes.mjs';-export function checkTerraformStateFile(projectID) {+export function checkTerraformStateFile(projectID: string) {/***************************************** Check for existing Terraform State****************************************/diff --git a/packages/cloudrun/gcpInstaller/installerScripts/components/generateEnvPrompt.mts b/packages/cloudrun/gcpInstaller/installerScripts/components/generateEnvPrompt.mtsindex 05a228bf59..9cbc3cb73e 100644--- a/packages/cloudrun/gcpInstaller/installerScripts/components/generateEnvPrompt.mts+++ b/packages/cloudrun/gcpInstaller/installerScripts/components/generateEnvPrompt.mts@@ -12,7 +12,7 @@ export function generateEnvPrompt() {`\n${colorCode.greenText}Do you want to generate the .env file for your code base? ${colorCode.blueText}`,async (answer) => {// reset terminal color- rl.output.write(`${colorCode.resetText}`);+ rl.write(`${colorCode.resetText}`);rl.close();if (['yes', 'y'].indexOf(answer.trim().toLowerCase()) >= 0)diff --git a/packages/cloudrun/gcpInstaller/installerScripts/components/projectIdPrompt.mts b/packages/cloudrun/gcpInstaller/installerScripts/components/projectIdPrompt.mtsindex 0ff4dcafaf..54451dbd9a 100644--- a/packages/cloudrun/gcpInstaller/installerScripts/components/projectIdPrompt.mts+++ b/packages/cloudrun/gcpInstaller/installerScripts/components/projectIdPrompt.mts@@ -3,7 +3,7 @@ import readline from 'readline';import {colorCode} from './colorCodes.mjs';export function projectIdPrompt() {- return new Promise((resolve) => {+ return new Promise<string>((resolve) => {const rl = readline.createInterface({input: process.stdin,output: process.stdout,diff --git a/packages/cloudrun/gcpInstaller/installerScripts/components/splashScreen.mts b/packages/cloudrun/gcpInstaller/installerScripts/components/splashScreen.mtsindex 73eedd8492..857f84e3b9 100644--- a/packages/cloudrun/gcpInstaller/installerScripts/components/splashScreen.mts+++ b/packages/cloudrun/gcpInstaller/installerScripts/components/splashScreen.mts@@ -11,7 +11,7 @@ export function cloudRunSplashScreen() {stdio: 'inherit',});- execSync('echo " Cloud Run project setup for Remotion Cloud Run "', {+ execSync('echo " GCP project setup for Remotion Cloud Run "', {stdio: 'inherit',});execSync(diff --git a/packages/cloudrun/gcpInstaller/installerScripts/components/taskPrompt.mts b/packages/cloudrun/gcpInstaller/installerScripts/components/taskPrompt.mtsindex 522e92204f..251c1d625a 100644--- a/packages/cloudrun/gcpInstaller/installerScripts/components/taskPrompt.mts+++ b/packages/cloudrun/gcpInstaller/installerScripts/components/taskPrompt.mts@@ -2,7 +2,7 @@ import {execSync} from 'child_process';import readline from 'readline';import {colorCode} from './colorCodes.mjs';-export function taskPrompt(projectID) {+export function taskPrompt(projectID: string) {return new Promise((resolve) => {const rl = readline.createInterface({input: process.stdin,@@ -13,10 +13,10 @@ export function taskPrompt(projectID) {`What would you like to do?\n[1] Cloud Run rendering in ${colorCode.blueText}${projectID}${colorCode.resetText} - Setup / Update Remotion version.\n[2] ${colorCode.blueText}${projectID}${colorCode.resetText} is already set up for Remotion, generate a new .env file or manage keys for the Remotion Service Account.\n${colorCode.blueText}`,async (answer) => {// reset terminal color- rl.output.write(`\n${colorCode.resetText}`);+ rl.write(`\n${colorCode.resetText}`);if (answer.trim() === '1') {- rl.output.write(+ rl.write(`${colorCode.blueText}<Terraform selected>\n\n${colorCode.resetText}`);rl.close();@@ -24,7 +24,7 @@ export function taskPrompt(projectID) {}if (answer.trim() === '2') {- rl.output.write(+ rl.write(`${colorCode.blueText}<.env creation selected>\n\n${colorCode.resetText}`);rl.close();@@ -39,7 +39,7 @@ export function taskPrompt(projectID) {});- const result = await taskPrompt();+ const result = await taskPrompt(projectID);resolve(result);}diff --git a/packages/cloudrun/gcpInstaller/installerScripts/components/terraformApplyPrompt.mts b/packages/cloudrun/gcpInstaller/installerScripts/components/terraformApplyPrompt.mtsindex 010a3fca6d..e7897eb62f 100644--- a/packages/cloudrun/gcpInstaller/installerScripts/components/terraformApplyPrompt.mts+++ b/packages/cloudrun/gcpInstaller/installerScripts/components/terraformApplyPrompt.mts@@ -12,7 +12,7 @@ export function terraformApplyPrompt() {`\n${colorCode.greenText}Do you want to apply the above plan? ${colorCode.blueText}`,async (answer) => {// reset terminal color- rl.output.write(colorCode.resetText);+ rl.write(colorCode.resetText);rl.close();if (['yes', 'y'].indexOf(answer.trim().toLowerCase()) >= 0)diff --git a/packages/cloudrun/gcpInstaller/installerScripts/tasks/generateEnv.mts b/packages/cloudrun/gcpInstaller/installerScripts/tasks/generateEnv.mtsindex 07bf9cf37b..05141d8364 100644--- a/packages/cloudrun/gcpInstaller/installerScripts/tasks/generateEnv.mts+++ b/packages/cloudrun/gcpInstaller/installerScripts/tasks/generateEnv.mts@@ -3,7 +3,7 @@ import readline from 'readline';import {checkEnvFile} from '../components/checkEnvFile.mjs';import {colorCode} from '../components/colorCodes.mjs';-export async function generateEnv(projectID) {+export async function generateEnv(projectID: string) {/***************************************** Generate .env file****************************************/@@ -53,10 +53,10 @@ export async function generateEnv(projectID) {`\n${colorCode.greenText}To delete one of these keys, type in the KEY_ID. Otherwise, press enter to continue. ${colorCode.blueText}`,async (answer) => {// reset terminal color- rl.output.write(`${colorCode.resetText}`);+ rl.write(`${colorCode.resetText}`);if (answer.trim() === '') {- rl.output.write(+ rl.write(`${colorCode.blueText}<enter pressed>\n${colorCode.resetText}`);rl.close();diff --git a/packages/cloudrun/gcpInstaller/installerScripts/tasks/setupGcpProject.mts b/packages/cloudrun/gcpInstaller/installerScripts/tasks/setupGcpProject.mtsindex d33e3f968a..9a56eb5fdd 100644--- a/packages/cloudrun/gcpInstaller/installerScripts/tasks/setupGcpProject.mts+++ b/packages/cloudrun/gcpInstaller/installerScripts/tasks/setupGcpProject.mts@@ -9,7 +9,7 @@ import {tfSuccessScreen} from '../components/tfSuccessScreen.mjs';// Tasksimport {generateEnv} from './generateEnv.mjs';-export async function setupGcpProject(projectID) {+export async function setupGcpProject(projectID: string) {checkTerraformStateFile(projectID);/***************************************** Prompt user for Remotion versiondiff --git a/packages/cloudrun/tsconfig.json b/packages/cloudrun/tsconfig.jsonindex 7584080359..199e5e4c21 100644--- a/packages/cloudrun/tsconfig.json+++ b/packages/cloudrun/tsconfig.json@@ -1,16 +1,12 @@{- "compilerOptions": {- "target": "es2016",- "module": "commonjs",- "esModuleInterop": true,- "strict": true,- "outDir": "dist",- "resolveJsonModule": true,- },- "include": [- "src/**/*",- ],- "exclude": [- "node_modules"- ]-}\ No newline at end of file+ "compilerOptions": {+ "target": "es2016",+ "module": "commonjs",+ "esModuleInterop": true,+ "strict": true,+ "outDir": "dist",+ "resolveJsonModule": true+ },+ "include": ["src/**/*", "gcpInstaller/**/*", "gcpInstaller/*"],+ "exclude": ["node_modules"]+}