Skip to content

Commit ff4d722

Browse files
authored
Merge pull request #7 from JasonEtco/standard-linter
Use the standard linter
2 parents 68894b6 + a50ec86 commit ff4d722

File tree

3 files changed

+408
-2253
lines changed

3 files changed

+408
-2253
lines changed

bin/create-probot-app.js

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
#!/usr/bin/env node
22

3-
'use strict';
3+
'use strict'
44

5-
const path = require('path');
6-
const inquirer = require('inquirer');
7-
const program = require('commander');
8-
const {scaffold} = require('egad');
9-
const kebabCase = require('lodash.kebabcase');
10-
const chalk = require('chalk');
11-
const spawn = require('cross-spawn');
12-
const stringifyAuthor = require('stringify-author');
13-
const {guessEmail, guessAuthor, guessGitHubUsername} = require('conjecture');
5+
const path = require('path')
6+
const inquirer = require('inquirer')
7+
const program = require('commander')
8+
const {scaffold} = require('egad')
9+
const kebabCase = require('lodash.kebabcase')
10+
const chalk = require('chalk')
11+
const spawn = require('cross-spawn')
12+
const stringifyAuthor = require('stringify-author')
13+
const {guessEmail, guessAuthor, guessGitHubUsername} = require('conjecture')
1414

15-
const TEMPLATE_REPO_URL = 'https://github.com/probot/template.git';
15+
const TEMPLATE_REPO_URL = 'https://github.com/probot/template.git'
1616

1717
program
1818
.usage('[options] [destination]')
@@ -28,45 +28,45 @@ program
2828
.option('--overwrite', 'Overwrite existing files', false)
2929
.option('--template <template-url>', 'URL of custom template',
3030
TEMPLATE_REPO_URL)
31-
.parse(process.argv);
31+
.parse(process.argv)
3232

33-
const destination = program.args.length ?
34-
path.resolve(process.cwd(), program.args.shift()) :
35-
process.cwd();
33+
const destination = program.args.length
34+
? path.resolve(process.cwd(), program.args.shift())
35+
: process.cwd()
3636

3737
const prompts = [
3838
{
3939
type: 'input',
4040
name: 'name',
41-
default(answers) {
42-
return answers.repo || kebabCase(path.basename(destination));
41+
default (answers) {
42+
return answers.repo || kebabCase(path.basename(destination))
4343
},
4444
message: 'Package name:',
4545
when: !program.pkgname
4646
},
4747
{
4848
type: 'input',
4949
name: 'desc',
50-
default() {
51-
return 'A Probot app';
50+
default () {
51+
return 'A Probot app'
5252
},
5353
message: 'Description of app:',
5454
when: !program.desc
5555
},
5656
{
5757
type: 'input',
5858
name: 'author',
59-
default() {
60-
return guessAuthor();
59+
default () {
60+
return guessAuthor()
6161
},
6262
message: 'Author\'s full name:',
6363
when: !program.author
6464
},
6565
{
6666
type: 'input',
6767
name: 'email',
68-
default() {
69-
return guessEmail();
68+
default () {
69+
return guessEmail()
7070
},
7171
message: 'Author\'s email address:',
7272
when: !program.email
@@ -80,51 +80,51 @@ const prompts = [
8080
{
8181
type: 'input',
8282
name: 'owner',
83-
default(answers) {
84-
return guessGitHubUsername(answers.email);
83+
default (answers) {
84+
return guessGitHubUsername(answers.email)
8585
},
8686
message: 'GitHub user or org name:',
8787
when: !program.user
8888
},
8989
{
9090
type: 'input',
9191
name: 'repo',
92-
default(answers) {
93-
return answers.pkgname || kebabCase(path.basename(destination));
92+
default (answers) {
93+
return answers.pkgname || kebabCase(path.basename(destination))
9494
},
9595
message: 'Repository name:',
9696
when: !program.repo
9797
}
98-
];
98+
]
9999

100-
console.log(chalk.blue('Let\'s create a Probot app!'));
100+
console.log(chalk.blue('Let\'s create a Probot app!'))
101101

102102
inquirer.prompt(prompts)
103103
.then(answers => {
104104
answers.author = stringifyAuthor({
105105
name: answers.author,
106106
email: answers.email,
107107
url: answers.homepage
108-
});
108+
})
109109
return scaffold(program.template, destination, answers, {
110110
overwrite: Boolean(program.overwrite)
111-
});
111+
})
112112
})
113113
.then(results => {
114114
results.forEach(fileinfo => {
115-
console.log(`${fileinfo.skipped ? chalk.yellow('skipped existing file') :
116-
chalk.green('created file')}: ${fileinfo.path}`);
117-
});
118-
return console.log(chalk.blue('Finished scaffolding files!'));
115+
console.log(`${fileinfo.skipped ? chalk.yellow('skipped existing file')
116+
: chalk.green('created file')}: ${fileinfo.path}`)
117+
})
118+
return console.log(chalk.blue('Finished scaffolding files!'))
119119
})
120120
.then(() => {
121-
console.log(chalk.blue('\nInstalling Node dependencies!'));
122-
const child = spawn('npm', ['install', '--prefix', destination], {stdio: 'inherit'});
121+
console.log(chalk.blue('\nInstalling Node dependencies!'))
122+
const child = spawn('npm', ['install', '--prefix', destination], {stdio: 'inherit'})
123123
child.on('close', code => {
124124
if (code !== 0) {
125-
console.log(chalk.red(`Could not install npm dependencies. Try running ${chalk.bold('npm install')} yourself.`));
126-
return;
125+
console.log(chalk.red(`Could not install npm dependencies. Try running ${chalk.bold('npm install')} yourself.`))
126+
return
127127
}
128-
console.log(chalk.blue('\nDone! Enjoy building your Probot app!'));
129-
});
130-
});
128+
console.log(chalk.blue('\nDone! Enjoy building your Probot app!'))
129+
})
130+
})

0 commit comments

Comments
 (0)