@horiastanxd/envo 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 ADDED
@@ -0,0 +1,20 @@
1
+ # @horiastanxd/envo
2
+
3
+ npm distribution of [**envo**](https://github.com/horiastanxd/envo) - a typed
4
+ `.env` manager: schema with types, profile inheritance, secret-leak detection,
5
+ and encryption at rest.
6
+
7
+ ```sh
8
+ npm install -g @horiastanxd/envo
9
+ envo --help
10
+ ```
11
+
12
+ On install, the correct prebuilt binary for your platform is downloaded from
13
+ GitHub Releases. Supported: Linux (x64/arm64, musl), macOS (x64/arm64),
14
+ Windows (x64).
15
+
16
+ Prefer Rust tooling? `cargo install envo-cli`.
17
+
18
+ See the [full README](https://github.com/horiastanxd/envo#readme) for usage.
19
+
20
+ MIT © Horia Stan
package/bin/cli.js ADDED
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ // Thin launcher: ensures the native binary exists (downloading it on first run if a
5
+ // postinstall was skipped), then forwards all arguments to it and mirrors its exit code.
6
+
7
+ const fs = require("fs");
8
+ const path = require("path");
9
+ const { spawnSync } = require("child_process");
10
+
11
+ const bin = path.join(
12
+ __dirname,
13
+ process.platform === "win32" ? "envo.exe" : "envo"
14
+ );
15
+
16
+ if (!fs.existsSync(bin)) {
17
+ const install = spawnSync(process.execPath, [path.join(__dirname, "install.js")], {
18
+ stdio: "inherit",
19
+ });
20
+ if (install.status !== 0) {
21
+ process.exit(install.status || 1);
22
+ }
23
+ }
24
+
25
+ const run = spawnSync(bin, process.argv.slice(2), { stdio: "inherit" });
26
+ if (run.error) {
27
+ console.error(`[envo] failed to run binary: ${run.error.message}`);
28
+ process.exit(1);
29
+ }
30
+ process.exit(run.status === null ? 1 : run.status);
package/bin/install.js ADDED
@@ -0,0 +1,87 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ // Downloads the correct prebuilt envo binary from GitHub Releases and places it
5
+ // next to this script. Runs on `npm install` (postinstall) and, as a fallback,
6
+ // is invoked by cli.js the first time the binary is missing.
7
+
8
+ const fs = require("fs");
9
+ const path = require("path");
10
+ const https = require("https");
11
+ const { execFileSync } = require("child_process");
12
+
13
+ const pkg = require("../package.json");
14
+ const REPO = "horiastanxd/envo";
15
+ const VERSION = pkg.version;
16
+
17
+ const TARGETS = {
18
+ "linux-x64": "x86_64-unknown-linux-musl",
19
+ "linux-arm64": "aarch64-unknown-linux-musl",
20
+ "darwin-x64": "x86_64-apple-darwin",
21
+ "darwin-arm64": "aarch64-apple-darwin",
22
+ "win32-x64": "x86_64-pc-windows-msvc",
23
+ };
24
+
25
+ function resolveTarget() {
26
+ const key = `${process.platform}-${process.arch}`;
27
+ const target = TARGETS[key];
28
+ if (!target) {
29
+ throw new Error(
30
+ `unsupported platform "${key}". Install with: cargo install envo-cli`
31
+ );
32
+ }
33
+ return target;
34
+ }
35
+
36
+ function binName() {
37
+ return process.platform === "win32" ? "envo.exe" : "envo";
38
+ }
39
+
40
+ function download(url, dest) {
41
+ return new Promise((resolve, reject) => {
42
+ https
43
+ .get(url, { headers: { "User-Agent": "envo-installer" } }, (res) => {
44
+ if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
45
+ res.resume();
46
+ return download(res.headers.location, dest).then(resolve, reject);
47
+ }
48
+ if (res.statusCode !== 200) {
49
+ res.resume();
50
+ return reject(new Error(`HTTP ${res.statusCode} for ${url}`));
51
+ }
52
+ const file = fs.createWriteStream(dest);
53
+ res.pipe(file);
54
+ file.on("finish", () => file.close(() => resolve()));
55
+ file.on("error", reject);
56
+ })
57
+ .on("error", reject);
58
+ });
59
+ }
60
+
61
+ async function main() {
62
+ const target = resolveTarget();
63
+ const ext = process.platform === "win32" ? "zip" : "tar.gz";
64
+ const asset = `envo-${target}.${ext}`;
65
+ const url = `https://github.com/${REPO}/releases/download/v${VERSION}/${asset}`;
66
+ const dir = __dirname;
67
+ const archive = path.join(dir, asset);
68
+
69
+ await download(url, archive);
70
+ // bsdtar (default `tar` on Linux, macOS and Windows 10+) extracts both .tar.gz and .zip.
71
+ execFileSync("tar", ["-xf", archive, "-C", dir], { stdio: "inherit" });
72
+ fs.unlinkSync(archive);
73
+
74
+ const bin = path.join(dir, binName());
75
+ if (!fs.existsSync(bin)) {
76
+ throw new Error("binary not found in archive after extraction");
77
+ }
78
+ if (process.platform !== "win32") {
79
+ fs.chmodSync(bin, 0o755);
80
+ }
81
+ }
82
+
83
+ main().catch((err) => {
84
+ console.error(`[envo] could not install the prebuilt binary: ${err.message}`);
85
+ console.error("[envo] alternative: cargo install envo-cli");
86
+ process.exit(1);
87
+ });
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@horiastanxd/envo",
3
+ "version": "0.1.0",
4
+ "description": "Typed .env manager: schema with types, profile inheritance, secret-leak detection, and encryption at rest.",
5
+ "keywords": [
6
+ "dotenv",
7
+ "env",
8
+ "environment",
9
+ "secrets",
10
+ "encryption",
11
+ "secret-scanning",
12
+ "cli",
13
+ "config",
14
+ "pre-commit"
15
+ ],
16
+ "homepage": "https://github.com/horiastanxd/envo#readme",
17
+ "bugs": {
18
+ "url": "https://github.com/horiastanxd/envo/issues"
19
+ },
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/horiastanxd/envo.git"
23
+ },
24
+ "license": "MIT",
25
+ "author": "horiastanxd",
26
+ "bin": {
27
+ "envo": "bin/cli.js"
28
+ },
29
+ "scripts": {
30
+ "postinstall": "node bin/install.js"
31
+ },
32
+ "files": [
33
+ "bin/cli.js",
34
+ "bin/install.js"
35
+ ],
36
+ "publishConfig": {
37
+ "access": "public"
38
+ },
39
+ "engines": {
40
+ "node": ">=16"
41
+ },
42
+ "os": [
43
+ "linux",
44
+ "darwin",
45
+ "win32"
46
+ ],
47
+ "cpu": [
48
+ "x64",
49
+ "arm64"
50
+ ]
51
+ }