mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-02 02:42:41 +02:00
fix(content-docs): warn when files are not tracked (#6937)
* fix(docs): warn when files are not tracked * chore(devcontainer): use non-root user * test: fix jest in vscode * test(docs): improve existing test * chore(devcontainer): fix jest error on startup * chore: fix comments * chore: remove "probably" from error message
This commit is contained in:
parent
e8a2f66a0f
commit
e19a4e23e7
10 changed files with 77 additions and 13 deletions
|
@ -10,6 +10,8 @@ import shell from 'shelljs';
|
|||
|
||||
export class GitNotFoundError extends Error {}
|
||||
|
||||
export class FileNotTrackedError extends Error {}
|
||||
|
||||
export const getFileCommitDate = (
|
||||
file: string,
|
||||
{
|
||||
|
@ -70,6 +72,13 @@ export const getFileCommitDate = (
|
|||
}
|
||||
|
||||
const output = result.stdout.trim();
|
||||
|
||||
if (!output) {
|
||||
throw new FileNotTrackedError(
|
||||
`Failed to retrieve the git history for file "${file}" because the file is not tracked by git.`,
|
||||
);
|
||||
}
|
||||
|
||||
const match = output.match(regex);
|
||||
|
||||
if (
|
||||
|
|
|
@ -21,7 +21,11 @@ export {
|
|||
WEBPACK_URL_LOADER_LIMIT,
|
||||
} from './constants';
|
||||
export {generate, genChunkName, readOutputHTMLFile} from './emitUtils';
|
||||
export {getFileCommitDate, GitNotFoundError} from './gitUtils';
|
||||
export {
|
||||
getFileCommitDate,
|
||||
FileNotTrackedError,
|
||||
GitNotFoundError,
|
||||
} from './gitUtils';
|
||||
export {
|
||||
mergeTranslations,
|
||||
updateTranslationFileMessages,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue