envden 0.1.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/README.md +13 -0
- package/bin/launch.js +19 -0
- package/checksums.json +10 -0
- package/install.js +48 -0
- package/package.json +38 -0
package/README.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# envden
|
|
2
|
+
|
|
3
|
+
Sync whole `.env` files across your machines. Files are encrypted on your device, stored on a server you run, and reached over Tailscale. Comments, key order and blank lines survive.
|
|
4
|
+
|
|
5
|
+
```sh
|
|
6
|
+
npm i -g envden
|
|
7
|
+
envden setup
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
Installing downloads the envden binary for your platform from the matching GitHub release and checks it against a SHA-256 hash pinned in this package.
|
|
11
|
+
|
|
12
|
+
Docs: https://envden.theclau.de/docs
|
|
13
|
+
Source: https://github.com/notsuhas/envden (MIT)
|
package/bin/launch.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { spawnSync } from "node:child_process";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
|
|
5
|
+
const binary = fileURLToPath(
|
|
6
|
+
new URL(
|
|
7
|
+
process.platform === "win32" ? "../native/envden.exe" : "../native/envden",
|
|
8
|
+
import.meta.url,
|
|
9
|
+
),
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
const child = spawnSync(binary, process.argv.slice(2), {
|
|
13
|
+
stdio: "inherit",
|
|
14
|
+
env: { ...process.env, ENVDEN_INSTALL_METHOD: "npm" },
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
if (child.error) throw child.error;
|
|
18
|
+
|
|
19
|
+
process.exit(child.status ?? 1);
|
package/checksums.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"darwin-x64": "54f5e8b77f9f5a84759ca2cbdff506e461f9ce353dea54d897e1fd8c9e933130",
|
|
3
|
+
"darwin-arm64": "a652745aa0b0507cd870a8211ab35de5d03d611f3a8f2616243a0bc7ba38cb7f",
|
|
4
|
+
"linux-x64": "e2c040a41e9883d8ceb913f6744f583c816730648d965079e893d7b005d63d1c",
|
|
5
|
+
"linux-arm64": "9f80ea8a307357de4a06262df30b34d1d4f46c904f849721b0d056c964276dbf",
|
|
6
|
+
"linux-x64-musl": "6665a8a78eefc1b72ccea0c8beec5c0c50bace5ebb12f2f502388000164bf6e0",
|
|
7
|
+
"linux-arm64-musl": "5a4e6bef1cffa585c7a791a97ea9bc046260affd5eec2cba2c1656c4bb5882a8",
|
|
8
|
+
"windows-x64": "769d3879f2b00173cb7f078143e788cc7bebbfb9968d7472924f9e0769975e54",
|
|
9
|
+
"windows-arm64": "26065585a02f02c6956d09478abcf31782bf4aac940a964f760e1912ab0567e2"
|
|
10
|
+
}
|
package/install.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { chmod, mkdir, readFile, rename, writeFile } from "node:fs/promises";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
|
|
5
|
+
const repo = "notsuhas/envden";
|
|
6
|
+
|
|
7
|
+
if (repo.includes("REPLACE")) throw new Error("Configure release repository before publishing");
|
|
8
|
+
|
|
9
|
+
const metadata = JSON.parse(await readFile(new URL("package.json", import.meta.url), "utf8"));
|
|
10
|
+
const hashes = JSON.parse(await readFile(new URL("checksums.json", import.meta.url), "utf8"));
|
|
11
|
+
|
|
12
|
+
let platform = `${process.platform === "win32" ? "windows" : process.platform}-${process.arch}`;
|
|
13
|
+
|
|
14
|
+
if (process.platform === "linux" && !process.report.getReport().header.glibcVersionRuntime)
|
|
15
|
+
platform += "-musl";
|
|
16
|
+
|
|
17
|
+
const expected = hashes[platform];
|
|
18
|
+
|
|
19
|
+
if (typeof expected !== "string" || !/^[a-f0-9]{64}$/.test(expected))
|
|
20
|
+
throw new Error("Missing pinned platform checksum");
|
|
21
|
+
|
|
22
|
+
const asset = `envden-${platform}${process.platform === "win32" ? ".exe" : ""}`;
|
|
23
|
+
|
|
24
|
+
const response = await fetch(
|
|
25
|
+
`https://github.com/${repo}/releases/download/v${metadata.version}/${asset}`,
|
|
26
|
+
{ signal: AbortSignal.timeout(120000) },
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
if (!response.ok) throw new Error("Binary download failed");
|
|
30
|
+
|
|
31
|
+
const bytes = Buffer.from(await response.arrayBuffer());
|
|
32
|
+
|
|
33
|
+
if (createHash("sha256").update(bytes).digest("hex") !== expected)
|
|
34
|
+
throw new Error("Checksum mismatch");
|
|
35
|
+
|
|
36
|
+
const directory = new URL("native/", import.meta.url);
|
|
37
|
+
|
|
38
|
+
await mkdir(directory, { recursive: true });
|
|
39
|
+
|
|
40
|
+
const destination = fileURLToPath(
|
|
41
|
+
new URL(process.platform === "win32" ? "envden.exe" : "envden", directory),
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
await writeFile(`${destination}.tmp`, bytes);
|
|
45
|
+
|
|
46
|
+
await chmod(`${destination}.tmp`, 0o755);
|
|
47
|
+
|
|
48
|
+
await rename(`${destination}.tmp`, destination);
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "envden",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Sync whole .env files across your machines, end-to-end encrypted, through a server you host.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"env",
|
|
7
|
+
"dotenv",
|
|
8
|
+
"secrets",
|
|
9
|
+
"sync",
|
|
10
|
+
"encryption",
|
|
11
|
+
"self-hosted",
|
|
12
|
+
"tailscale",
|
|
13
|
+
"cli"
|
|
14
|
+
],
|
|
15
|
+
"homepage": "https://envden.theclau.de",
|
|
16
|
+
"bugs": "https://github.com/notsuhas/envden/issues",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/notsuhas/envden.git",
|
|
20
|
+
"directory": "packaging/npm"
|
|
21
|
+
},
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"bin": {
|
|
24
|
+
"envden": "bin/launch.js"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"bin",
|
|
28
|
+
"install.js",
|
|
29
|
+
"checksums.json"
|
|
30
|
+
],
|
|
31
|
+
"type": "module",
|
|
32
|
+
"scripts": {
|
|
33
|
+
"postinstall": "node install.js"
|
|
34
|
+
},
|
|
35
|
+
"engines": {
|
|
36
|
+
"node": ">=22"
|
|
37
|
+
}
|
|
38
|
+
}
|