@adminjs/cloud-cli
Advanced tools
Comparing version 1.2.0-dev.6 to 1.2.0-dev.7
@@ -62,15 +62,4 @@ import fs from 'fs'; | ||
const replaceValueInEnvFile = (localPath, key, value) => { | ||
const envFile = path.join(localPath, '_env'); | ||
if (!fs.existsSync(envFile)) { | ||
createEnvFile(envFile, `${key}=${value}`); | ||
} | ||
else { | ||
const data = fs.readFileSync(envFile, 'utf8').split(os.EOL); | ||
const target = data.indexOf(data.find((line) => line.match(new RegExp(key)))); | ||
data.splice(target, 1, `${key}=${value}`); | ||
fs.writeFileSync(envFile, data.join(os.EOL), { encoding: 'utf8', flag: 'w' }); | ||
} | ||
fs.rename(envFile, path.join(localPath, '.env'), () => { | ||
console.log('\nFile .env modified successfully!\n'); | ||
}); | ||
const envFile = path.join(localPath, '.env'); | ||
createEnvFile(envFile, `${key}=${value}`); | ||
if (fs.readFileSync(envFile, 'utf8').toString() === (`${key}=${value}`)) { | ||
@@ -77,0 +66,0 @@ console.log(`Database connection string has been updated successfully. \n\n |
{ | ||
"name": "@adminjs/cloud-cli", | ||
"version": "1.2.0-dev.6", | ||
"version": "1.2.0-dev.7", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "description": "", |
@@ -83,14 +83,4 @@ import fs from 'fs'; | ||
const replaceValueInEnvFile = (localPath: string, key: string, value: string): void => { | ||
const envFile = path.join(localPath, '_env'); | ||
if (!fs.existsSync(envFile)) { | ||
createEnvFile(envFile, `${key}=${value}`); | ||
} else { | ||
const data = fs.readFileSync(envFile, 'utf8').split(os.EOL); | ||
const target = data.indexOf(data.find((line) => line.match(new RegExp(key)))); | ||
data.splice(target, 1, `${key}=${value}`); | ||
fs.writeFileSync(envFile, data.join(os.EOL), { encoding: 'utf8', flag: 'w' }); | ||
} | ||
fs.rename(envFile, path.join(localPath, '.env'), () => { | ||
console.log('\nFile .env modified successfully!\n'); | ||
}); | ||
const envFile = path.join(localPath, '.env'); | ||
createEnvFile(envFile, `${key}=${value}`); | ||
if (fs.readFileSync(envFile, 'utf8').toString() === (`${key}=${value}`)) { | ||
@@ -97,0 +87,0 @@ console.log(`Database connection string has been updated successfully. \n\n |
328501
2
876