@cedarjs/pg 0.1.0-alpha.0
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/LICENSE +21 -0
- package/README.md +153 -0
- package/dist/cli.cjs +139 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +140 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/constants-B7sCf4fg.cjs +41 -0
- package/dist/constants-B7sCf4fg.cjs.map +1 -0
- package/dist/constants-YnHDwShD.mjs +24 -0
- package/dist/constants-YnHDwShD.mjs.map +1 -0
- package/dist/index.cjs +26 -0
- package/dist/index.d.cts +201 -0
- package/dist/index.d.mts +201 -0
- package/dist/index.mjs +2 -0
- package/dist/jest.cjs +28 -0
- package/dist/jest.cjs.map +1 -0
- package/dist/jest.d.cts +14 -0
- package/dist/jest.d.mts +14 -0
- package/dist/jest.mjs +23 -0
- package/dist/jest.mjs.map +1 -0
- package/dist/lifecycle-D10usEjM.cjs +743 -0
- package/dist/lifecycle-D10usEjM.cjs.map +1 -0
- package/dist/lifecycle-PbTXNC2Z.mjs +577 -0
- package/dist/lifecycle-PbTXNC2Z.mjs.map +1 -0
- package/dist/nx.cjs +35 -0
- package/dist/nx.cjs.map +1 -0
- package/dist/nx.d.cts +26 -0
- package/dist/nx.d.mts +26 -0
- package/dist/nx.mjs +34 -0
- package/dist/nx.mjs.map +1 -0
- package/dist/tasks-CW2D0n46.mjs +16 -0
- package/dist/tasks-CW2D0n46.mjs.map +1 -0
- package/dist/tasks-DZ7hMmGJ.cjs +21 -0
- package/dist/tasks-DZ7hMmGJ.cjs.map +1 -0
- package/dist/vite-plus.cjs +65 -0
- package/dist/vite-plus.cjs.map +1 -0
- package/dist/vite-plus.d.cts +51 -0
- package/dist/vite-plus.d.mts +51 -0
- package/dist/vite-plus.mjs +61 -0
- package/dist/vite-plus.mjs.map +1 -0
- package/dist/vitest.cjs +33 -0
- package/dist/vitest.cjs.map +1 -0
- package/dist/vitest.d.cts +17 -0
- package/dist/vitest.d.mts +17 -0
- package/dist/vitest.mjs +28 -0
- package/dist/vitest.mjs.map +1 -0
- package/package.json +96 -0
- package/scripts/postinstall.js +61 -0
package/package.json
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cedarjs/pg",
|
|
3
|
+
"version": "0.1.0-alpha.0",
|
|
4
|
+
"description": "Worktree-isolated local Postgres for Vite+/Nx/CedarJS — powered by autopg (embedded PostgreSQL with true concurrent connections)",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"autopg",
|
|
7
|
+
"cedar",
|
|
8
|
+
"cedarjs",
|
|
9
|
+
"nx",
|
|
10
|
+
"postgres",
|
|
11
|
+
"postgresql",
|
|
12
|
+
"testing",
|
|
13
|
+
"vite",
|
|
14
|
+
"vite-plus",
|
|
15
|
+
"worktree"
|
|
16
|
+
],
|
|
17
|
+
"homepage": "https://github.com/cedarjs/cedar-pg#readme",
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/cedarjs/cedar-pg/issues"
|
|
20
|
+
},
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"author": "Simon Crypta",
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/cedarjs/cedar-pg.git"
|
|
26
|
+
},
|
|
27
|
+
"bin": {
|
|
28
|
+
"cedarpg": "./dist/cli.mjs"
|
|
29
|
+
},
|
|
30
|
+
"files": [
|
|
31
|
+
"dist",
|
|
32
|
+
"scripts/postinstall.js"
|
|
33
|
+
],
|
|
34
|
+
"type": "module",
|
|
35
|
+
"main": "./dist/index.cjs",
|
|
36
|
+
"module": "./dist/index.mjs",
|
|
37
|
+
"types": "./dist/index.d.mts",
|
|
38
|
+
"exports": {
|
|
39
|
+
".": {
|
|
40
|
+
"types": "./dist/index.d.mts",
|
|
41
|
+
"import": "./dist/index.mjs",
|
|
42
|
+
"require": "./dist/index.cjs"
|
|
43
|
+
},
|
|
44
|
+
"./vite-plus": {
|
|
45
|
+
"types": "./dist/vite-plus.d.mts",
|
|
46
|
+
"import": "./dist/vite-plus.mjs",
|
|
47
|
+
"require": "./dist/vite-plus.cjs"
|
|
48
|
+
},
|
|
49
|
+
"./nx": {
|
|
50
|
+
"types": "./dist/nx.d.mts",
|
|
51
|
+
"import": "./dist/nx.mjs",
|
|
52
|
+
"require": "./dist/nx.cjs"
|
|
53
|
+
},
|
|
54
|
+
"./vitest": {
|
|
55
|
+
"types": "./dist/vitest.d.mts",
|
|
56
|
+
"import": "./dist/vitest.mjs",
|
|
57
|
+
"require": "./dist/vitest.cjs"
|
|
58
|
+
},
|
|
59
|
+
"./jest": {
|
|
60
|
+
"types": "./dist/jest.d.mts",
|
|
61
|
+
"import": "./dist/jest.mjs",
|
|
62
|
+
"require": "./dist/jest.cjs"
|
|
63
|
+
},
|
|
64
|
+
"./package.json": "./package.json"
|
|
65
|
+
},
|
|
66
|
+
"publishConfig": {
|
|
67
|
+
"access": "public",
|
|
68
|
+
"tag": "alpha"
|
|
69
|
+
},
|
|
70
|
+
"scripts": {
|
|
71
|
+
"build": "vp pack",
|
|
72
|
+
"dev": "vp pack --watch",
|
|
73
|
+
"test": "vp test",
|
|
74
|
+
"check": "vp check",
|
|
75
|
+
"prepublishOnly": "vp pack",
|
|
76
|
+
"postinstall": "node scripts/postinstall.js",
|
|
77
|
+
"prepare": "vp config || true"
|
|
78
|
+
},
|
|
79
|
+
"dependencies": {
|
|
80
|
+
"pg": "^8.16.3"
|
|
81
|
+
},
|
|
82
|
+
"devDependencies": {
|
|
83
|
+
"@types/node": "^22.15.0",
|
|
84
|
+
"@types/pg": "^8.15.4",
|
|
85
|
+
"typescript": "^5.8.3",
|
|
86
|
+
"vite-plus": "^0.2.4"
|
|
87
|
+
},
|
|
88
|
+
"overrides": {
|
|
89
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@latest",
|
|
90
|
+
"vitest": "4.1.9"
|
|
91
|
+
},
|
|
92
|
+
"engines": {
|
|
93
|
+
"node": ">=24"
|
|
94
|
+
},
|
|
95
|
+
"packageManager": "pnpm@11.18.0"
|
|
96
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Ensure the autopg host binary is available after @cedarjs/pg install.
|
|
4
|
+
* Idempotent across npm / yarn / pnpm. Never fails the parent install hard
|
|
5
|
+
* when network is unavailable — prints a clear warning instead.
|
|
6
|
+
*
|
|
7
|
+
* Supply-chain: both the install script ref and the binary release are pinned.
|
|
8
|
+
* Bump AUTOPG_VERSION (and the matching tag in INSTALL_URL) deliberately when
|
|
9
|
+
* upgrading — do not track main/latest.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import { spawnSync } from "node:child_process";
|
|
13
|
+
import { existsSync } from "node:fs";
|
|
14
|
+
import { homedir } from "node:os";
|
|
15
|
+
import { join } from "node:path";
|
|
16
|
+
|
|
17
|
+
/** Pinned autopg release tag. Bump intentionally for upgrades. */
|
|
18
|
+
const AUTOPG_VERSION = "v3.0.7";
|
|
19
|
+
const INSTALL_URL = `https://raw.githubusercontent.com/automagik-dev/autopg/${AUTOPG_VERSION}/install.sh`;
|
|
20
|
+
|
|
21
|
+
function hasAutopg() {
|
|
22
|
+
if (process.env.AUTOPG_BIN && existsSync(process.env.AUTOPG_BIN)) return true;
|
|
23
|
+
const which = spawnSync("which", ["autopg"], { encoding: "utf8" });
|
|
24
|
+
if (which.status === 0 && which.stdout.trim()) return true;
|
|
25
|
+
if (existsSync(join(homedir(), ".local", "bin", "autopg"))) return true;
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function main() {
|
|
30
|
+
if (process.env.CEDAR_PG_SKIP_POSTINSTALL === "1") {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
if (hasAutopg()) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Skip in CI unless explicitly requested — CI images often bake autopg
|
|
38
|
+
if (process.env.CI === "true" && process.env.CEDAR_PG_INSTALL_AUTOPG !== "1") {
|
|
39
|
+
console.warn(
|
|
40
|
+
"[cedarpg] autopg not found; CI detected — skip auto-install. " +
|
|
41
|
+
"Set CEDAR_PG_INSTALL_AUTOPG=1 or install autopg in the image.",
|
|
42
|
+
);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
console.log(`[cedarpg] autopg not found — installing ${AUTOPG_VERSION} via pinned install.sh…`);
|
|
47
|
+
const result = spawnSync("bash", ["-c", `curl -fsSL ${INSTALL_URL} | bash`], {
|
|
48
|
+
stdio: "inherit",
|
|
49
|
+
env: { ...process.env, AUTOPG_VERSION },
|
|
50
|
+
});
|
|
51
|
+
if (result.status !== 0) {
|
|
52
|
+
console.warn(
|
|
53
|
+
"[cedarpg] automatic autopg install failed.\n" +
|
|
54
|
+
" Install manually:\n" +
|
|
55
|
+
` curl -fsSL ${INSTALL_URL} | AUTOPG_VERSION=${AUTOPG_VERSION} bash\n` +
|
|
56
|
+
" Then ensure ~/.local/bin is on PATH (or set AUTOPG_BIN).",
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
main();
|