🎥 Make videos programmatically with React
fixed edge case where user does not have a project already set
Matt McGillivray986570de83b5
diff --git a/packages/cloudrun/gcpInstaller/gcpInstaller.tar b/packages/cloudrun/gcpInstaller/gcpInstaller.tarindex 4fcffec4de..2be85b29f6 100644Binary files a/packages/cloudrun/gcpInstaller/gcpInstaller.tar and b/packages/cloudrun/gcpInstaller/gcpInstaller.tar differdiff --git a/packages/cloudrun/gcpInstaller/install.mjs b/packages/cloudrun/gcpInstaller/install.mjsindex e2668167f6..4d87b21d51 100644--- a/packages/cloudrun/gcpInstaller/install.mjs+++ b/packages/cloudrun/gcpInstaller/install.mjs@@ -1,6 +1,7 @@import {execSync} from 'child_process';// Componentsimport {colorCode} from './installerScripts/components/colorCodes.mjs';+import {projectIdPrompt} from './installerScripts/components/projectIdPrompt.mjs';import {cloudRunSplashScreen} from './installerScripts/components/splashScreen.mjs';import {taskPrompt} from './installerScripts/components/taskPrompt.mjs';// Tasks@@ -20,12 +21,16 @@ execSync(`echo "Retrieving current Project ID..."`, {stdio: 'inherit',});-const projectID = execSync('gcloud config get-value project', {+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"`,{diff --git a/packages/cloudrun/gcpInstaller/installerScripts/components/projectIdPrompt.mjs b/packages/cloudrun/gcpInstaller/installerScripts/components/projectIdPrompt.mjsnew file mode 100644index 0000000000..0ff4dcafaf--- /dev/null+++ b/packages/cloudrun/gcpInstaller/installerScripts/components/projectIdPrompt.mjs@@ -0,0 +1,38 @@+import {execSync} from 'child_process';+import readline from 'readline';+import {colorCode} from './colorCodes.mjs';++export function projectIdPrompt() {+ return new Promise((resolve) => {+ const rl = readline.createInterface({+ input: process.stdin,+ output: process.stdout,+ });++ rl.question(+ `GCP Project ID is not set. What is the Project ID? ${colorCode.blueText}`,+ (answer) => {+ rl.write(`\n${colorCode.resetText}`);+ rl.close();++ execSync(`gcloud config set project ${answer.trim()}`, {+ stdio: 'inherit',+ });++ // ensuring that user has selected a valid project+ const projectID = execSync('gcloud config get-value project', {+ stdio: ['inherit', 'pipe', 'pipe'],+ })+ .toString()+ .trim();++ if (!projectID) {+ console.log('Operation cancelled.');+ process.exit(1);+ }++ resolve(projectID);+ }+ );+ });+}diff --git a/packages/docs/docs/cloudrun/generateEnvFile.md b/packages/docs/docs/cloudrun/generateEnvFile.mdindex afef617292..66f31140a2 100644--- a/packages/docs/docs/cloudrun/generateEnvFile.md+++ b/packages/docs/docs/cloudrun/generateEnvFile.md@@ -21,7 +21,7 @@ GCP allows a maximum of 10 keys per service account. If you have already created3. Within the Cloud Shell, type the following command and follow the prompts.```bash- curl -L https://raw.githubusercontent.com/UmungoBungo/remotion/gcp-lambda-alternative/packages/cloudrun/gcpInstaller/gcpInstaller.tar | tar -x --strip-components=1 -C . && node install.mjs+ curl -L https://github.com/UmungoBungo/remotion/raw/gcp-lambda-alternative/packages/cloudrun/gcpInstaller/gcpInstaller.tar | tar -x --strip-components=1 -C . && node install.mjs```_The first command downloads a tar file from the Remotion repo, and extracts it to the current directory. The second command runs the installer script._diff --git a/packages/docs/docs/cloudrun/updateGcpProject.md b/packages/docs/docs/cloudrun/updateGcpProject.mdindex 0ff92d0a1e..68887ecc34 100644--- a/packages/docs/docs/cloudrun/updateGcpProject.md+++ b/packages/docs/docs/cloudrun/updateGcpProject.md@@ -17,7 +17,7 @@ The permissions on the Service Account role may change as Remotion evolves in th3. Within the Cloud Shell, type the following command and follow the prompts.```bash- curl -L https://raw.githubusercontent.com/UmungoBungo/remotion/gcp-lambda-alternative/packages/cloudrun/gcpInstaller/gcpInstaller.tar | tar -x --strip-components=1 -C . && node install.mjs+ curl -L https://github.com/UmungoBungo/remotion/raw/gcp-lambda-alternative/packages/cloudrun/gcpInstaller/gcpInstaller.tar | tar -x --strip-components=1 -C . && node install.mjs```_The first command downloads a tar file from the Remotion repo, and extracts it to the current directory. The second command runs the installer script._