mirror of
https://github.com/all-contributors/cli.git
synced 2025-01-10 22:16:31 +00:00
24 lines
643 B
JavaScript
24 lines
643 B
JavaScript
'use strict';
|
|
|
|
var fs = require('fs');
|
|
var _ = require('lodash/fp');
|
|
|
|
function readConfig(configPath) {
|
|
return JSON.parse(fs.readFileSync(configPath, 'utf-8'));
|
|
}
|
|
|
|
function writeConfig(configPath, content, cb) {
|
|
return fs.writeFile(configPath, JSON.stringify(content, null, 2), cb);
|
|
}
|
|
|
|
function writeContributors(configPath, contributors, cb) {
|
|
var config = readConfig(configPath);
|
|
var content = _.assign(config, {contributors: contributors});
|
|
return fs.writeFile(configPath, JSON.stringify(content, null, 2), cb);
|
|
}
|
|
|
|
module.exports = {
|
|
readConfig: readConfig,
|
|
writeConfig: writeConfig,
|
|
writeContributors: writeContributors
|
|
};
|