Skip to content

Commit

Permalink
Simplified the code.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kamil Piechaczek committed Jun 28, 2018
1 parent 68adf05 commit eda7c1a
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{{~title}}
{{~/if}}

{{~#if @root.linkCommit}}
{{~#unless @root.skipCommitsLink}}
{{~!-- commit link --}} {{#if @root.linkReferences~}}
([{{hash}}](
{{~#if @root.repository}}
Expand All @@ -22,7 +22,7 @@
{{~else}}
{{~hash}}
{{~/if}}
{{/if}}
{{/unless}}
{{#if body}}


Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## {{#if @root.linkCompare~}}
## {{#unless @root.skipCompareLink~}}
[{{version}}](
{{~#if @root.repository~}}
{{~#if @root.host}}
Expand All @@ -14,6 +14,6 @@
/compare/{{previousTag}}...{{currentTag}})
{{~else}}
{{~version}}
{{~/if}}
{{~/unless}}
{{~#if date}} ({{date}})
{{/if}}
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ module.exports = function generateChangelogFromCommits( options ) {
displayLogs: false,
isInternalRelease: options.isInternalRelease || false,
additionalNotes: {},
linkCommit: typeof options.skipLinks == 'undefined' ? true : !options.skipLinks,
linkCompare: typeof options.skipLinks == 'undefined' ? true : !options.skipLinks
skipCommitsLink: Boolean( options.skipLinks ),
skipCompareLink: Boolean( options.skipLinks )
};

if ( options.additionalNotes ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe( 'dev-env/release-tools/changelog/templates', () => {
commit: 'commit',
issue: 'issues',
linkReferences: true,
linkCommit: true
skipCommitsLink: false
};
templateOptions = {
data: {
Expand Down Expand Up @@ -89,7 +89,7 @@ describe( 'dev-env/release-tools/changelog/templates', () => {
} );

it( 'hides the commit hash', () => {
rootOptions.linkCommit = false;
rootOptions.skipCommitsLink = true;

const data = { subject: 'Test', hash: '1234qwe' };

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ describe( 'dev-env/release-tools/utils', () => {
currentTag: 'v1.0.0',
isInternalRelease: false,
additionalNotes: {},
linkCommit: true,
linkCompare: true
skipCommitsLink: false,
skipCompareLink: false
} );
expect( conventionalChangelogArguments[ 2 ] ).to.have.property( 'from', 'v0.5.0' );
expect( conventionalChangelogArguments[ 4 ] ).to.deep.equal( { foo: 'bar' } );
Expand Down Expand Up @@ -197,8 +197,8 @@ describe( 'dev-env/release-tools/utils', () => {
currentTag: 'v0.5.1',
isInternalRelease: true,
additionalNotes: {},
linkCommit: true,
linkCompare: true
skipCommitsLink: false,
skipCompareLink: false
} );
} );
} );
Expand Down Expand Up @@ -259,8 +259,8 @@ describe( 'dev-env/release-tools/utils', () => {
currentTag: 'v0.5.1',
isInternalRelease: false,
additionalNotes: additionalCommitNotes,
linkCommit: true,
linkCompare: true
skipCommitsLink: false,
skipCompareLink: false
} );
} );
} );
Expand Down Expand Up @@ -289,8 +289,8 @@ describe( 'dev-env/release-tools/utils', () => {
currentTag: 'v0.5.1',
isInternalRelease: false,
additionalNotes: {},
linkCommit: false,
linkCompare: false
skipCommitsLink: true,
skipCompareLink: true
} );
} );
} );
Expand Down

0 comments on commit eda7c1a

Please sign in to comment.