pg-here 0.1.3 → 0.1.4
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/README.md +1 -1
- package/bin/pg-here.mjs +44 -0
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -31,7 +31,7 @@ If you have Bun installed, you can run the published package directly:
|
|
|
31
31
|
bunx pg-here
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
If this command
|
|
34
|
+
If this command fails with `could not determine executable to run for package`, install at least `pg-here@0.1.4` (this is the first release with a real package binary).
|
|
35
35
|
|
|
36
36
|
This starts a local PostgreSQL instance in your current project directory and prints the connection string, then keeps the process alive until you stop it.
|
|
37
37
|
|
package/bin/pg-here.mjs
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import yargs from "yargs";
|
|
4
|
+
import { hideBin } from "yargs/helpers";
|
|
5
|
+
import { startPgHere } from "../dist/index.js";
|
|
6
|
+
|
|
7
|
+
const argv = await yargs(hideBin(process.argv))
|
|
8
|
+
.version(false)
|
|
9
|
+
.option("username", {
|
|
10
|
+
alias: "u",
|
|
11
|
+
default: "postgres",
|
|
12
|
+
describe: "PostgreSQL username",
|
|
13
|
+
})
|
|
14
|
+
.option("password", {
|
|
15
|
+
alias: "p",
|
|
16
|
+
default: "postgres",
|
|
17
|
+
describe: "PostgreSQL password",
|
|
18
|
+
})
|
|
19
|
+
.option("port", {
|
|
20
|
+
default: 55432,
|
|
21
|
+
describe: "PostgreSQL port",
|
|
22
|
+
})
|
|
23
|
+
.option("database", {
|
|
24
|
+
alias: "d",
|
|
25
|
+
default: "postgres",
|
|
26
|
+
describe: "Database to use (created automatically if missing)",
|
|
27
|
+
})
|
|
28
|
+
.option("pg-version", {
|
|
29
|
+
default: process.env.PG_VERSION,
|
|
30
|
+
describe: "PostgreSQL version (e.g. 18.0.0 or >=17.0)",
|
|
31
|
+
})
|
|
32
|
+
.parse();
|
|
33
|
+
|
|
34
|
+
const pg = await startPgHere({
|
|
35
|
+
projectDir: process.cwd(),
|
|
36
|
+
port: argv.port,
|
|
37
|
+
username: argv.username,
|
|
38
|
+
password: argv.password,
|
|
39
|
+
database: argv.database,
|
|
40
|
+
postgresVersion: argv["pg-version"],
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
console.log(pg.databaseConnectionString);
|
|
44
|
+
setInterval(() => {}, 1 << 30);
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pg-here",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Per-project embedded PostgreSQL with programmatic startup and auto DB creation.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
8
|
"bin": {
|
|
9
|
-
"pg-here": "
|
|
9
|
+
"pg-here": "bin/pg-here.mjs"
|
|
10
10
|
},
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"files": [
|
|
18
18
|
"dist",
|
|
19
19
|
"index.ts",
|
|
20
|
+
"bin/pg-here.mjs",
|
|
20
21
|
"scripts/pg-dev.mjs",
|
|
21
22
|
"README.md"
|
|
22
23
|
],
|