release-it
Advanced tools
Comparing version 15.8.0 to 15.9.0
@@ -27,3 +27,3 @@ import _ from 'lodash'; | ||
const { changelog } = this.config.getContext(); | ||
const releaseNotes = script ? await this.exec(script) : changelog; | ||
const releaseNotes = script ? await this.processReleaseNotes(script) : changelog; | ||
this.setContext({ releaseNotes }); | ||
@@ -35,2 +35,11 @@ if (releaseNotes !== changelog) { | ||
async processReleaseNotes(script) { | ||
if (typeof script === 'function') { | ||
const ctx = Object.assign({}, this.config.getContext(), { [this.namespace]: this.getContext() }); | ||
return script(ctx); | ||
} else { | ||
return this.exec(script); | ||
} | ||
} | ||
afterRelease() { | ||
@@ -37,0 +46,0 @@ const { isReleased, releaseUrl } = this.getContext(); |
{ | ||
"name": "release-it", | ||
"version": "15.8.0", | ||
"version": "15.9.0", | ||
"description": "Generic CLI tool to automate versioning and package publishing related tasks.", | ||
@@ -67,3 +67,3 @@ "keywords": [ | ||
"cosmiconfig": "8.1.0", | ||
"execa": "7.0.0", | ||
"execa": "7.1.1", | ||
"git-url-parse": "13.1.0", | ||
@@ -77,3 +77,3 @@ "globby": "13.1.3", | ||
"new-github-release-url": "2.0.0", | ||
"node-fetch": "3.3.0", | ||
"node-fetch": "3.3.1", | ||
"open": "8.4.2", | ||
@@ -94,3 +94,3 @@ "ora": "6.1.2", | ||
"ava": "5.2.0", | ||
"eslint": "8.35.0", | ||
"eslint": "8.36.0", | ||
"eslint-config-prettier": "8.7.0", | ||
@@ -105,3 +105,3 @@ "eslint-plugin-ava": "14.0.0", | ||
"prettier": "2.8.4", | ||
"sinon": "15.0.1", | ||
"sinon": "15.0.2", | ||
"strip-ansi": "7.0.1" | ||
@@ -108,0 +108,0 @@ }, |
@@ -167,2 +167,31 @@ import test from 'ava'; | ||
test('should create custom release notes using releaseNotes function', async t => { | ||
const options = { | ||
git, | ||
github: { | ||
pushRepo, | ||
tokenRef, | ||
release: true, | ||
releaseName: 'Release ${tagName}', | ||
releaseNotes(context) { | ||
return `Custom notes for tag ${context.tagName}`; | ||
} | ||
} | ||
}; | ||
const github = factory(GitHub, { options }); | ||
const exec = sinon.stub(github.shell, 'exec').callThrough(); | ||
exec.withArgs('git describe --tags --match=* --abbrev=0').resolves('2.0.1'); | ||
interceptAuthentication(); | ||
interceptCollaborator(); | ||
interceptCreate({ body: { tag_name: '2.0.2', name: 'Release 2.0.2', body: 'Custom notes for tag 2.0.2' } }); | ||
await runTasks(github); | ||
const { isReleased, releaseUrl } = github.getContext(); | ||
t.true(isReleased); | ||
t.is(releaseUrl, 'https://github.com/user/repo/releases/tag/2.0.2'); | ||
exec.restore(); | ||
}); | ||
test('should create new release for unreleased tag', async t => { | ||
@@ -169,0 +198,0 @@ const options = { |
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
226756
5457
+ Addedexeca@7.1.1(transitive)
+ Addednode-fetch@3.3.1(transitive)
- Removedexeca@7.0.0(transitive)
- Removednode-fetch@3.3.0(transitive)
Updatedexeca@7.1.1
Updatednode-fetch@3.3.1