@modlogtv/zenv 2.0.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/bin/zenv +0 -0
- package/install.js +74 -0
- package/package.json +45 -0
package/bin/zenv
ADDED
|
Binary file
|
package/install.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require("fs");
|
|
4
|
+
const path = require("path");
|
|
5
|
+
|
|
6
|
+
const PLATFORM_PACKAGES = {
|
|
7
|
+
"darwin-arm64": "@modlogtv/zenv-darwin-arm64",
|
|
8
|
+
"darwin-x64": "@modlogtv/zenv-darwin-x64",
|
|
9
|
+
"linux-arm64": "@modlogtv/zenv-linux-arm64",
|
|
10
|
+
"linux-x64": "@modlogtv/zenv-linux-x64",
|
|
11
|
+
"win32-x64": "@modlogtv/zenv-win32-x64",
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
function getPlatformPackage() {
|
|
15
|
+
const platform = process.platform;
|
|
16
|
+
const arch = process.arch;
|
|
17
|
+
const key = `${platform}-${arch}`;
|
|
18
|
+
|
|
19
|
+
const pkg = PLATFORM_PACKAGES[key];
|
|
20
|
+
if (!pkg) {
|
|
21
|
+
console.error(`Unsupported platform: ${platform}-${arch}`);
|
|
22
|
+
console.error(`Supported platforms: ${Object.keys(PLATFORM_PACKAGES).join(", ")}`);
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
return pkg;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function findBinaryPath(packageName) {
|
|
29
|
+
try {
|
|
30
|
+
const packagePath = require.resolve(`${packageName}/package.json`);
|
|
31
|
+
const packageDir = path.dirname(packagePath);
|
|
32
|
+
const binaryName = process.platform === "win32" ? "zenv.exe" : "zenv";
|
|
33
|
+
return path.join(packageDir, "bin", binaryName);
|
|
34
|
+
} catch (e) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function main() {
|
|
40
|
+
const binDir = path.join(__dirname, "bin");
|
|
41
|
+
const targetBinary = path.join(binDir, process.platform === "win32" ? "zenv.exe" : "zenv");
|
|
42
|
+
|
|
43
|
+
// Skip if binary already exists (e.g., local development)
|
|
44
|
+
if (fs.existsSync(targetBinary)) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Create bin directory
|
|
49
|
+
if (!fs.existsSync(binDir)) {
|
|
50
|
+
fs.mkdirSync(binDir, { recursive: true });
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const platformPackage = getPlatformPackage();
|
|
54
|
+
const sourceBinary = findBinaryPath(platformPackage);
|
|
55
|
+
|
|
56
|
+
if (!sourceBinary) {
|
|
57
|
+
console.error(`Failed to find binary in ${platformPackage}`);
|
|
58
|
+
console.error("Please ensure the platform-specific package is installed.");
|
|
59
|
+
process.exit(1);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (!fs.existsSync(sourceBinary)) {
|
|
63
|
+
console.error(`Binary not found at: ${sourceBinary}`);
|
|
64
|
+
process.exit(1);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Copy binary to bin directory
|
|
68
|
+
fs.copyFileSync(sourceBinary, targetBinary);
|
|
69
|
+
fs.chmodSync(targetBinary, 0o755);
|
|
70
|
+
|
|
71
|
+
console.log(`zenv installed successfully for ${process.platform}-${process.arch}`);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
main();
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@modlogtv/zenv",
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "Zod-powered environment variable validation and generation for TypeScript/Node.js projects.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"env",
|
|
7
|
+
"environment",
|
|
8
|
+
"validation",
|
|
9
|
+
"dotenv",
|
|
10
|
+
"typescript",
|
|
11
|
+
"zod",
|
|
12
|
+
"monorepo",
|
|
13
|
+
"cli",
|
|
14
|
+
"generate"
|
|
15
|
+
],
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "https://github.com/modlogtv/zenv.git"
|
|
20
|
+
},
|
|
21
|
+
"homepage": "https://github.com/modlogtv/zenv#readme",
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://github.com/modlogtv/zenv/issues"
|
|
24
|
+
},
|
|
25
|
+
"bin": {
|
|
26
|
+
"zenv": "bin/zenv"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"bin",
|
|
30
|
+
"install.js"
|
|
31
|
+
],
|
|
32
|
+
"scripts": {
|
|
33
|
+
"postinstall": "node install.js"
|
|
34
|
+
},
|
|
35
|
+
"optionalDependencies": {
|
|
36
|
+
"@modlogtv/zenv-darwin-arm64": "2.0.0",
|
|
37
|
+
"@modlogtv/zenv-darwin-x64": "2.0.0",
|
|
38
|
+
"@modlogtv/zenv-linux-arm64": "2.0.0",
|
|
39
|
+
"@modlogtv/zenv-linux-x64": "2.0.0",
|
|
40
|
+
"@modlogtv/zenv-win32-x64": "2.0.0"
|
|
41
|
+
},
|
|
42
|
+
"engines": {
|
|
43
|
+
"node": ">=16"
|
|
44
|
+
}
|
|
45
|
+
}
|