@webbies.dev/dotenvify 0.2.6
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 +163 -0
- package/bin/dotenvify.js +78 -0
- package/bin/dotenvify_darwin_amd64_v1 +0 -0
- package/bin/dotenvify_darwin_arm64 +0 -0
- package/bin/dotenvify_linux_amd64_v1 +0 -0
- package/bin/dotenvify_linux_arm64 +0 -0
- package/bin/dotenvify_windows_amd64_v1.exe +0 -0
- package/package.json +45 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Webb1es
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# 🧙♂️ DotEnvify
|
|
2
|
+
|
|
3
|
+
> Convert key-value pairs to environment variables with zero hassle
|
|
4
|
+
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
[](https://goreportcard.com/report/github.com/webb1es/dotenvify)
|
|
7
|
+
|
|
8
|
+
**Transform this:**
|
|
9
|
+
```
|
|
10
|
+
API_KEY
|
|
11
|
+
a1b2c3d4e5f6g7h8i9j0
|
|
12
|
+
DATABASE_URL
|
|
13
|
+
postgres://user:password@localhost:5432/db
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
**Into this:**
|
|
17
|
+
```
|
|
18
|
+
export API_KEY="a1b2c3d4e5f6g7h8i9j0"
|
|
19
|
+
export DATABASE_URL="postgres://user:password@localhost:5432/db"
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
After doing this manually one too many times, I rage-coded this tool. You're welcome.
|
|
23
|
+
|
|
24
|
+
## 🚀 Installation
|
|
25
|
+
|
|
26
|
+
### npm (Recommended)
|
|
27
|
+
```bash
|
|
28
|
+
npm install -g @webbies.dev/dotenvify
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Homebrew (macOS/Linux)
|
|
32
|
+
```bash
|
|
33
|
+
brew install webb1es/tap/dotenvify
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Scoop (Windows)
|
|
37
|
+
```bash
|
|
38
|
+
scoop bucket add webb1es https://github.com/webb1es/scoop-bucket.git
|
|
39
|
+
scoop install dotenvify
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
<details>
|
|
43
|
+
<summary>📦 Other Methods</summary>
|
|
44
|
+
|
|
45
|
+
#### Direct Download
|
|
46
|
+
Download from [GitHub Releases](https://github.com/webb1es/dotenvify/releases)
|
|
47
|
+
|
|
48
|
+
#### Build from Source
|
|
49
|
+
```bash
|
|
50
|
+
git clone https://github.com/webb1es/dotenvify.git
|
|
51
|
+
cd dotenvify && go build
|
|
52
|
+
```
|
|
53
|
+
</details>
|
|
54
|
+
|
|
55
|
+
## 🔮 Usage
|
|
56
|
+
|
|
57
|
+
### Basic File Mode
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
# Process a file and save to .env (default)
|
|
61
|
+
dotenvify your-vars.txt
|
|
62
|
+
|
|
63
|
+
# Save to a specific file
|
|
64
|
+
dotenvify your-vars.txt custom-output.env
|
|
65
|
+
|
|
66
|
+
# Ignore variables with lowercase keys
|
|
67
|
+
dotenvify -nl your-vars.txt
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Azure DevOps Mode
|
|
71
|
+
|
|
72
|
+
Fetch variables directly from Azure DevOps variable groups:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# Login to Azure CLI first
|
|
76
|
+
az login
|
|
77
|
+
|
|
78
|
+
# Set default organization (optional)
|
|
79
|
+
export DOTENVIFY_DEFAULT_ORG_URL="https://dev.azure.com/your-org/your-project"
|
|
80
|
+
dotenvify -azure -group "your-variable-group"
|
|
81
|
+
|
|
82
|
+
# Or specify URL directly
|
|
83
|
+
dotenvify -azure -url "https://dev.azure.com/your-org/your-project" -group "your-variable-group"
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
**Options:**
|
|
87
|
+
- `-out file.env` - Custom output file
|
|
88
|
+
- `-nl` - Ignore lowercase variables
|
|
89
|
+
- `-export` - Add 'export' prefix
|
|
90
|
+
- `-urls` - Only URL values
|
|
91
|
+
|
|
92
|
+
<details>
|
|
93
|
+
<summary>🔒 Security & Authentication Details</summary>
|
|
94
|
+
|
|
95
|
+
DotEnvify uses your existing Azure CLI authentication:
|
|
96
|
+
- No credentials stored or handled by the tool
|
|
97
|
+
- Tokens are used only in memory
|
|
98
|
+
- Respects your organization's security policies (including MFA)
|
|
99
|
+
|
|
100
|
+
Just make sure you're logged in with `az login` before running the tool.
|
|
101
|
+
</details>
|
|
102
|
+
|
|
103
|
+
## ✨ Features
|
|
104
|
+
|
|
105
|
+
- ⚡ **Fast**: Written in Go
|
|
106
|
+
- 🔄 **Azure DevOps**: Direct variable group integration
|
|
107
|
+
- 🔒 **Secure**: Uses existing Azure CLI auth
|
|
108
|
+
- 🧹 **Smart**: Auto-detects input formats
|
|
109
|
+
- 🔤 **Flexible**: Multiple output options
|
|
110
|
+
- 📦 **Easy Install**: npm, Homebrew, Scoop
|
|
111
|
+
|
|
112
|
+
## 📝 Supported Formats
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
# Key-value on separate lines
|
|
116
|
+
KEY1
|
|
117
|
+
value1
|
|
118
|
+
|
|
119
|
+
# KEY=VALUE format
|
|
120
|
+
KEY1=value1
|
|
121
|
+
|
|
122
|
+
# KEY="VALUE" with quotes
|
|
123
|
+
KEY1="value with spaces"
|
|
124
|
+
|
|
125
|
+
# KEY VALUE on same line
|
|
126
|
+
KEY1 value1
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Lines starting with `#` are treated as comments and ignored. The tool is smart enough to try different parsing strategies if one fails, making it robust against unfamiliar formats.
|
|
130
|
+
|
|
131
|
+
<details>
|
|
132
|
+
<summary>🤓 Why I Made This</summary>
|
|
133
|
+
|
|
134
|
+
Because those precious minutes you spend formatting env vars could be spent on:
|
|
135
|
+
- Actually coding something cool
|
|
136
|
+
- Optimizing your coffee brewing technique
|
|
137
|
+
- Staring at the wall contemplating your life choices
|
|
138
|
+
</details>
|
|
139
|
+
|
|
140
|
+
## 🔧 Contributing
|
|
141
|
+
|
|
142
|
+
Found a bug? 🐛 Have a feature idea? 💡 PRs welcome! Let's make this tool even more awesome together! 🚀
|
|
143
|
+
|
|
144
|
+
Check out the [issues page](https://github.com/webb1es/dotenvify/issues) or submit a [pull request](https://github.com/webb1es/dotenvify/pulls).
|
|
145
|
+
|
|
146
|
+
## 📄 License
|
|
147
|
+
|
|
148
|
+
[](https://opensource.org/licenses/MIT)
|
|
149
|
+
|
|
150
|
+
MIT License - Go wild, make millions, just don't blame me when it formats your grocery list. 🛒📝
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
<div align="center">
|
|
155
|
+
|
|
156
|
+
**Made with 💻, ☕, and the burning desire to never format env vars manually again**
|
|
157
|
+
|
|
158
|
+

|
|
159
|
+

|
|
160
|
+
|
|
161
|
+
*"Life's too short for manual formatting."* 🧙♂️✨
|
|
162
|
+
|
|
163
|
+
</div>
|
package/bin/dotenvify.js
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { spawn } = require('child_process');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const os = require('os');
|
|
6
|
+
|
|
7
|
+
function getBinaryName() {
|
|
8
|
+
const platform = os.platform();
|
|
9
|
+
const arch = os.arch();
|
|
10
|
+
|
|
11
|
+
let osName;
|
|
12
|
+
switch (platform) {
|
|
13
|
+
case 'win32':
|
|
14
|
+
osName = 'windows';
|
|
15
|
+
break;
|
|
16
|
+
case 'darwin':
|
|
17
|
+
osName = 'darwin';
|
|
18
|
+
break;
|
|
19
|
+
case 'linux':
|
|
20
|
+
osName = 'linux';
|
|
21
|
+
break;
|
|
22
|
+
default:
|
|
23
|
+
throw new Error(`Unsupported platform: ${platform}`);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
let archName;
|
|
27
|
+
switch (arch) {
|
|
28
|
+
case 'x64':
|
|
29
|
+
archName = 'amd64';
|
|
30
|
+
break;
|
|
31
|
+
case 'arm64':
|
|
32
|
+
archName = 'arm64';
|
|
33
|
+
break;
|
|
34
|
+
default:
|
|
35
|
+
throw new Error(`Unsupported architecture: ${arch}`);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const extension = platform === 'win32' ? '.exe' : '';
|
|
39
|
+
return `dotenvify_${osName}_${archName}${extension}`;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function main() {
|
|
43
|
+
try {
|
|
44
|
+
const binaryName = getBinaryName();
|
|
45
|
+
const binaryPath = path.join(__dirname, binaryName);
|
|
46
|
+
|
|
47
|
+
const child = spawn(binaryPath, process.argv.slice(2), {
|
|
48
|
+
stdio: 'inherit',
|
|
49
|
+
windowsHide: false,
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
child.on('error', (error) => {
|
|
53
|
+
if (error.code === 'ENOENT') {
|
|
54
|
+
console.error(`Binary not found: ${binaryPath}`);
|
|
55
|
+
console.error(`Platform: ${os.platform()}, Architecture: ${os.arch()}`);
|
|
56
|
+
process.exit(1);
|
|
57
|
+
} else {
|
|
58
|
+
console.error('Failed to start dotenvify:', error.message);
|
|
59
|
+
process.exit(1);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
child.on('exit', (code, signal) => {
|
|
64
|
+
if (signal) {
|
|
65
|
+
process.kill(process.pid, signal);
|
|
66
|
+
} else {
|
|
67
|
+
process.exit(code);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
} catch (error) {
|
|
71
|
+
console.error('Error:', error.message);
|
|
72
|
+
process.exit(1);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (require.main === module) {
|
|
77
|
+
main();
|
|
78
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@webbies.dev/dotenvify",
|
|
3
|
+
"version": "0.2.6",
|
|
4
|
+
"description": "A utility to convert environment variables from various sources into different formats",
|
|
5
|
+
"main": "bin/dotenvify.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"dotenvify": "bin/dotenvify.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "node scripts/build.js",
|
|
11
|
+
"prepack": "npm run build",
|
|
12
|
+
"test": "node bin/dotenvify.js --help"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"dotenv",
|
|
16
|
+
"environment",
|
|
17
|
+
"variables",
|
|
18
|
+
"azure",
|
|
19
|
+
"devops",
|
|
20
|
+
"cli"
|
|
21
|
+
],
|
|
22
|
+
"author": "Webster Muchefa",
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "https://github.com/webb1es/dotenvify.git"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"bin/",
|
|
30
|
+
"LICENSE",
|
|
31
|
+
"README.md"
|
|
32
|
+
],
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": ">=12"
|
|
35
|
+
},
|
|
36
|
+
"os": [
|
|
37
|
+
"darwin",
|
|
38
|
+
"linux",
|
|
39
|
+
"win32"
|
|
40
|
+
],
|
|
41
|
+
"cpu": [
|
|
42
|
+
"x64",
|
|
43
|
+
"arm64"
|
|
44
|
+
]
|
|
45
|
+
}
|