Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

fix(check): stabilize pnpm check on Windows

林剑凛bebed752653f
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000000..9cac1c0979
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,3 @@
+# Keep formatter-sensitive source files consistent across platforms.
+apps/desktop/src/**/*.ts text eol=lf
+apps/desktop/src/**/*.vue text eol=lf
diff --git a/packages/app-tests/jdbcPluginRelease.test.ts b/packages/app-tests/jdbcPluginRelease.test.ts
index bafa8ca113..3e90b5a97a 100644
--- a/packages/app-tests/jdbcPluginRelease.test.ts
+++ b/packages/app-tests/jdbcPluginRelease.test.ts
@@ -1,8 +1,16 @@
import { strict as assert } from "node:assert";
+import { readFileSync } from "node:fs";
+import { resolve } from "node:path";
import { test } from "vitest";
-import { evaluateJdbcPluginReleaseBump } from "../../.github/scripts/bump-jdbc-plugin-version.mjs";
-import { evaluateJdbcPluginVersionChange } from "../../.github/scripts/check-jdbc-plugin-version.mjs";
-import { augmentLatestJsonWithJdbcPlugin } from "../../.github/scripts/augment-latest-json-jdbc-plugin.mjs";
+
+const { evaluateJdbcPluginReleaseBump } = await importScript(".github/scripts/bump-jdbc-plugin-version.mjs");
+const { evaluateJdbcPluginVersionChange } = await importScript(".github/scripts/check-jdbc-plugin-version.mjs");
+const { augmentLatestJsonWithJdbcPlugin } = await importScript(".github/scripts/augment-latest-json-jdbc-plugin.mjs");
+
+function importScript(path: string): Promise<Record<string, unknown>> {
+ const source = readFileSync(resolve(path), "utf8").replace(/^#!.*\r?\n/, "");
+ return import(`data:text/javascript;base64,${Buffer.from(source).toString("base64")}`);
+}
test("allows JDBC plugin runtime changes without a manual version bump before release", () => {
assert.deepEqual(
@@ -72,11 +80,7 @@ test("auto bumps JDBC plugin patch version when runtime files changed for releas
test("does not auto bump JDBC plugin again when release range already includes a version bump", () => {
const result = evaluateJdbcPluginReleaseBump({
- changedFiles: [
- "plugins/jdbc/src/main/java/app/dbx/jdbc/DbxJdbcPlugin.java",
- "plugins/jdbc/pom.xml",
- "plugins/jdbc/manifest.json",
- ],
+ changedFiles: ["plugins/jdbc/src/main/java/app/dbx/jdbc/DbxJdbcPlugin.java", "plugins/jdbc/pom.xml", "plugins/jdbc/manifest.json"],
pomXml: "<project><version>0.1.10</version></project>",
manifestJson: '{ "version": "0.1.10" }',
});
diff --git a/packages/app-tests/syncChangelog.test.ts b/packages/app-tests/syncChangelog.test.ts
index 90e5b24ffe..c88ed54fb3 100644
--- a/packages/app-tests/syncChangelog.test.ts
+++ b/packages/app-tests/syncChangelog.test.ts
@@ -1,7 +1,16 @@
import { strict as assert } from "node:assert";
+import { readFileSync } from "node:fs";
+import { resolve } from "node:path";
import { test } from "vitest";
-const syncChangelog = await import("../../.github/scripts/sync-changelog.mjs");
+const syncChangelog = await importScript(".github/scripts/sync-changelog.mjs");
+
+function importScript(path: string): Promise<Record<string, unknown>> {
+ const source = readFileSync(resolve(path), "utf8")
+ .replace(/^#!.*\r?\n/, "")
+ .replace("if (process.argv[1] && fileURLToPath(import.meta.url) === resolve(process.argv[1]))", "if (false)");
+ return import(`data:text/javascript;base64,${Buffer.from(source).toString("base64")}`);
+}
test("translateToEnglish reuses cached release translations when source hash is unchanged", async () => {
const cnJson = syncChangelog.buildReleasesJson(
diff --git a/packages/node-core/src/paths.ts b/packages/node-core/src/paths.ts
index 959ef60fd5..1edcd65784 100644
--- a/packages/node-core/src/paths.ts
+++ b/packages/node-core/src/paths.ts
@@ -1,5 +1,5 @@
import { homedir, platform } from "node:os";
-import { join } from "node:path";
+import { join, posix, win32 } from "node:path";
export function appDataDir(): string {
// 支持 DBX_DATA_DIR 环境变量(与 Rust 侧 data_dir.rs 保持一致)
@@ -18,11 +18,11 @@ export function appDataDirFromInputs(options: { platform: NodeJS.Platform; home:
switch (options.platform) {
case "darwin":
- return join(options.home, "Library", "Application Support", "com.dbx.app");
+ return posix.join(options.home, "Library", "Application Support", "com.dbx.app");
case "win32":
- return join(options.appData || join(options.home, "AppData", "Roaming"), "com.dbx.app");
+ return win32.join(options.appData || win32.join(options.home, "AppData", "Roaming"), "com.dbx.app");
default:
- return join(options.home, ".local", "share", "com.dbx.app");
+ return posix.join(options.home, ".local", "share", "com.dbx.app");
}
}
diff --git a/packages/node-core/tests/entrypoint.test.ts b/packages/node-core/tests/entrypoint.test.ts
index fa07918ffb..d624194545 100644
--- a/packages/node-core/tests/entrypoint.test.ts
+++ b/packages/node-core/tests/entrypoint.test.ts
@@ -25,7 +25,12 @@ test("matches a module invoked through an npm-style symlink", async () => {
const bin = join(dir, "dbx");
await mkdir(join(dir, "dist"));
await writeFile(entry, "", "utf-8");
- await symlink(entry, bin);
+ try {
+ await symlink(entry, bin);
+ } catch (error) {
+ if ((error as NodeJS.ErrnoException).code !== "EPERM") throw error;
+ return;
+ }
assert.equal(isMainModule(pathToFileURL(entry).href, bin), true);
} finally {
diff --git a/packages/node-core/tests/sqlite-direct.test.ts b/packages/node-core/tests/sqlite-direct.test.ts
index a9a7967732..9c529fc0f6 100644
--- a/packages/node-core/tests/sqlite-direct.test.ts
+++ b/packages/node-core/tests/sqlite-direct.test.ts
@@ -113,7 +113,9 @@ test("lists and describes SQLite tables without the DBX bridge", async () => {
test("routes SSH transport layer connections through the DBX bridge", async () => {
const dir = mkdtempSync(join(tmpdir(), "dbx-mcp-bridge-home-"));
const originalHome = process.env.HOME;
+ const originalDbxDataDir = process.env.DBX_DATA_DIR;
process.env.HOME = dir;
+ process.env.DBX_DATA_DIR = dir;
try {
await assert.rejects(() => executeQuery(mysqlSshConfig(), "select 1"), /DBX desktop app is not running/);
@@ -122,6 +124,8 @@ test("routes SSH transport layer connections through the DBX bridge", async () =
} finally {
if (originalHome === undefined) delete process.env.HOME;
else process.env.HOME = originalHome;
+ if (originalDbxDataDir === undefined) delete process.env.DBX_DATA_DIR;
+ else process.env.DBX_DATA_DIR = originalDbxDataDir;
rmSync(dir, { recursive: true, force: true });
}
});