mirror of
https://github.com/all-contributors/cli.git
synced 2025-01-10 14:06:34 +00:00
1305a7cd92
BREAKING CHANGE: Drop support for Node < v4. This uses native Promises available from Node v4. * fix: Bump inquirer to v3.0.1. Fixes #33 to improve Windows support. * refactor: Promisify everything as inquirer uses Promises from 1.0.0 onwards
25 lines
703 B
JavaScript
25 lines
703 B
JavaScript
'use strict';
|
|
|
|
var util = require('../util');
|
|
var prompt = require('./prompt');
|
|
var initContent = require('./init-content');
|
|
var configFile = util.configFile;
|
|
var markdown = util.markdown;
|
|
|
|
function injectInFile(file, fn) {
|
|
return markdown.read(file)
|
|
.then(content => markdown.write(file, fn(content)));
|
|
}
|
|
|
|
module.exports = function init() {
|
|
return prompt()
|
|
.then(result => {
|
|
return configFile.writeConfig('.all-contributorsrc', result.config)
|
|
.then(() => injectInFile(result.contributorFile, initContent.addContributorsList))
|
|
.then(() => {
|
|
if (result.badgeFile) {
|
|
return injectInFile(result.badgeFile, initContent.addBadge);
|
|
}
|
|
});
|
|
});
|
|
};
|