@@ -23,12 +23,15 @@ const devDepsNode = npmjson.devDependencies;
23
23
24
24
//------------------------------------------------------------------------------
25
25
// check if one of 'rf-changelog' or 'mt-changelog' is used by project
26
- const isCommitsChangelogUsed = devDepsNode &&
26
+ let isCommitsChangelogUsed = devDepsNode &&
27
27
devDepsNode [ 'rf-changelog' ] || devDepsNode [ 'mt-changelog' ] ;
28
28
if ( isCommitsChangelogUsed && ! which ( 'changelog' ) ) {
29
29
printErrorAndExit ( 'The "[rf|mt]-changelog" package is present in "devDependencies", but it is not installed.' ) ;
30
30
}
31
31
32
+ const isWithinMtChangelog = npmjson . name === 'mt-changelog' ;
33
+ isCommitsChangelogUsed = isCommitsChangelogUsed || isWithinMtChangelog ;
34
+
32
35
//------------------------------------------------------------------------------
33
36
// options
34
37
const configOptions = npmjson [ 'release-script' ] || { } ;
@@ -193,8 +196,10 @@ function release({ type, preid }) {
193
196
const versionAndNotes = notesForRelease = notesForRelease ? `${ vVersion } ${ notesForRelease } ` : vVersion ;
194
197
195
198
// generate changelog
199
+ // within mt-changelog at this stage `./bin/changelog` is already built and tested
200
+ const changelogCmd = isWithinMtChangelog ? './bin/changelog' : 'changelog' ;
196
201
if ( isCommitsChangelogUsed ) {
197
- run ( `changelog --title="${ versionAndNotes } " --out ${ changelog } ` ) ;
202
+ run ( `${ changelogCmd } --title="${ versionAndNotes } " --out ${ changelog } ` ) ;
198
203
safeRun ( `git add ${ changelog } ` ) ;
199
204
console . log ( 'Generated Changelog' . cyan ) ;
200
205
}
@@ -204,7 +209,7 @@ function release({ type, preid }) {
204
209
// tag and release
205
210
console . log ( 'Tagging: ' . cyan + vVersion . green ) ;
206
211
if ( isCommitsChangelogUsed ) {
207
- notesForRelease = run ( `changelog --title="${ versionAndNotes } " -s` ) ;
212
+ notesForRelease = run ( `${ changelogCmd } --title="${ versionAndNotes } " -s` ) ;
208
213
safeRun ( `changelog --title="${ versionAndNotes } " -s | git tag -a -F - ${ vVersion } ` ) ;
209
214
} else {
210
215
safeRun ( `git tag -a --message="${ versionAndNotes } " ${ vVersion } ` ) ;
0 commit comments