mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-10 23:57:22 +02:00
feat: last updated time in docs (#913)
* Adding last updated time for docs * Making file path general and other suggested changes * Checking if time returned is null due to absence of git or some other issue * Adding option to enable/disable update time feature and test-doc * Adding simple unit tests for getGitUpdateTime() * nits & rewrote failing test * consistent test naming * Adding optional updateEnableTime in documentation * package-lock & yarn.lock
This commit is contained in:
parent
5542ace288
commit
1a572757f1
10 changed files with 170 additions and 14 deletions
|
@ -15,7 +15,7 @@ const readMetadata = require('./readMetadata.js');
|
|||
const {insertTOC} = require('../core/toc.js');
|
||||
const {getPath} = require('../core/utils.js');
|
||||
|
||||
function getFile(metadata) {
|
||||
function getFilePath(metadata) {
|
||||
if (!metadata) {
|
||||
return null;
|
||||
}
|
||||
|
@ -31,6 +31,14 @@ function getFile(metadata) {
|
|||
} else {
|
||||
file = join(CWD, '..', readMetadata.getDocsPath(), metadata.source);
|
||||
}
|
||||
return file;
|
||||
}
|
||||
|
||||
function getFile(metadata) {
|
||||
if (!metadata) {
|
||||
return null;
|
||||
}
|
||||
const file = getFilePath(metadata);
|
||||
if (!fs.existsSync(file)) {
|
||||
return null;
|
||||
}
|
||||
|
@ -123,6 +131,7 @@ function getRedirectMarkup(metadata) {
|
|||
module.exports = {
|
||||
getMarkup,
|
||||
getFile,
|
||||
getFilePath,
|
||||
getRedirectMarkup,
|
||||
mdToHtmlify,
|
||||
replaceAssetsLink,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue