mirror of
https://github.com/all-contributors/cli.git
synced 2025-01-09 13:36:29 +00:00
Create a util folder
This commit is contained in:
parent
a29c622bc2
commit
192e698dca
13 changed files with 19 additions and 13 deletions
6
cli.js
6
cli.js
|
@ -4,16 +4,17 @@
|
|||
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var yargs = require('yargs');
|
||||
|
||||
var init = require('./lib/init');
|
||||
var generate = require('./lib/generate');
|
||||
var markdown = require('./lib/markdown');
|
||||
var markdown = require('./lib/util').markdown;
|
||||
var updateContributors = require('./lib/contributors');
|
||||
|
||||
var cwd = process.cwd();
|
||||
var defaultRCFile = path.join(cwd, '.all-contributorsrc');
|
||||
|
||||
var argv = require('yargs')
|
||||
var argv = yargs
|
||||
.help('help')
|
||||
.alias('h', 'help')
|
||||
.command('generate', 'Generate the list of contributors')
|
||||
|
@ -22,7 +23,6 @@ var argv = require('yargs')
|
|||
.usage('Usage: $0 add <username> <contribution>')
|
||||
.command('init', 'Prepare the project to be used with this tool')
|
||||
.usage('Usage: $0 init')
|
||||
.demand(2)
|
||||
.default('files', ['README.md'])
|
||||
.default('contributorsPerLine', 7)
|
||||
.default('contributors', [])
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
var add = require('./add');
|
||||
var github = require('./github');
|
||||
var configFile = require('../configFile');
|
||||
var configFile = require('../util').configFile;
|
||||
|
||||
module.exports = function addContributor(options, username, contributions, cb) {
|
||||
add(options, username, contributions, github, function (error, contributors) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import test from 'ava';
|
||||
import formatContributionType from './formatContributionType';
|
||||
import contributors from './fixtures/contributors.json';
|
||||
import formatContributionType from './formatContributionType';
|
||||
|
||||
const fixtures = () => {
|
||||
const options = {
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var _ = require('lodash/fp');
|
||||
|
||||
var formatContributionType = require('./formatContributionType');
|
||||
|
||||
var avatarTemplate = _.template('![<%= contributor.name %>](<%= contributor.avatar_url %>)');
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
'use strict';
|
||||
|
||||
var _ = require('lodash/fp');
|
||||
var injectContentBetween = require('../util').markdown.injectContentBetween;
|
||||
var formatBadge = require('./formatBadge');
|
||||
var formatContributor = require('./formatContributor');
|
||||
var injectContentBetween = require('../markdown').injectContentBetween;
|
||||
|
||||
var badgeRegex = /\[\!\[All Contributors\]\([a-zA-Z0-9\-\.\/_\:\?=]+\)\]\(\#\w+\)/;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import test from 'ava';
|
||||
import generate from './';
|
||||
import contributors from './fixtures/contributors.json';
|
||||
import generate from './';
|
||||
|
||||
function fixtures() {
|
||||
const options = {
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
var _ = require('lodash/fp');
|
||||
var series = require('async/series');
|
||||
|
||||
var util = require('../util');
|
||||
var prompt = require('./prompt');
|
||||
var configFile = require('../configFile');
|
||||
var markdown = require('../markdown');
|
||||
var initContent = require('./initContent');
|
||||
var configFile = util.configFile;
|
||||
var markdown = util.markdown;
|
||||
|
||||
function injectInFile(file, fn, cb) {
|
||||
markdown.read(file, function (error, content) {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
var _ = require('lodash/fp');
|
||||
var injectContentBetween = require('../markdown').injectContentBetween;
|
||||
var injectContentBetween = require('../util').markdown.injectContentBetween;
|
||||
|
||||
var badgeContent = '[![All Contributors](https://img.shields.io/badge/all_contributors-0-orange.svg?style=flat-square)](#contributors)';
|
||||
var listContent = '<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --><!-- ALL-CONTRIBUTORS-LIST:END -->';
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
var _ = require('lodash/fp');
|
||||
var inquirer = require('inquirer');
|
||||
|
||||
var getRepoInfo = require('./git');
|
||||
var getRepoInfo = require('../util').git;
|
||||
|
||||
var questions = [{
|
||||
type: 'input',
|
||||
|
|
7
lib/util/index.js
Normal file
7
lib/util/index.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
configFile: require('./configFile'),
|
||||
git: require('./git'),
|
||||
markdown: require('./markdown')
|
||||
};
|
Loading…
Reference in a new issue