mirror of
https://github.com/facebook/docusaurus.git
synced 2025-04-29 18:27:56 +02:00
Allow multiple -
in a version string (#457)
* Allow multiple `-` in a version string Right now we were assuming that there would be no `-` in a version. That was breaking things. This allows more flexibility for versions like: 1.0.0-beta.2 Ref #455 Fixes #450 * Check more specific strings - need to look for the original_id
This commit is contained in:
parent
f79cfaa3a1
commit
ec6ff9284c
1 changed files with 8 additions and 1 deletions
|
@ -120,7 +120,14 @@ files.forEach(file => {
|
|||
if (!(metadata.original_id in available)) {
|
||||
available[metadata.original_id] = new Set();
|
||||
}
|
||||
const version = metadata.id.split('-')[1];
|
||||
// The version will be between "version-" and "-<metadata.original_id>"
|
||||
// e.g. version-1.0.0-beta.2-doc1 => 1.0.0-beta.2
|
||||
// e.g. version-1.0.0-doc2 => 1.0.0
|
||||
// e.g. version-1.0.0-getting-started => 1.0.0
|
||||
const version = metadata.id.substring(
|
||||
metadata.id.indexOf('version-') + 8, // version- is 8 characters
|
||||
metadata.id.lastIndexOf('-' + metadata.original_id)
|
||||
);
|
||||
available[metadata.original_id].add(version);
|
||||
|
||||
if (!(version in versionFiles)) {
|
||||
|
|
Loading…
Add table
Reference in a new issue