@docusaurus/plugin-content-docs 0.0.0-4742 → 0.0.0-4747
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.d.ts +4 -6
- package/lib/lastUpdate.js +7 -1
- package/package.json +9 -9
- package/src/lastUpdate.ts +16 -5
package/lib/lastUpdate.d.ts
CHANGED
|
@@ -4,9 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
declare
|
|
8
|
-
timestamp
|
|
9
|
-
author
|
|
10
|
-
}
|
|
11
|
-
export declare function getFileLastUpdate(filePath?: string): Promise<FileLastUpdateData | null>;
|
|
12
|
-
export {};
|
|
7
|
+
export declare function getFileLastUpdate(filePath?: string): Promise<{
|
|
8
|
+
timestamp: number;
|
|
9
|
+
author: string;
|
|
10
|
+
} | null>;
|
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-4747",
|
|
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-4747",
|
|
27
|
+
"@docusaurus/logger": "0.0.0-4747",
|
|
28
|
+
"@docusaurus/mdx-loader": "0.0.0-4747",
|
|
29
|
+
"@docusaurus/utils": "0.0.0-4747",
|
|
30
|
+
"@docusaurus/utils-validation": "0.0.0-4747",
|
|
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-4747",
|
|
43
|
+
"@docusaurus/types": "0.0.0-4747",
|
|
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": "ea3674ced376fb76245f4a371cb3894a64ee90b6"
|
|
60
60
|
}
|
package/src/lastUpdate.ts
CHANGED
|
@@ -6,15 +6,18 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import logger from '@docusaurus/logger';
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
import {
|
|
10
|
+
getFileCommitDate,
|
|
11
|
+
FileNotTrackedError,
|
|
12
|
+
GitNotFoundError,
|
|
13
|
+
} from '@docusaurus/utils';
|
|
12
14
|
|
|
13
15
|
let showedGitRequirementError = false;
|
|
16
|
+
let showedFileNotTrackedError = false;
|
|
14
17
|
|
|
15
18
|
export async function getFileLastUpdate(
|
|
16
19
|
filePath?: string,
|
|
17
|
-
): Promise<
|
|
20
|
+
): Promise<{timestamp: number; author: string} | null> {
|
|
18
21
|
if (!filePath) {
|
|
19
22
|
return null;
|
|
20
23
|
}
|
|
@@ -31,8 +34,16 @@ export async function getFileLastUpdate(
|
|
|
31
34
|
if (err instanceof GitNotFoundError && !showedGitRequirementError) {
|
|
32
35
|
logger.warn('Sorry, the docs plugin last update options require Git.');
|
|
33
36
|
showedGitRequirementError = true;
|
|
37
|
+
} else if (
|
|
38
|
+
err instanceof FileNotTrackedError &&
|
|
39
|
+
!showedFileNotTrackedError
|
|
40
|
+
) {
|
|
41
|
+
logger.warn(
|
|
42
|
+
'Cannot infer the update date for some files, as they are not tracked by git.',
|
|
43
|
+
);
|
|
44
|
+
showedFileNotTrackedError = true;
|
|
34
45
|
} else {
|
|
35
|
-
logger.
|
|
46
|
+
logger.warn(err);
|
|
36
47
|
}
|
|
37
48
|
return null;
|
|
38
49
|
}
|