-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathpostinstall.js
More file actions
29 lines (27 loc) · 810 Bytes
/
Copy pathpostinstall.js
File metadata and controls
29 lines (27 loc) · 810 Bytes
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
29
const configstore = require('configstore');
const log = require('./_helpers/logger').logger;
const fs = require('fs');
const pkg = require('./package.json');
try {
// Create config store if it does not exist
const config = new configstore(pkg.name);
const defaultConfig = {
defaults: {
region: '',
output: '',
mfaSerial: '',
sessionDuration: 3600
},
profiles: []
};
if (!fs.existsSync(config.path)) {
config.all = defaultConfig;
}
// Create .awsprofilealiases
const aliasesFile = `${require('os').homedir()}/.awsprofilealiases`;
if (!fs.existsSync(aliasesFile)) {
fs.promises.writeFile(aliasesFile, '');
}
} catch (error) {
log.error(error.message ? error.message : error);
}