conventional-changelog-preset-loader
Advanced tools
Comparing version 2.0.2 to 2.1.1
@@ -6,2 +6,21 @@ # Change Log | ||
## [2.1.1](https://github.com/conventional-changelog/conventional-changelog/compare/conventional-changelog-preset-loader@2.1.0...conventional-changelog-preset-loader@2.1.1) (2019-04-11) | ||
**Note:** Version bump only for package conventional-changelog-preset-loader | ||
# [2.1.0](https://github.com/conventional-changelog/conventional-changelog/compare/conventional-changelog-preset-loader@2.0.2...conventional-changelog-preset-loader@2.1.0) (2019-04-10) | ||
### Features | ||
* conventionalcommits preset, preMajor config option ([#434](https://github.com/conventional-changelog/conventional-changelog/issues/434)) ([dde12fe](https://github.com/conventional-changelog/conventional-changelog/commit/dde12fe)) | ||
## [2.0.2](https://github.com/conventional-changelog/conventional-changelog/compare/conventional-changelog-preset-loader@2.0.1...conventional-changelog-preset-loader@2.0.2) (2018-11-01) | ||
@@ -8,0 +27,0 @@ |
30
index.js
@@ -7,4 +7,15 @@ 'use strict' | ||
return path => { | ||
let scope = `` | ||
let name = path.toLowerCase() | ||
let name = '' | ||
let scope = '' | ||
if (typeof path === 'string') { | ||
name = path.toLowerCase() | ||
} else if (typeof path === 'object' && path.name) { | ||
// Rather than a string preset name, options.preset can be an object | ||
// with a "name" key indicating the preset to load; additinoal key/value | ||
// pairs are assumed to be configuration for the preset. See the documentation | ||
// for a given preset for configuration available. | ||
name = path.name.toLowerCase() | ||
} else { | ||
throw Error('preset must be string or object with key name') | ||
} | ||
@@ -17,4 +28,17 @@ if (name[0] === `@`) { | ||
return requireMethod(`${scope}conventional-changelog-${name}`) | ||
try { | ||
const config = requireMethod(`${scope}conventional-changelog-${name}`) | ||
// rather than returning a promise, presets can return a builder function | ||
// which accepts a config object (allowing for customization) and returns | ||
// a promise. | ||
if (config && !config.then && typeof path === 'object') { | ||
return config(path) | ||
} else { | ||
// require returned a promise that resolves to a config object. | ||
return config | ||
} | ||
} catch (_) { | ||
throw Error('does not exist') | ||
} | ||
} | ||
} |
{ | ||
"name": "conventional-changelog-preset-loader", | ||
"version": "2.0.2", | ||
"version": "2.1.1", | ||
"description": "Configuration preset loader for `conventional-changelog`.", | ||
@@ -28,3 +28,3 @@ "repository": { | ||
}, | ||
"gitHead": "f301b0de0b954713a50b2256a3140e21817d14c0" | ||
"gitHead": "c0314ad9cd0b30d456a65385b70988cd5f4b3410" | ||
} |
@@ -17,2 +17,3 @@ # [![NPM version][npm-image]][npm-url] [![Build Status: Linux][travis-image]][travis-url] [![Build Status: Windows][appveyor-image]][appveyor-url] [![Dependency Status][daviddm-image]][daviddm-url] [![Coverage Status][coveralls-image]][coveralls-url] | ||
The string that is passed to the preset loader is manipulated by prepending `conventional-changelog` to the name. | ||
@@ -19,0 +20,0 @@ |
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
10655
39
42