Skip to content

Commit

Permalink
feat: support antora 3.1.0-3
Browse files Browse the repository at this point in the history
weirdly antora 3.1.x lower cases the playbook config for our extensions so this commit adds respective alternatives to the constructors of the classes constructed from the playbook.

also did antora 3.1.0 cleanup exports so this commit adds a retry with renamed `git` export.
  • Loading branch information
jekkel committed May 19, 2023
1 parent 9f537f4 commit 2f00e6f
Show file tree
Hide file tree
Showing 6 changed files with 8,867 additions and 4,098 deletions.
8 changes: 7 additions & 1 deletion lib/extension.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,13 @@ class MavenContentSourceExtension {
.on('playbookBuilt', this.onPlaybookBuilt.bind(this))
this.config = config;
this.logger = this.antoraContext.getLogger('maven-content');
this.git = this.antoraContext.require('@antora/content-aggregator/lib/git.js')
try {
this.git = this.antoraContext.require('@antora/content-aggregator/lib/git.js')
} catch (e) {
// starting with antora 3.1 git export has been made explicit with a different name. So let's try the new one.
// see https://gitlab.com/antora/antora/-/issues/984
this.git = this.antoraContext.require('@antora/content-aggregator/git')
}
this.mavenClient = new MavenClient(this.logger);
this.contentSourceFactory = new ContentSourceFactory(this.mavenClient, this.git, this.logger);
}
Expand Down
44 changes: 22 additions & 22 deletions lib/maven-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ class MavenRepository {
baseUrl;
fetchOptions;

constructor({baseUrl, fetchOptions}) {
this.baseUrl = baseUrl;
this.fetchOptions = fetchOptions;
constructor({baseUrl, baseurl, fetchOptions, fetchoptions}) {
this.baseUrl = baseUrl || baseurl;
this.fetchOptions = fetchOptions || fetchoptions;
}

toString() {
Expand Down Expand Up @@ -54,39 +54,39 @@ class MavenContentCoordinate {
editUrl;

constructor({
groupId,
artifactId,
groupId, groupid,
artifactId, artifactid,
version = "*",
versionScheme = 'SemVer',
versionScheme, versionscheme,
classifier = 'docs',
extension = 'zip',
limit = 1,
limitBy = 'major',
includeSnapshots = false,
startPath = null,
startPaths = null,
includePrerelease = true,
editUrl = false
limitBy, limitby,
includeSnapshots, includesnapshots,
startPath, startpath,
startPaths, startpaths,
includePrerelease, includeprerelease,
editUrl, editurl
}) {
this.groupId = groupId;
this.artifactId = artifactId;
this.includeSnapshots = includeSnapshots;
this.startPath = startPath;
this.startPaths = startPaths;
this.groupId = groupId || groupid;
this.artifactId = artifactId || artifactid;
this.includeSnapshots = includeSnapshots || includesnapshots || false;
this.startPath = startPath || startpath || null;
this.startPaths = startPaths || startpaths || null;
this.version = version;
this.versionScheme = versioning[versionScheme];
this.versionScheme = versioning[versionScheme || versionscheme || 'SemVer'];
if (!this.versionScheme) {
throw new TypeError(`versionScheme must be one of "${Object.keys(versioning).join('", "')}"`);
}
this.versionRange = this.versionScheme.range(version, includePrerelease);
this.versionRange = this.versionScheme.range(version, includePrerelease || includeprerelease || true);
this.classifier = classifier;
this.extension = extension;
this.limit = limit;
this.limitBy = limitBy;
this.limitBy = limitBy || limitby || 'major';
if (!['major', 'minor', 'patch', 'any'].includes(this.limitBy)) {
throw new TypeError("limitBy must be one of 'major', 'minor', 'patch', 'any'");
}
this.editUrl = editUrl;
this.editUrl = editUrl || editurl || false;
}

toString() {
Expand Down Expand Up @@ -156,4 +156,4 @@ module.exports = {
MavenRepository,
MavenArtifact,
MavenContentCoordinate
}
}
Loading

0 comments on commit 2f00e6f

Please sign in to comment.