fix: set commitConvention default same as app (#318)

This commit is contained in:
Angel Aviel Domaoan 2022-09-24 00:49:38 +08:00 committed by GitHub
parent 382f44cca3
commit 94b555e274
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 12 deletions

View file

@ -35,7 +35,7 @@ const questions = [
name: 'repoHost', name: 'repoHost',
message: message:
"Where is the repository hosted? Hit Enter if it's on GitHub or GitLab", "Where is the repository hosted? Hit Enter if it's on GitHub or GitLab",
default: function(answers) { default: function (answers) {
if (answers.repoType === 'github') { if (answers.repoType === 'github') {
return 'https://github.com' return 'https://github.com'
} else if (answers.repoType === 'gitlab') { } else if (answers.repoType === 'gitlab') {
@ -58,10 +58,10 @@ const questions = [
type: 'input', type: 'input',
name: 'badgeFile', name: 'badgeFile',
message: 'In which file should the badge be shown?', message: 'In which file should the badge be shown?',
when: function(answers) { when: function (answers) {
return answers.needBadge return answers.needBadge
}, },
default: function(answers) { default: function (answers) {
return answers.contributorFile return answers.contributorFile
}, },
}, },
@ -84,14 +84,11 @@ const questions = [
name: 'commitConvention', name: 'commitConvention',
message: 'What commit convention would you want it to use?', message: 'What commit convention would you want it to use?',
choices: Object.values(conventions), choices: Object.values(conventions),
default: 'none', default: 'angular',
}, },
] ]
const uniqueFiles = _.flow( const uniqueFiles = _.flow(_.compact, _.uniq)
_.compact,
_.uniq,
)
module.exports = function prompt() { module.exports = function prompt() {
return git return git

View file

@ -10,7 +10,7 @@ function readConfig(configPath) {
config.repoType = 'github' config.repoType = 'github'
} }
if (!('commitConvention' in config)) { if (!('commitConvention' in config)) {
config.commitConvention = 'none' config.commitConvention = 'angular'
} }
if (changed) { if (changed) {
//Updates the file with fixes //Updates the file with fixes
@ -20,9 +20,7 @@ function readConfig(configPath) {
} catch (error) { } catch (error) {
if (error instanceof SyntaxError) { if (error instanceof SyntaxError) {
throw new SyntaxError( throw new SyntaxError(
`Configuration file has malformed JSON: ${configPath}. Error:: ${ `Configuration file has malformed JSON: ${configPath}. Error:: ${error.message}`,
error.message
}`,
) )
} }
if (error.code === 'ENOENT') { if (error.code === 'ENOENT') {