Comparing version 1.0.12 to 1.0.13
29
index.js
@@ -24,6 +24,25 @@ #!/usr/bin/env node | ||
updateGitIgnore = () => { | ||
try { | ||
const filename = '.gitignore'; | ||
let content = '.env*' | ||
if(fs.existsSync(filename)) { | ||
content = fs.readFileSync(filename, 'utf8'); | ||
if(!content.includes('.env*')) | ||
content += '\n.env*' | ||
} | ||
return fs.writeFileSync(filename, content); | ||
} catch (error) { | ||
throw error | ||
} | ||
} | ||
program | ||
.name('securenv') | ||
.description('CLI to sync env files') | ||
.version('1.0.12'); | ||
.version('1.0.13'); | ||
@@ -37,9 +56,9 @@ program | ||
.action(async (login, password, host) => { | ||
try { | ||
try { | ||
const config = await rest.login(host, login, password) | ||
fs.writeFileSync(`${__dirname}/.securenv`, JSON.stringify(config)); | ||
console.log('You are in!') | ||
console.log('You are in!'); | ||
} | ||
catch (error) { | ||
console.log('Forbiden!', error.message); | ||
console.log('Forbiden!', error); | ||
} | ||
@@ -91,2 +110,3 @@ }) | ||
console.log('Done! You are up to date!'); | ||
updateGitIgnore(); | ||
} else { | ||
@@ -137,2 +157,3 @@ console.log(`This environment/version does not exists yet [${project}] [${environment}] [${versionId || 'current'}]`); | ||
console.log('Done! Your environment was uploaded!'); | ||
updateGitIgnore(); | ||
} | ||
@@ -139,0 +160,0 @@ catch (error) { |
{ | ||
"name": "securenv", | ||
"version": "1.0.12", | ||
"version": "1.0.13", | ||
"description": "Securenv its a CLI for securenv API that stores and gets secure env files", | ||
@@ -5,0 +5,0 @@ "bin": { |
Sorry, the diff of this file is not supported yet
12391
256
5