Skip to content

Commit

Permalink
deps: bump Docusaurus (#381)
Browse files Browse the repository at this point in the history
  • Loading branch information
zlataovce committed May 6, 2024
1 parent 365930f commit 76c6c6e
Show file tree
Hide file tree
Showing 4 changed files with 1,267 additions and 1,249 deletions.
30 changes: 15 additions & 15 deletions package.json
Expand Up @@ -16,17 +16,17 @@
"format:check": "prettier . --check"
},
"dependencies": {
"@docusaurus/core": "3.2.1",
"@docusaurus/plugin-content-docs": "3.2.1",
"@docusaurus/plugin-content-pages": "3.2.1",
"@docusaurus/plugin-debug": "3.2.1",
"@docusaurus/plugin-pwa": "3.2.1",
"@docusaurus/plugin-sitemap": "3.2.1",
"@docusaurus/plugin-vercel-analytics": "3.2.1",
"@docusaurus/theme-classic": "3.2.1",
"@docusaurus/theme-common": "3.2.1",
"@docusaurus/theme-mermaid": "3.2.1",
"@docusaurus/theme-search-algolia": "3.2.1",
"@docusaurus/core": "3.3.2",
"@docusaurus/plugin-content-docs": "3.3.2",
"@docusaurus/plugin-content-pages": "3.3.2",
"@docusaurus/plugin-debug": "3.3.2",
"@docusaurus/plugin-pwa": "3.3.2",
"@docusaurus/plugin-sitemap": "3.3.2",
"@docusaurus/plugin-vercel-analytics": "3.3.2",
"@docusaurus/theme-classic": "3.3.2",
"@docusaurus/theme-common": "3.3.2",
"@docusaurus/theme-mermaid": "3.3.2",
"@docusaurus/theme-search-algolia": "3.3.2",
"@floating-ui/react": "^0.26.13",
"@fontsource/jetbrains-mono": "5.0.20",
"@iconify/react": "4.1.1",
Expand All @@ -43,8 +43,8 @@
"sass": "^1.76.0"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "3.2.1",
"@docusaurus/types": "3.2.1",
"@docusaurus/module-type-aliases": "3.3.2",
"@docusaurus/types": "3.3.2",
"@fec/remark-a11y-emoji": "4.0.2",
"@tsconfig/docusaurus": "2.0.3",
"@types/is-ci": "3.0.4",
Expand Down Expand Up @@ -76,8 +76,8 @@
"packageManager": "pnpm@8.15.6+sha256.01c01eeb990e379b31ef19c03e9d06a14afa5250b82e81303f88721c99ff2e6f",
"pnpm": {
"patchedDependencies": {
"@docusaurus/plugin-content-docs@3.2.1": "patches/@docusaurus__plugin-content-docs@3.2.1.patch",
"@docusaurus/utils@3.2.1": "patches/@docusaurus__utils@3.2.1.patch"
"@docusaurus/plugin-content-docs@3.3.2": "patches/@docusaurus__plugin-content-docs@3.3.2.patch",
"@docusaurus/utils@3.3.2": "patches/@docusaurus__utils@3.3.2.patch"
}
}
}
@@ -1,5 +1,5 @@
diff --git a/lib/constants.js b/lib/constants.js
index f91e43f00e1f9160afa6a34ed1df71c90fe45a28..db04a015ea2d4474339b1d02f6fbec75ba14c894 100644
index f91e43f00e1f9160afa6a34ed1df71c90fe45a28..db04a015ea2d4474339b1d02f6fbec75ba14c894 100755
--- a/lib/constants.js
+++ b/lib/constants.js
@@ -10,8 +10,8 @@ exports.VERSIONS_JSON_FILE = exports.VERSIONED_SIDEBARS_DIR = exports.VERSIONED_
Expand All @@ -15,7 +15,7 @@ index f91e43f00e1f9160afa6a34ed1df71c90fe45a28..db04a015ea2d4474339b1d02f6fbec75
-exports.VERSIONS_JSON_FILE = 'versions.json';
+exports.VERSIONED_BASE_DIR = 'docs/versioned';
diff --git a/lib/versions/files.js b/lib/versions/files.js
index deaadb4357a348c8071b70d72a3c6d9e4e61459f..33f7604f2b93d579169681504b3656453c633fec 100644
index deaadb4357a348c8071b70d72a3c6d9e4e61459f..33f7604f2b93d579169681504b3656453c633fec 100755
--- a/lib/versions/files.js
+++ b/lib/versions/files.js
@@ -13,20 +13,20 @@ const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
Expand Down
@@ -1,5 +1,5 @@
diff --git a/src/gitUtils.ts b/src/gitUtils.ts
index 869982b2241c30629df3b83c7c75b9ce9f6a35d1..c3116d7a725d4a5420286baac8147f4e821e5631 100644
index 39a3ad754a0c5ab27cfb78c7b44a9f0be3785a62..c3116d7a725d4a5420286baac8147f4e821e5631 100755
--- a/src/gitUtils.ts
+++ b/src/gitUtils.ts
@@ -95,6 +95,13 @@ export async function getFileCommitDate(
Expand All @@ -16,76 +16,59 @@ index 869982b2241c30629df3b83c7c75b9ce9f6a35d1..c3116d7a725d4a5420286baac8147f4e
if (!hasGit()) {
throw new GitNotFoundError(
`Failed to retrieve git history for "${file}" because git is not installed.`,
@@ -106,22 +113,39 @@ export async function getFileCommitDate(
@@ -106,19 +113,28 @@ export async function getFileCommitDate(
`Failed to retrieve git history for "${file}" because the file does not exist.`,
);
}
+}
+

+function createArgs(format: string, includeAuthor?: boolean, age: 'oldest' | 'newest' = 'oldest') {
+ // We add a "RESULT:" prefix to make parsing easier
+ // See why: https://github.com/facebook/docusaurus/pull/10022
+ const resultFormat = includeAuthor ? 'RESULT:%ct,%an' : 'RESULT:%ct';
// We add a "RESULT:" prefix to make parsing easier
// See why: https://github.com/facebook/docusaurus/pull/10022
const resultFormat = includeAuthor ? 'RESULT:%ct,%an' : 'RESULT:%ct';

const args = [
- `--format=%ct${includeAuthor ? ',%an' : ''}`,
- `--format=${resultFormat}`,
+ `--format=${includeAuthor === undefined ? format : resultFormat}`,
'--max-count=1',
age === 'oldest' ? '--follow --diff-filter=A' : undefined,
]
.filter(Boolean)
.join(' ');

+ return args;
+}
+async function runGitCommandOnFile(file: string, args: string): Promise<{
+ code: number;
+ stdout: string;
+ stderr: string;
+}> {
+ const command = `git -c log.showSignature=false log ${args} -- "${path.basename(
+ file,
+ )}"`;
+
const result = await new Promise<{
code: number;
stdout: string;
stderr: string;
}>((resolve) => {
shell.exec(
- `git log ${args} -- "${path.basename(file)}"`,
+ command,
{
// Setting cwd is important, see: https://github.com/facebook/docusaurus/pull/5048
cwd: path.dirname(file),
@@ -138,11 +162,19 @@ export async function getFileCommitDate(
`Failed to retrieve the git history for file "${file}" with exit code ${result.code}: ${result.stderr}`,
const command = `git -c log.showSignature=false log ${args} -- "${path.basename(
file,
)}"`;
@@ -147,12 +163,18 @@ export async function getFileCommitDate(
);
}
- let regex = /^(?<timestamp>\d+)$/;
- if (includeAuthor) {
- regex = /^(?<timestamp>\d+),(?<author>.+)$/;
- }


+ return result;
+}
+function retrieveCorrectRegex(includeAuthor: boolean) {
+ // We only parse the output line starting with our "RESULT:" prefix
+ // See why https://github.com/facebook/docusaurus/pull/10022
+ const regex = includeAuthor
+ ? /(?:^|\n)RESULT:(?<timestamp>\d+),(?<author>.+)(?:$|\n)/
+ : /(?:^|\n)RESULT:(?<timestamp>\d+)(?:$|\n)/;
+
// We only parse the output line starting with our "RESULT:" prefix
// See why https://github.com/facebook/docusaurus/pull/10022
const regex = includeAuthor
? /(?:^|\n)RESULT:(?<timestamp>\d+),(?<author>.+)(?:$|\n)/
: /(?:^|\n)RESULT:(?<timestamp>\d+)(?:$|\n)/;

+ return regex;
+}
+function matchFromRegex(file: string, regex: RegExp, result: { code: number; stdout: string; stderr: string; }): RegExpMatchArray {
const output = result.stdout.trim();

if (!output) {
@@ -159,6 +191,13 @@ export async function getFileCommitDate(
@@ -169,6 +191,13 @@ export async function getFileCommitDate(
);
}

+ return match;
+}
+function matchDateAndTimestamp(match: RegExpMatchArray, includeAuthor: boolean): {
Expand All @@ -96,7 +79,7 @@ index 869982b2241c30629df3b83c7c75b9ce9f6a35d1..c3116d7a725d4a5420286baac8147f4e
const timestampInSeconds = Number(match.groups!.timestamp);
const timestamp = timestampInSeconds * 1_000;
const date = new Date(timestamp);
@@ -168,3 +207,29 @@ export async function getFileCommitDate(
@@ -178,3 +207,29 @@ export async function getFileCommitDate(
}
return {date, timestamp};
}
Expand Down

0 comments on commit 76c6c6e

Please sign in to comment.