@vuepress/plugin-git
Advanced tools
Comparing version 2.0.0-alpha.20 to 2.0.0-alpha.21
@@ -6,2 +6,13 @@ # Change Log | ||
# [2.0.0-alpha.21](https://github.com/vuepress/vuepress-next/compare/v2.0.0-alpha.20...v2.0.0-alpha.21) (2021-02-05) | ||
### Features | ||
* **plugin-git:** collect page created time (close [#45](https://github.com/vuepress/vuepress-next/issues/45)) ([4045a8c](https://github.com/vuepress/vuepress-next/commit/4045a8c1ab591dbbb0303aa43c6d13bf248d995c)) | ||
# [2.0.0-alpha.20](https://github.com/vuepress/vuepress-next/compare/v2.0.0-alpha.19...v2.0.0-alpha.20) (2021-02-04) | ||
@@ -8,0 +19,0 @@ |
@@ -9,2 +9,6 @@ import type { Plugin } from '@vuepress/core'; | ||
/** | ||
* Whether to get the created time of a page | ||
*/ | ||
createdTime?: boolean; | ||
/** | ||
* Whether to get the updated time of a page | ||
@@ -11,0 +15,0 @@ */ |
@@ -17,3 +17,3 @@ "use strict"; | ||
__exportStar(require("./utils"), exports); | ||
const gitPlugin = ({ updatedTime, contributors }, app) => { | ||
const gitPlugin = ({ createdTime, updatedTime, contributors }, app) => { | ||
const cwd = app.dir.source(); | ||
@@ -28,2 +28,5 @@ const isGitRepoValid = utils_1.checkGitRepo(cwd); | ||
} | ||
if (createdTime !== false) { | ||
git.createdTime = await utils_1.getCreatedTime(page.filePathRelative, cwd); | ||
} | ||
if (updatedTime !== false) { | ||
@@ -30,0 +33,0 @@ git.updatedTime = await utils_1.getUpdatedTime(page.filePathRelative, cwd); |
@@ -6,2 +6,6 @@ export interface GitPluginPageData { | ||
/** | ||
* Unix timestamp in milliseconds of the first commit | ||
*/ | ||
createdTime?: number; | ||
/** | ||
* Unix timestamp in milliseconds of the last commit | ||
@@ -8,0 +12,0 @@ */ |
@@ -9,3 +9,3 @@ "use strict"; | ||
const getUpdatedTime = async (filePath, cwd) => { | ||
const { stdout } = await execa('git', ['log', '-1', '--format=%at', filePath], { | ||
const { stdout } = await execa('git', ['--no-pager', 'log', '-1', '--format=%at', filePath], { | ||
cwd, | ||
@@ -12,0 +12,0 @@ }); |
export * from './checkGitRepo'; | ||
export * from './getContributors'; | ||
export * from './getCreatedTime'; | ||
export * from './getUpdatedTime'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -15,3 +15,4 @@ "use strict"; | ||
__exportStar(require("./getContributors"), exports); | ||
__exportStar(require("./getCreatedTime"), exports); | ||
__exportStar(require("./getUpdatedTime"), exports); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@vuepress/plugin-git", | ||
"version": "2.0.0-alpha.20", | ||
"version": "2.0.0-alpha.21", | ||
"description": "VuePress plugin - git", | ||
@@ -37,3 +37,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "5c80ff3d24e4303734c87626b862ea04ff441ffa" | ||
"gitHead": "a5c48b69899762d89f18d643c7ce899274b10c1f" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18196
31
186