Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(types): allow combining provided types with defaults #1064

Merged

Conversation

roggervalf
Copy link
Contributor

@roggervalf roggervalf commented Jul 15, 2023

ref #984
we should have a way to combine types from user and default ones, in order to prevent a breaking change I added hardTypesReplacement option, by default is true

@dangreen dangreen self-requested a review July 15, 2023 10:06
@roggervalf
Copy link
Contributor Author

please @dangreen when you get a chance 👀

@dangreen
Copy link
Member

@roggervalf I'll take a look this week 👌

@dangreen
Copy link
Member

dangreen commented Aug 5, 2023

@roggervalf Hi. Sorry for the delay. I want to suggest more easier way: what if we will export default types, so you can extend / modify them

const preset = require('conventional-changelog-conventionalcommits')

conventionalChangelogCore({
  config: preset({
    types: preset.defaultCommitTypes.map((commitType) => (
      commitType.type === 'chore'
        ? { ...commitType, hidden: false }
        : commitType
    ))
  })
})

WDYT?

@roggervalf
Copy link
Contributor Author

@roggervalf Hi. Sorry for the delay. I want to suggest more easier way: what if we will export default types, so you can extend / modify them

const preset = require('conventional-changelog-conventionalcommits')

conventionalChangelogCore({
  config: preset({
    types: preset.defaultCommitTypes.map((commitType) => (
      commitType.type === 'chore'
        ? { ...commitType, hidden: false }
        : commitType
    ))
  })
})

WDYT?

hey @dangreen, but in that case how it will work with commit-analyzer usage https://github.com/semantic-release/commit-analyzer#usage? the configuration is passed in a json file

@dangreen
Copy link
Member

dangreen commented Aug 6, 2023

@roggervalf Configuration can be made as js file: https://github.com/semantic-release/semantic-release/blob/master/docs/usage/configuration.md#configuration

A .releaserc file, written in YAML or JSON, with optional extensions: .yaml/.yml/.json/.js/.cjs
A release.config.(js|cjs) file that exports an object

@roggervalf
Copy link
Contributor Author

Thank you @dangreen, it sounds good to me

Comment on lines 196 to 218
it('alternative "types" configuration to be provided and combined with default ones', function (done) {
preparing(1)
conventionalChangelogCore({
config: preset({
types: preset.defaultCommitTypes.map((commitType) => (
commitType.type === 'chore'
? { ...commitType, hidden: false }
: commitType
))
})
})
.on('error', function (err) {
done(err)
})
.pipe(through(function (chunk) {
chunk = chunk.toString()

expect(chunk).to.include('### Miscellaneous Chores')
expect(chunk).to.include('**deps:** upgrade example from 1 to 2')

expect(chunk).to.include('### Performance Improvements')
expect(chunk).to.include('**ngOptions:** make it faster')

done()
}))
})

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use arrow functions and for await. You can find examples in this test file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be addressed, thank you

@roggervalf roggervalf requested a review from dangreen August 6, 2023 23:18
@dangreen dangreen force-pushed the combine-provided-types branch from 6f2dc29 to 853b54f Compare August 13, 2023 12:23
@dangreen dangreen force-pushed the combine-provided-types branch from 853b54f to ccdb2ef Compare August 13, 2023 12:27
@coveralls
Copy link

Coverage Status

coverage: 89.525% (+0.03%) from 89.5% when pulling ccdb2ef on roggervalf:combine-provided-types into 0ffec3f on conventional-changelog:master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants