Skip to content

Commit b436e15

Browse files
committed
feat: make public release
1 parent b9b22d0 commit b436e15

File tree

5 files changed

+97
-4
lines changed

5 files changed

+97
-4
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @GalvinPython

.github/workflows/main.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Publish Package to npmjs
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
build-and-publish:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
id-token: write
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- uses: actions/setup-node@v4
18+
with:
19+
node-version: "20.x"
20+
registry-url: "https://registry.npmjs.org"
21+
22+
- name: Install dependencies
23+
run: npm ci
24+
25+
- name: Run tests
26+
run: npm test
27+
28+
- name: Publish to npm
29+
run: npm publish --provenance --access public
30+
env:
31+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules/
22
dist/
3-
coverage/
3+
coverage/
4+
*.tgz

README.md

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,69 @@
11
# ManagedEnv
2+
3+
Notice: ManagedEnv is currently in beta
4+
25
ManagedEnv is a lightweight, zero-dependency environment variable management package. It allows you to define, load, and validate environment variables with ease, making it a powerful tool for managing your application's configuration and environment variables.
36

47
# Features
8+
59
Features of ManagedEnv are that:
10+
611
- It's type-safe
712
- Auto-casted typings means that you can easily see variables that exist or don't exist
813
- Declare required and optional variables
914
- Scope your variables to different projects (useful in monorepo settings)
10-
- Set fallback environment variables (such as ports)
15+
- Set fallback environment variables (such as ports)
16+
17+
# Example Usage
18+
19+
As ManagedEnv is in beta, there's likely to be future API changes, however this how you use the current API:
20+
21+
Lets assume in your project, you have a `.env` file that looks like
22+
23+
```bash
24+
API_KEY=test
25+
```
26+
27+
In your file (for example `index.ts`):
28+
29+
```ts
30+
// Import the EnvManager class from managedenv
31+
import { EnvManager } from "managedenv";
32+
33+
// Create a new instance, but remember to call `.add()` to the end of it
34+
const envManager = new EnvManager().add({
35+
name: "API_KEY",
36+
required: false,
37+
});
38+
39+
// Load the variables using the `.load()` function
40+
const envs = envManager.load();
41+
42+
// To verify it works
43+
console.log("API_KEY:", envs.env.API_KEY);
44+
```
45+
46+
Now this has native support for Bun at the moment, so in your terminal run your file and verify the output:
47+
48+
```bash
49+
$ bun index.ts
50+
```
51+
52+
```bash
53+
API_KEY: test
54+
```
55+
56+
# Changelog
57+
58+
## Preview
59+
60+
### 0.1.0
61+
62+
- Added documentation
63+
- First release
64+
65+
### 0.0.1
66+
67+
_Note: This version was never published_
68+
69+
- Initial commit

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "managedenv",
3-
"version": "0.0.1",
3+
"version": "0.1.0",
44
"description": "Manage your environment variables with ease",
55
"type": "module",
66
"main": "dist/index.js",
@@ -43,7 +43,8 @@
4343
"nodejs",
4444
"node-utils",
4545
"developer-tools",
46-
"cli-utils"
46+
"cli-utils",
47+
"bun"
4748
],
4849
"devDependencies": {
4950
"@types/jest": "^30.0.0",

0 commit comments

Comments
 (0)