@docusaurus/plugin-content-docs 0.0.0-4742 → 0.0.0-4743
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/lastUpdate.js +7 -1
- package/package.json +9 -9
- package/src/lastUpdate.ts +15 -2
package/lib/lastUpdate.js
CHANGED
|
@@ -11,6 +11,7 @@ const tslib_1 = require("tslib");
|
|
|
11
11
|
const logger_1 = tslib_1.__importDefault(require("@docusaurus/logger"));
|
|
12
12
|
const utils_1 = require("@docusaurus/utils");
|
|
13
13
|
let showedGitRequirementError = false;
|
|
14
|
+
let showedFileNotTrackedError = false;
|
|
14
15
|
async function getFileLastUpdate(filePath) {
|
|
15
16
|
if (!filePath) {
|
|
16
17
|
return null;
|
|
@@ -29,8 +30,13 @@ async function getFileLastUpdate(filePath) {
|
|
|
29
30
|
logger_1.default.warn('Sorry, the docs plugin last update options require Git.');
|
|
30
31
|
showedGitRequirementError = true;
|
|
31
32
|
}
|
|
33
|
+
else if (err instanceof utils_1.FileNotTrackedError &&
|
|
34
|
+
!showedFileNotTrackedError) {
|
|
35
|
+
logger_1.default.warn('Cannot infer the update date for some files, as they are not tracked by git.');
|
|
36
|
+
showedFileNotTrackedError = true;
|
|
37
|
+
}
|
|
32
38
|
else {
|
|
33
|
-
logger_1.default.
|
|
39
|
+
logger_1.default.warn(err);
|
|
34
40
|
}
|
|
35
41
|
return null;
|
|
36
42
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/plugin-content-docs",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-4743",
|
|
4
4
|
"description": "Docs plugin for Docusaurus.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
},
|
|
24
24
|
"license": "MIT",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@docusaurus/core": "0.0.0-
|
|
27
|
-
"@docusaurus/logger": "0.0.0-
|
|
28
|
-
"@docusaurus/mdx-loader": "0.0.0-
|
|
29
|
-
"@docusaurus/utils": "0.0.0-
|
|
30
|
-
"@docusaurus/utils-validation": "0.0.0-
|
|
26
|
+
"@docusaurus/core": "0.0.0-4743",
|
|
27
|
+
"@docusaurus/logger": "0.0.0-4743",
|
|
28
|
+
"@docusaurus/mdx-loader": "0.0.0-4743",
|
|
29
|
+
"@docusaurus/utils": "0.0.0-4743",
|
|
30
|
+
"@docusaurus/utils-validation": "0.0.0-4743",
|
|
31
31
|
"combine-promises": "^1.1.0",
|
|
32
32
|
"fs-extra": "^10.0.1",
|
|
33
33
|
"import-fresh": "^3.3.0",
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"webpack": "^5.70.0"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
-
"@docusaurus/module-type-aliases": "0.0.0-
|
|
43
|
-
"@docusaurus/types": "0.0.0-
|
|
42
|
+
"@docusaurus/module-type-aliases": "0.0.0-4743",
|
|
43
|
+
"@docusaurus/types": "0.0.0-4743",
|
|
44
44
|
"@types/js-yaml": "^4.0.5",
|
|
45
45
|
"@types/picomatch": "^2.3.0",
|
|
46
46
|
"commander": "^5.1.0",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"engines": {
|
|
57
57
|
"node": ">=14"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "ab2b7ab1b254457b2b700d18245973fbd02c7f82"
|
|
60
60
|
}
|
package/src/lastUpdate.ts
CHANGED
|
@@ -6,11 +6,16 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import logger from '@docusaurus/logger';
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
getFileCommitDate,
|
|
11
|
+
FileNotTrackedError,
|
|
12
|
+
GitNotFoundError,
|
|
13
|
+
} from '@docusaurus/utils';
|
|
10
14
|
|
|
11
15
|
type FileLastUpdateData = {timestamp?: number; author?: string};
|
|
12
16
|
|
|
13
17
|
let showedGitRequirementError = false;
|
|
18
|
+
let showedFileNotTrackedError = false;
|
|
14
19
|
|
|
15
20
|
export async function getFileLastUpdate(
|
|
16
21
|
filePath?: string,
|
|
@@ -31,8 +36,16 @@ export async function getFileLastUpdate(
|
|
|
31
36
|
if (err instanceof GitNotFoundError && !showedGitRequirementError) {
|
|
32
37
|
logger.warn('Sorry, the docs plugin last update options require Git.');
|
|
33
38
|
showedGitRequirementError = true;
|
|
39
|
+
} else if (
|
|
40
|
+
err instanceof FileNotTrackedError &&
|
|
41
|
+
!showedFileNotTrackedError
|
|
42
|
+
) {
|
|
43
|
+
logger.warn(
|
|
44
|
+
'Cannot infer the update date for some files, as they are not tracked by git.',
|
|
45
|
+
);
|
|
46
|
+
showedFileNotTrackedError = true;
|
|
34
47
|
} else {
|
|
35
|
-
logger.
|
|
48
|
+
logger.warn(err);
|
|
36
49
|
}
|
|
37
50
|
return null;
|
|
38
51
|
}
|