Skip to content

Commit 11648b9

Browse files
committed
chore: Add standard-version and changelog generator
1 parent a2dc5e4 commit 11648b9

File tree

10 files changed

+5637
-2
lines changed

10 files changed

+5637
-2
lines changed

.editorconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,7 @@ tab_width = 2
1313
[{*.rb,*.gemspec,Rakefile,Gemfile,Gemfile.lock}]
1414
indent_style = space
1515
tab_width = 2
16+
17+
[*.js]
18+
indent_style = space
19+
tab_width = 2

.versionrc.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
module.exports = {
2+
tagPrefix: '',
3+
infile: 'CHANGELOG.md',
4+
preset: {
5+
name: 'conventionalcommits'
6+
},
7+
bumpFiles: [
8+
{
9+
filename: 'lc-lib/core/version.go',
10+
updater: 'contrib/version-updaters/version.go.js'
11+
},
12+
{
13+
filename: 'ruby/log-courier/lib/log-courier/version.rb',
14+
updater: 'contrib/version-updaters/version.rb.js'
15+
},
16+
{
17+
filename: 'ruby/log-courier/log-courier.gemspec',
18+
updater: 'contrib/version-updaters/gemspec.js'
19+
},
20+
{
21+
filename: 'ruby/logstash-input-courier/logstash-input-courier.gemspec',
22+
updater: 'contrib/version-updaters/gemspec.js'
23+
},
24+
{
25+
filename: 'ruby/logstash-output-courier/logstash-output-courier.gemspec',
26+
updater: 'contrib/version-updaters/gemspec.js'
27+
}
28+
]
29+
};

commitlint.config.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module.exports = {
2+
extends: ['@commitlint/config-conventional'],
3+
rules: {
4+
// Disable subject-case
5+
'subject-case': [
6+
0,
7+
'never',
8+
['sentence-case', 'start-case', 'pascal-case', 'upper-case'],
9+
],
10+
// Dependabot and others exceed body and body line length so just disable it
11+
'body-max-length': [0, 'always', 100],
12+
'body-max-line-length': [0, 'always', 100],
13+
// Allow longer header length
14+
'header-max-length': [2, 'always', 150]
15+
}
16+
};
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module.exports = {
2+
readVersion(contents) {
3+
const match = contents.match(/gem.version\s+= '([^']+)'/)
4+
if (!match) {
5+
throw new Error('Could not parse gemspec');
6+
}
7+
return match[1];
8+
},
9+
writeVersion(contents, version) {
10+
return contents
11+
.replace(/(gem.version\s+=) '[^']+'/, `$1 '${version}'`)
12+
.replace(/(gem.add_runtime_dependency 'log-courier',) '= [^']+'/, `$1 '= ${version}'`);
13+
}
14+
};
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
module.exports = {
2+
readVersion(contents) {
3+
const match = contents.match(/LogCourierVersion string = "([^"]+)"/)
4+
if (!match) {
5+
throw new Error('Could not parse version.go');
6+
}
7+
return match[1];
8+
},
9+
writeVersion(contents, version) {
10+
const [major, minor, patch] = version.split('.');
11+
return contents
12+
.replace(/(LogCourierMajorVersion uint32 =) \d+/, `$1 ${major}`)
13+
.replace(/(LogCourierMinorVersion uint32 =) \d+/, `$1 ${minor}`)
14+
.replace(/(LogCourierPatchVersion uint32 =) \d+/, `$1 ${patch}`)
15+
.replace(/(LogCourierVersion string =) "[^"]+"/, `$1 "${version}"`);
16+
}
17+
};
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
module.exports = {
2+
readVersion(contents) {
3+
const match = contents.match(/VERSION = '([^']+)'/)
4+
if (!match) {
5+
throw new Error('Could not parse version.rb');
6+
}
7+
return match[1];
8+
},
9+
writeVersion(contents, version) {
10+
const [major, minor, patch] = version.split('.');
11+
return contents
12+
.replace(/(MAJOR_VERSION =) \d+/, `$1 ${major}`)
13+
.replace(/(MINOR_VERSION =) \d+/, `$1 ${minor}`)
14+
.replace(/(PATCH_VERSION =) \d+/, `$1 ${patch}`)
15+
.replace(/(VERSION =) '[^']+'/, `$1 '${version}'`);
16+
}
17+
};

0 commit comments

Comments
 (0)