refactor version patching extension
This commit is contained in:
parent
466b882d82
commit
c7d14e0c02
|
@ -1,39 +1,22 @@
|
|||
// https://gitlab.com/antora/antora/-/issues/132#note_712132072
|
||||
'use strict'
|
||||
|
||||
|
||||
module.exports.register = function({ config }) {
|
||||
this.on('contentAggregated', ({ contentAggregate }) => {
|
||||
contentAggregate.forEach(aggregate => {
|
||||
if (aggregate.name === "" && aggregate.displayVersion === 5.6) {
|
||||
aggregate.name = "ROOT";
|
||||
aggregate.version = "5.6.0-RC1"
|
||||
aggregate.startPage = "ROOT:index.adoc"
|
||||
aggregate.displayVersion = `${aggregate.version}`
|
||||
aggregate.prerelease = true
|
||||
module.exports.register = function () {
|
||||
this.once('contentAggregated', ({ contentAggregate }) => {
|
||||
contentAggregate.forEach((componentVersionBucket) => {
|
||||
if (componentVersionBucket.prerelease === 'true') componentVersionBucket.prerelease = true
|
||||
if (!componentVersionBucket.name && componentVersionBucket.displayVersion === '5.6') {
|
||||
componentVersionBucket.name = 'ROOT'
|
||||
componentVersionBucket.version = '5.6.0-RC1'
|
||||
delete componentVersionBucket.displayVersion
|
||||
componentVersionBucket.prerelease = true
|
||||
}
|
||||
else if (aggregate.version === "5.6.1" &&
|
||||
aggregate.prerelease == "-SNAPSHOT") {
|
||||
aggregate.version = "5.6.1"
|
||||
aggregate.displayVersion = `${aggregate.version}`
|
||||
aggregate.prerelease = true
|
||||
else if (componentVersionBucket.version === '5.6.1') {
|
||||
delete componentVersionBucket.prerelease
|
||||
}
|
||||
else if (aggregate.prerelease && aggregate.prerelease != true) {
|
||||
aggregate.version += aggregate.prerelease
|
||||
aggregate.prerelease = true
|
||||
else if (typeof componentVersionBucket.prerelease === 'string' && componentVersionBucket.prerelease !== '-SNAPSHOT') {
|
||||
componentVersionBucket.version += componentVersionBucket.prerelease
|
||||
componentVersionBucket.prerelease = true
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function out(args) {
|
||||
console.log(JSON.stringify(args, no_data, 2));
|
||||
}
|
||||
|
||||
|
||||
function no_data(key, value) {
|
||||
if (key == "data" || key == "files") {
|
||||
return value ? "__data__" : value;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue