Skip to content

Commit

Permalink
[DOP-4033]: Add logic to write to .env.production file
Browse files Browse the repository at this point in the history
  • Loading branch information
branberry committed Sep 26, 2023
1 parent 6a39606 commit e27bae3
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/commands/src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,20 @@ export async function getPatchId(repoDir: string): Promise<string> {
return gitPatchId.slice(0, 7);
}

export async function addProjectToEnv(project: string) {
return new Promise((resolve, reject) => {
const stream = fs.createWriteStream(path.join(__dirname, 'snooty/.env.production'), { flags: 'a+' });

stream.write(project);
stream.close();
stream.on('error', (error) => {
console.log('Error when writing to file!', error);
reject(error);
});
stream.on('close', resolve);
});
}

export async function getCommitHash(): Promise<string> {
// equivalent to git rev-parse --short HEAD
const response = await executeCliCommand({ command: 'git', args: ['rev-parse', '--short', 'HEAD'] });
Expand Down

0 comments on commit e27bae3

Please sign in to comment.