@evnx/cli 0.2.1

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.
Files changed (3) hide show
  1. package/bin/evnx +3 -0
  2. package/install.js +70 -0
  3. package/package.json +36 -0
package/bin/evnx ADDED
@@ -0,0 +1,3 @@
1
+ #!/bin/sh
2
+ echo "evnx: run npm install to complete setup" >&2
3
+ exit 1
package/install.js ADDED
@@ -0,0 +1,70 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const fs = require("fs");
5
+ const path = require("path");
6
+
7
+ const PLATFORM_PACKAGES = {
8
+ "linux-x64": "@evnx/evnx-linux-x64",
9
+ "linux-arm64": "@evnx/evnx-linux-arm64",
10
+ "darwin-x64": "@evnx/evnx-darwin-x64",
11
+ "darwin-arm64": "@evnx/evnx-darwin-arm64",
12
+ "win32-x64": "@evnx/evnx-win32-x64",
13
+ };
14
+
15
+ function getBinaryPath() {
16
+ const key = `${process.platform}-${process.arch}`;
17
+ const pkg = PLATFORM_PACKAGES[key];
18
+
19
+ if (!pkg) {
20
+ throw new Error(
21
+ `evnx: Unsupported platform: ${process.platform}/${process.arch}\n` +
22
+ `Supported: ${Object.keys(PLATFORM_PACKAGES).join(", ")}\n` +
23
+ `Install manually: https://github.com/urwithajit9/evnx/releases`
24
+ );
25
+ }
26
+
27
+ let pkgJsonPath;
28
+ try {
29
+ pkgJsonPath = require.resolve(`${pkg}/package.json`);
30
+ } catch (e) {
31
+ throw new Error(
32
+ `evnx: Binary package ${pkg} not installed.\n` +
33
+ `This usually means your platform wasn't detected correctly at install time.\n` +
34
+ `Try: npm install ${pkg}\n` +
35
+ `Or install manually: https://github.com/urwithajit9/evnx/releases`
36
+ );
37
+ }
38
+
39
+ const pkgDir = path.dirname(pkgJsonPath);
40
+ const binName = process.platform === "win32" ? "evnx.exe" : "evnx";
41
+ const binPath = path.join(pkgDir, "bin", binName);
42
+
43
+ if (!fs.existsSync(binPath)) {
44
+ throw new Error(`evnx: Binary not found at expected path: ${binPath}`);
45
+ }
46
+
47
+ return binPath;
48
+ }
49
+
50
+ try {
51
+ const binaryPath = getBinaryPath();
52
+ const binDir = path.join(__dirname, "bin");
53
+ fs.mkdirSync(binDir, { recursive: true });
54
+
55
+ if (process.platform === "win32") {
56
+ const shim = `@echo off\r\n"${binaryPath}" %*\r\n`;
57
+ fs.writeFileSync(path.join(binDir, "evnx.cmd"), shim);
58
+ } else {
59
+ const shim = `#!/bin/sh\nexec "${binaryPath}" "$@"\n`;
60
+ const shimPath = path.join(binDir, "evnx");
61
+ fs.writeFileSync(shimPath, shim);
62
+ fs.chmodSync(shimPath, 0o755);
63
+ }
64
+
65
+ console.log(`evnx installed for ${process.platform}/${process.arch}`);
66
+ } catch (err) {
67
+ // Non-fatal — don't block npm install, just warn
68
+ process.stderr.write(`\nWARNING: ${err.message}\n\n`);
69
+ process.exit(0);
70
+ }
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@evnx/cli",
3
+ "version": "0.2.1",
4
+ "description": "CLI tool for managing .env files — validation, secret scanning, format conversion",
5
+ "keywords": ["dotenv", "env", "secrets", "cli", "security", "devtools", "environment"],
6
+ "author": "Ajit Kumar <support@dotenv.space>",
7
+ "license": "MIT",
8
+ "homepage": "https://dotenv.space",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "https://github.com/urwithajit9/evnx.git"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/urwithajit9/evnx/issues"
15
+ },
16
+ "bin": {
17
+ "evnx": "bin/evnx"
18
+ },
19
+ "scripts": {
20
+ "postinstall": "node install.js"
21
+ },
22
+ "optionalDependencies": {
23
+ "@evnx/evnx-linux-x64": "0.2.1",
24
+ "@evnx/evnx-linux-arm64": "0.2.1",
25
+ "@evnx/evnx-darwin-x64": "0.2.1",
26
+ "@evnx/evnx-darwin-arm64": "0.2.1",
27
+ "@evnx/evnx-win32-x64": "0.2.1"
28
+ },
29
+ "engines": {
30
+ "node": ">=14"
31
+ },
32
+ "files": [
33
+ "bin/",
34
+ "install.js"
35
+ ]
36
+ }