Skip to content

Commit

Permalink
fix: use require.resolve for the default preset (#465)
Browse files Browse the repository at this point in the history
  • Loading branch information
merceyz authored and tommywo committed Dec 6, 2019
1 parent f3e6944 commit d557372
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const defaults = {
skip: {},
dryRun: false,
gitTagFallback: true,
preset: 'conventionalcommits'
preset: require.resolve('conventional-changelog-conventionalcommits')
}

/**
Expand Down
7 changes: 4 additions & 3 deletions lib/preset-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
const spec = require('conventional-changelog-config-spec')

module.exports = (args) => {
let preset = args.preset || 'conventionalcommits'
if (preset === 'conventionalcommits') {
const defaultPreset = require.resolve('conventional-changelog-conventionalcommits')
let preset = args.preset || defaultPreset
if (preset === defaultPreset) {
preset = {
name: preset
name: defaultPreset
}
Object.keys(spec.properties).forEach(key => {
if (args[key] !== undefined) preset[key] = args[key]
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"chalk": "2.4.2",
"conventional-changelog": "3.1.15",
"conventional-changelog-config-spec": "2.1.0",
"conventional-changelog-conventionalcommits": "4.2.1",
"conventional-recommended-bump": "6.0.5",
"detect-indent": "6.0.0",
"detect-newline": "3.1.0",
Expand Down

0 comments on commit d557372

Please sign in to comment.