UNPKG

493 BJavaScriptView Raw
1'use strict';
2
3const fs = require('fs');
4const path = require('path');
5
6/* istanbul ignore next */
7module.exports = function createConfigFileInHomedir(options) {
8 // Create config file in the homedir, if it does not exist.
9 // Saving to a globally installed package might cause problems.
10 try {
11 fs.writeFileSync(path.join(options.configHomedirPath, options.configFilename), '{}', {
12 encoding: 'utf8',
13 flag: 'wx'
14 });
15 } catch (_error) {
16 // Do nothing, file might already exist
17 }
18};