style: apply oxfmt across drifted files

This commit is contained in:
t8y2
2026-10-13 12:52:46 +08:00
parent 168fc4c63a
commit 1fb8f150fc
96 changed files with 2437 additions and 2735 deletions
+1 -3
View File
@@ -73,9 +73,7 @@ createServer(async (req, res) => {
res.writeHead(400);
return res.end();
}
const hit =
(await tryFile(path)) ??
(path.endsWith("/") ? await tryFile(join(path, "index.html")) : await tryFile(`${path}.html`));
const hit = (await tryFile(path)) ?? (path.endsWith("/") ? await tryFile(join(path, "index.html")) : await tryFile(`${path}.html`));
if (hit) {
res.writeHead(200, { "content-type": hit.type, "cache-control": "no-store" });
return res.end(await readFile(hit.file));
+6 -8
View File
@@ -74,11 +74,7 @@ function ensureContributor(contributors, user) {
return contributor;
}
const [repositoryInfo, commitContributors, pullRequests] = await Promise.all([
request(`${apiBase}/repos/${repository}`).then((response) => response.json()),
fetchAll(`/repos/${repository}/contributors?anon=0`),
fetchAll(`/repos/${repository}/pulls?state=closed&sort=created&direction=desc`),
]);
const [repositoryInfo, commitContributors, pullRequests] = await Promise.all([request(`${apiBase}/repos/${repository}`).then((response) => response.json()), fetchAll(`/repos/${repository}/contributors?anon=0`), fetchAll(`/repos/${repository}/pulls?state=closed&sort=created&direction=desc`)]);
const contributors = new Map();
@@ -97,9 +93,11 @@ for (const entry of commitContributors) {
if (contributor) contributor.commits = entry.contributions || 0;
}
const rankedContributors = [...contributors.values()].filter((contributor) => contributor.mergedPullRequests > 0).sort((left, right) => {
return right.commits - left.commits || right.mergedPullRequests - left.mergedPullRequests || left.login.localeCompare(right.login);
});
const rankedContributors = [...contributors.values()]
.filter((contributor) => contributor.mergedPullRequests > 0)
.sort((left, right) => {
return right.commits - left.commits || right.mergedPullRequests - left.mergedPullRequests || left.login.localeCompare(right.login);
});
const output = {
repository,
+4 -13
View File
@@ -78,10 +78,7 @@ for (const file of files) {
}
const languagePattern = LANGUAGES.join("|");
const links = [
...content.matchAll(new RegExp(`\\]\\(/(${languagePattern})/docs/([^)#?]+)(?:#[^)]*)?\\)`, "g")),
...content.matchAll(new RegExp(`href="/(${languagePattern})/docs/([^"#?]+)(?:#[^"]*)?"`, "g")),
];
const links = [...content.matchAll(new RegExp(`\\]\\(/(${languagePattern})/docs/([^)#?]+)(?:#[^)]*)?\\)`, "g")), ...content.matchAll(new RegExp(`href="/(${languagePattern})/docs/([^"#?]+)(?:#[^"]*)?"`, "g"))];
for (const link of links) {
const [, language, slug] = link;
@@ -93,18 +90,14 @@ for (const file of files) {
const databaseSupportSource = fs.readFileSync(path.join(repositoryDir, "docs/data/databaseSupport.ts"), "utf8");
const connectionProfilesSource = fs.readFileSync(path.join(repositoryDir, "apps/desktop/src/types/generated/connectionProfiles.ts"), "utf8");
const jdbcProductProfilesSource = fs.readFileSync(path.join(repositoryDir, "apps/desktop/src/lib/database/jdbcProductProfiles.ts"), "utf8");
const connectionOptionsMatch = connectionProfilesSource.match(
/export const CONNECTION_PICKER_OPTIONS = \[([\s\S]*?)\n\] as const satisfies readonly ConnectionPickerOption\[\];/,
);
const connectionOptionsMatch = connectionProfilesSource.match(/export const CONNECTION_PICKER_OPTIONS = \[([\s\S]*?)\n\] as const satisfies readonly ConnectionPickerOption\[\];/);
const jdbcProductProfilesMatch = jdbcProductProfilesSource.match(/JDBC_PRODUCT_PROFILES = \[([^\]]*)\]/);
if (!connectionOptionsMatch) {
errors.push("Unable to read database options from connectionProfiles.ts");
} else {
const connectionModeIds = new Set(["custom_mysql", "custom_postgres"]);
const connectionIds = [...connectionOptionsMatch[1].matchAll(/value: "([^"]+)"/g)]
.map((match) => match[1])
.filter((id) => !connectionModeIds.has(id));
const connectionIds = [...connectionOptionsMatch[1].matchAll(/value: "([^"]+)"/g)].map((match) => match[1]).filter((id) => !connectionModeIds.has(id));
if (!jdbcProductProfilesMatch) {
errors.push("Unable to read registered JDBC product profiles");
@@ -129,9 +122,7 @@ if (!connectionOptionsMatch) {
}
}
const websiteIds = [...databaseSupportSource.matchAll(/\{ id: "([^"]+)"/g)]
.map((match) => match[1])
.filter((id) => id !== "request");
const websiteIds = [...databaseSupportSource.matchAll(/\{ id: "([^"]+)"/g)].map((match) => match[1]).filter((id) => id !== "request");
for (const [label, ids] of [
["connectionProfiles.ts", connectionIds],
+1 -7
View File
@@ -64,13 +64,7 @@ for (const requirement of requiredContent) {
console.log("Static export metadata verified for language, software schema, and llms.txt accuracy.");
const localizedHtmlFiles = files.filter(
(file) =>
extname(file) === ".html" &&
LANGUAGES.some(
(lang) => file === join(outputDirectory, `${lang}.html`) || file.startsWith(`${join(outputDirectory, lang)}${sep}`),
),
);
const localizedHtmlFiles = files.filter((file) => extname(file) === ".html" && LANGUAGES.some((lang) => file === join(outputDirectory, `${lang}.html`) || file.startsWith(`${join(outputDirectory, lang)}${sep}`)));
for (const file of localizedHtmlFiles) {
const content = await readFile(file, "utf8");