mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
only update latest docs if they are actually latest version
This commit is contained in:
@@ -36,12 +36,18 @@ module.exports = function(currentVersion){
|
||||
try {
|
||||
versions = fs.readdirSync(path.resolve(__dirname, '../../dist/ionic-site/docs'))
|
||||
.filter(semver.valid)
|
||||
.sort(semver.rcompare);
|
||||
} catch(e) {
|
||||
versions = [];
|
||||
}
|
||||
|
||||
!_.contains(versions, currentVersion) && versions.unshift(currentVersion);
|
||||
// new version, add it to the versions list
|
||||
if (currentVersion != 'nightly' && !_.contains(versions, currentVersion)){
|
||||
versions.unshift(currentVersion);
|
||||
}
|
||||
|
||||
// sort by version so we can find latest
|
||||
versions.sort(semver.rcompare);
|
||||
// add nightly if it isn't in the list
|
||||
!_.contains(versions, 'nightly') && versions.unshift('nightly');
|
||||
|
||||
//First semver valid version is latest
|
||||
@@ -73,11 +79,9 @@ module.exports = function(currentVersion){
|
||||
// remove filename since we have multiple docTypes per file
|
||||
docPath = docPath.substring(0, docPath.lastIndexOf('/') + 1);
|
||||
docPath += doc.name + '/index.md';
|
||||
|
||||
var path = 'docs/' + (versionData.current.folder || '') +
|
||||
'api/' + docPath;
|
||||
'/api/' + docPath;
|
||||
|
||||
// console.log(path);
|
||||
return path;
|
||||
}
|
||||
}];
|
||||
|
||||
Reference in New Issue
Block a user