@possumtech/rummy 0.2.6 → 0.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +1 -1
- package/bin/rummy.js +9 -2
- package/package.json +1 -1
- package/service.js +1 -1
package/.env.example
CHANGED
package/bin/rummy.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import { existsSync } from "node:fs";
|
|
4
|
-
import { join, dirname } from "node:path";
|
|
4
|
+
import { isAbsolute, join, dirname } from "node:path";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
6
|
import { homedir } from "node:os";
|
|
7
7
|
|
|
@@ -9,10 +9,17 @@ const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
|
9
9
|
const packageRoot = join(__dirname, "..");
|
|
10
10
|
|
|
11
11
|
const rummyHome = process.env.RUMMY_HOME || join(homedir(), ".rummy");
|
|
12
|
-
process.env.RUMMY_HOME = rummyHome;
|
|
13
12
|
|
|
13
|
+
// Load defaults, then user overrides
|
|
14
14
|
process.loadEnvFile(join(packageRoot, ".env.example"));
|
|
15
15
|
const userEnv = join(rummyHome, ".env");
|
|
16
16
|
if (existsSync(userEnv)) process.loadEnvFile(userEnv);
|
|
17
17
|
|
|
18
|
+
// Resolve RUMMY_HOME and make DB path absolute relative to it
|
|
19
|
+
process.env.RUMMY_HOME = rummyHome;
|
|
20
|
+
const dbPath = process.env.RUMMY_DB_PATH;
|
|
21
|
+
if (dbPath && !isAbsolute(dbPath)) {
|
|
22
|
+
process.env.RUMMY_DB_PATH = join(rummyHome, dbPath);
|
|
23
|
+
}
|
|
24
|
+
|
|
18
25
|
await import(join(packageRoot, "service.js"));
|
package/package.json
CHANGED
package/service.js
CHANGED
|
@@ -53,7 +53,7 @@ async function main() {
|
|
|
53
53
|
await registerPlugins([pluginsDir, userPluginsDir], hooks);
|
|
54
54
|
|
|
55
55
|
// 5. Bootstrap Persistence
|
|
56
|
-
const dbPath = process.env.RUMMY_DB_PATH
|
|
56
|
+
const dbPath = process.env.RUMMY_DB_PATH;
|
|
57
57
|
const functionsDir = fileURLToPath(new URL("./src/sql/functions", import.meta.url));
|
|
58
58
|
const sqlFunctions = readdirSync(functionsDir)
|
|
59
59
|
.filter((f) => f.endsWith(".js") && !f.endsWith(".test.js"))
|