Closed northword closed 2 months ago
获取 Git 时间时,进入工作目录再运行 git,这样可以获取到 submodule 中的文件的时间,可以与 VitePress 原生的保持一致:https://github.com/vuejs/vitepress/blob/8fef47848bd3418014b06eea1337b1e66e0473c6/src/node/utils/getGitTimestamp.ts#L12-L17
其他类似的写法: VitePress-Plugin-Git-Changelog: https://github.com/nolebase/integrations/blob/f400cdf43f782744ed05a783f51208ec07fd800d/packages/vitepress-plugin-git-changelog/src/vite/helpers.ts#L224-L251
可以的,之前也是看了VitePress实现,可能没注意到这个细节。
那个判断目录是否存在的判断是否有存在的必要?
vitepress-plugin-rss@0.2.8
获取 Git 时间时,进入工作目录再运行 git,这样可以获取到 submodule 中的文件的时间,可以与 VitePress 原生的保持一致:https://github.com/vuejs/vitepress/blob/8fef47848bd3418014b06eea1337b1e66e0473c6/src/node/utils/getGitTimestamp.ts#L12-L17
其他类似的写法: VitePress-Plugin-Git-Changelog: https://github.com/nolebase/integrations/blob/f400cdf43f782744ed05a783f51208ec07fd800d/packages/vitepress-plugin-git-changelog/src/vite/helpers.ts#L224-L251