happy-conventional-commit
Advanced tools
Comparing version 0.0.18 to 0.1.0
@@ -13,2 +13,3 @@ /** | ||
* @param [options.author] "githubUsername" or "nameAndEmail". | ||
* @param [options.authorUsername] Use this username for author when "author" is not specified or if it was not possible to retrieve the Github username based on email. | ||
* @returns Release notes. | ||
@@ -21,2 +22,3 @@ */ | ||
author?: 'githubUsername' | 'nameAndEmail'; | ||
authorUsername?: string; | ||
}): Promise<string>; | ||
@@ -23,0 +25,0 @@ /** |
@@ -25,2 +25,3 @@ "use strict"; | ||
* @param [options.author] "githubUsername" or "nameAndEmail". | ||
* @param [options.authorUsername] Use this username for author when "author" is not specified or if it was not possible to retrieve the Github username based on email. | ||
* @returns Release notes. | ||
@@ -40,13 +41,23 @@ */ | ||
: change.message; | ||
const author = options?.author === 'githubUsername' && change.author.githubUsername | ||
? change.author.githubUsername | ||
: options?.author === 'nameAndEmail' | ||
? `${change.author.name} (${change.author.email})` | ||
: null; | ||
let author = ''; | ||
switch (options?.author) { | ||
case 'githubUsername': | ||
author = | ||
change.author.githubUsername || options?.authorUsername | ||
? `@${change.author.githubUsername || options?.authorUsername}` | ||
: null; | ||
break; | ||
case 'nameAndEmail': | ||
author = `${change.author.name} (${change.author.email})`; | ||
break; | ||
default: | ||
author = options?.authorUsername ? `@${options?.authorUsername}` : null; | ||
break; | ||
} | ||
let userAndTask = ''; | ||
if (author && change.taskId) { | ||
userAndTask = ` - By **@${author}** in task ${change.taskId}`; | ||
userAndTask = ` - By **${author}** in task ${change.taskId}`; | ||
} | ||
else if (author) { | ||
userAndTask = ` - By **@${author}**`; | ||
userAndTask = ` - By **${author}**`; | ||
} | ||
@@ -217,3 +228,4 @@ else if (change.taskId) { | ||
commits.push({ | ||
message, | ||
// Remove @ from message to avoid Github to link to a user. | ||
message: message.replace('@', ''), | ||
author: { | ||
@@ -220,0 +232,0 @@ name: userName, |
{ | ||
"name": "happy-conventional-commit", | ||
"description": "Tools for getting a happy conventional commit setup.", | ||
"version": "0.0.18", | ||
"version": "0.1.0", | ||
"author": "David Ortner", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
@@ -42,2 +42,3 @@ import ChildProcess from 'child_process'; | ||
* @param [options.author] "githubUsername" or "nameAndEmail". | ||
* @param [options.authorUsername] Use this username for author when "author" is not specified or if it was not possible to retrieve the Github username based on email. | ||
* @returns Release notes. | ||
@@ -50,2 +51,3 @@ */ | ||
author?: 'githubUsername' | 'nameAndEmail'; | ||
authorUsername?: string; | ||
}): Promise<string> { | ||
@@ -66,14 +68,24 @@ const releases = await this.getReleases(options); | ||
: change.message; | ||
const author = | ||
options?.author === 'githubUsername' && change.author.githubUsername | ||
? change.author.githubUsername | ||
: options?.author === 'nameAndEmail' | ||
? `${change.author.name} (${change.author.email})` | ||
: null; | ||
let author = ''; | ||
switch (options?.author) { | ||
case 'githubUsername': | ||
author = | ||
change.author.githubUsername || options?.authorUsername | ||
? `@${change.author.githubUsername || options?.authorUsername}` | ||
: null; | ||
break; | ||
case 'nameAndEmail': | ||
author = `${change.author.name} (${change.author.email})`; | ||
break; | ||
default: | ||
author = options?.authorUsername ? `@${options?.authorUsername}` : null; | ||
break; | ||
} | ||
let userAndTask = ''; | ||
if (author && change.taskId) { | ||
userAndTask = ` - By **@${author}** in task ${change.taskId}`; | ||
userAndTask = ` - By **${author}** in task ${change.taskId}`; | ||
} else if (author) { | ||
userAndTask = ` - By **@${author}**`; | ||
userAndTask = ` - By **${author}**`; | ||
} else if (change.taskId) { | ||
@@ -301,3 +313,4 @@ userAndTask = ` - In task ${change.taskId}`; | ||
commits.push(<ICommit>{ | ||
message, | ||
// Remove @ from message to avoid Github to link to a user. | ||
message: message.replace('@', ''), | ||
author: { | ||
@@ -304,0 +317,0 @@ name: userName, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
153973
1905