Skip to content

Commit 6de01f3

Browse files
committed
feat: understands --config <FILE> option in conventionalChangelogArgs
1 parent f8a1ddb commit 6de01f3

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
const fs = require('fs');
2+
import prepareParams from '../updateChangelog';
3+
import tempWrite from 'temp-write';
4+
5+
describe('prepareParams', () => {
6+
it('loads configuration from --config option', () => {
7+
const config = {
8+
writerOpts: {
9+
headerPartial: '## {{version}}',
10+
},
11+
};
12+
const configString = `module.exports = { ${config} };`;
13+
const configPath = tempWrite.sync(configString);
14+
const configDir = path.basename(path.dirname(configPath));
15+
16+
const { args } = prepareParams({
17+
dir: configDir,
18+
conventionalChangelogArgs: `--config ${configPath}`,
19+
revisionRange: '1.0.0..1.0.1',
20+
reject: () => {},
21+
});
22+
expect(args.config).toMatch(config);
23+
});
24+
});

packages/shipjs/src/step/prepare/updateChangelog.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ function prepareParams({
118118
}
119119
const templateContext =
120120
args.context && require(path.resolve(dir, args.context));
121+
if (args.config) {
122+
args.config = require(path.resolve(dir, args.config));
123+
}
121124
return { args, gitRawCommitsOpts, templateContext };
122125
}
123126

0 commit comments

Comments
 (0)