Compare commits
3 Commits
6d1edebaaa
...
4ce334a081
Author | SHA1 | Date | |
---|---|---|---|
4ce334a081 | |||
9c070afde7 | |||
95ab20826e |
@ -41,8 +41,7 @@ export const CreatedModifiedDate: QuartzTransformerPlugin<Partial<Options>> = (u
|
||||
let published: MaybeDate = undefined
|
||||
|
||||
const fp = file.data.filePath!
|
||||
const repoRoot = path.resolve(file.cwd, "content"); // Указываем путь к корневой папке репозитория
|
||||
const fullFp = path.isAbsolute(fp) ? fp : path.join(repoRoot, fp); // Создаем абсолютный путь
|
||||
const fullFp = path.isAbsolute(fp) ? fp : path.posix.join(file.cwd, fp)
|
||||
for (const source of opts.priority) {
|
||||
if (source === "filesystem") {
|
||||
const st = await fs.promises.stat(fullFp)
|
||||
@ -59,13 +58,12 @@ export const CreatedModifiedDate: QuartzTransformerPlugin<Partial<Options>> = (u
|
||||
// Get a reference to the main git repo.
|
||||
// It's either the same as the workdir,
|
||||
// or 1+ level higher in case of a submodule/subtree setup
|
||||
repo = Repository.discover(repoRoot)
|
||||
repo = Repository.discover("/usr/src/app/content")
|
||||
console.log(chalk.green(`Git repository found at: ${repo.path()}`));
|
||||
}
|
||||
|
||||
try {
|
||||
const relativePathToRepo = path.relative(repoRoot, fullFp);
|
||||
modified ||= await repo.getFileLatestModifiedDateAsync(relativePathToRepo)
|
||||
modified ||= await repo.getFileLatestModifiedDateAsync(fullFp!)
|
||||
} catch {
|
||||
console.log(
|
||||
chalk.yellow(
|
||||
|
Loading…
Reference in New Issue
Block a user