-
Notifications
You must be signed in to change notification settings - Fork 0
/
postinstall.js
28 lines (24 loc) · 997 Bytes
/
postinstall.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
const fs = require('fs');
const os = require('os');
const path = require('path');
const gacDirectory = path.join(os.homedir(), '.gac');
const defaultProfilePath = path.join(gacDirectory, 'profile');
if (!fs.existsSync(gacDirectory)) {
fs.mkdirSync(gacDirectory);
console.log(`Creating directory: ${gacDirectory}`);
}
if (!fs.existsSync(defaultProfilePath)) {
const defaultProfileContent = `
[default]
jiraEmail = ${process.env.JIRA_EMAIL || ''}
jiraApiKey = ${process.env.JIRA_API_KEY || ''}
jiraDomain = ${process.env.JIRA_DOMAIN || ''}
githubAccessToken = ${process.env.GITHUB_ACCESS_TOKEN || ''}
openaiApiKey = ${process.env.OPENAI_API_KEY || ''}
openaiModel = ${process.env.OPENAI_MODEL || 'gpt-3.5-turbo-1106'}
`;
fs.writeFileSync(defaultProfilePath, defaultProfileContent.trim());
console.log(`Default profile created at: ${defaultProfilePath}`);
} else {
console.log(`Default profile already exists at: ${defaultProfilePath}`);
}