diff --git a/setup.ts b/setup.ts index a42c0c08ab..89a2b0699d 100644 --- a/setup.ts +++ b/setup.ts @@ -9,14 +9,16 @@ dotenv.config(); async function checkConnection(url: string): Promise { console.log('\nChecking Talawa-API connection....'); let isConnected = false; - const resp = await fetch(url).then((res) => { - isConnected = true; - console.log('\nConnection to Talawa-API successful! 🎉'); - }).catch((err) => { - console.log( - '\nTalawa-API service is unavailable. Is it running? Check your network connectivity too.' - ); - }); + await fetch(url) + .then((res) => { + isConnected = true; + console.log('\nConnection to Talawa-API successful! 🎉'); + }) + .catch((err) => { + console.log( + '\nTalawa-API service is unavailable. Is it running? Check your network connectivity too.', + ); + }); return isConnected; } @@ -40,7 +42,7 @@ function checkEnvFile(): void { if (misplaced.length > 0) { const config = dotenv.parse(fs.readFileSync('.env.example')); misplaced.map((key) => - fs.appendFileSync('.env', `${key}=${config[key]}\n`) + fs.appendFileSync('.env', `${key}=${config[key]}\n`), ); } } @@ -67,7 +69,7 @@ async function main(): Promise { if (process.env.REACT_APP_TALAWA_URL) { console.log( - `\nEndpoint for accessing talawa-api graphql service already exists with the value:\n${process.env.REACT_APP_TALAWA_URL}` + `\nEndpoint for accessing talawa-api graphql service already exists with the value:\n${process.env.REACT_APP_TALAWA_URL}`, ); shouldSetTalawaApiUrl = true; } else { @@ -91,13 +93,13 @@ async function main(): Promise { } const talawaApiUrl = dotenv.parse( - fs.readFileSync('.env') + fs.readFileSync('.env'), ).REACT_APP_TALAWA_URL; fs.readFile('.env', 'utf8', (err, data) => { const result = data.replace( `REACT_APP_TALAWA_URL=${talawaApiUrl}`, - `REACT_APP_TALAWA_URL=${endpoint}` + `REACT_APP_TALAWA_URL=${endpoint}`, ); fs.writeFileSync('.env', result, 'utf8'); }); @@ -112,20 +114,20 @@ async function main(): Promise { if (shouldUseRecaptcha) { const useRecaptcha = dotenv.parse( - fs.readFileSync('.env') + fs.readFileSync('.env'), ).REACT_APP_USE_RECAPTCHA; fs.readFile('.env', 'utf8', (err, data) => { const result = data.replace( `REACT_APP_USE_RECAPTCHA=${useRecaptcha}`, - `REACT_APP_USE_RECAPTCHA=yes` + `REACT_APP_USE_RECAPTCHA=yes`, ); fs.writeFileSync('.env', result, 'utf8'); }); let shouldSetRecaptchaSiteKey: boolean; if (process.env.REACT_APP_RECAPTCHA_SITE_KEY) { console.log( - `\nreCAPTCHA site key already exists with the value ${process.env.REACT_APP_RECAPTCHA_SITE_KEY}` + `\nreCAPTCHA site key already exists with the value ${process.env.REACT_APP_RECAPTCHA_SITE_KEY}`, ); shouldSetRecaptchaSiteKey = true; } else { @@ -154,13 +156,13 @@ async function main(): Promise { ]); const recaptchaSiteKey = dotenv.parse( - fs.readFileSync('.env') + fs.readFileSync('.env'), ).REACT_APP_RECAPTCHA_SITE_KEY; fs.readFile('.env', 'utf8', (err, data) => { const result = data.replace( `REACT_APP_RECAPTCHA_SITE_KEY=${recaptchaSiteKey}`, - `REACT_APP_RECAPTCHA_SITE_KEY=${recaptchaSiteKeyInput}` + `REACT_APP_RECAPTCHA_SITE_KEY=${recaptchaSiteKeyInput}`, ); fs.writeFileSync('.env', result, 'utf8'); }); @@ -185,7 +187,7 @@ async function main(): Promise { } console.log( - '\nCongratulations! Talawa Admin has been successfully setup! 🥂🎉' + '\nCongratulations! Talawa Admin has been successfully setup! 🥂🎉', ); }