-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f098938
commit 1b75b6f
Showing
13 changed files
with
10,337 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
bin | ||
package.json | ||
./node_modules/ | ||
.vscode | ||
.idea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{ | ||
"root": true, | ||
"parserOptions": { | ||
"ecmaVersion": "latest" | ||
}, | ||
"env": { | ||
"es6": true | ||
}, | ||
"plugins": ["simple-import-sort"], | ||
"overrides": [ | ||
{ | ||
"parserOptions": { | ||
"project": "./tsconfig.json" | ||
}, | ||
"files": [ | ||
"src/**/*.ts" | ||
], | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended", | ||
"plugin:prettier/recommended" | ||
], | ||
"rules": { | ||
"simple-import-sort/imports": "error", | ||
"simple-import-sort/exports": "error", | ||
"@typescript-eslint/ban-ts-comment": 0, | ||
"max-lines-per-function": [ | ||
1, | ||
{ | ||
"max": 40 | ||
} | ||
], | ||
"max-lines": [ | ||
1, | ||
{ | ||
"max": 150 | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"parserOptions": { | ||
"project": "./tsconfig.json" | ||
}, | ||
"files": [ | ||
"src/**/*.ts" | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: '20' | ||
|
||
- name: Setup Corepack | ||
run: | | ||
corepack enable | ||
corepack prepare [email protected] --activate | ||
- name: Install dependencies | ||
run: npm install | ||
|
||
- name: Build project | ||
run: npm run build | ||
|
||
- name: Run Semantic Release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
run: npm run release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
bin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
.idea/ | ||
.github | ||
.gitignore | ||
.prettierrc.json | ||
.DS_Store | ||
CONTRIBUTE.md | ||
|
||
# configuration | ||
renovate.json | ||
tsconfig.json | ||
/.vscode | ||
.eslintrc.json | ||
.eslintignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"singleQuote": true, | ||
"trailingComma": "all", | ||
"endOfLine": "auto", | ||
"printWidth": 100 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** | ||
* @type {import('semantic-release').GlobalConfig} | ||
*/ | ||
const releaseConfig = { | ||
branches: ["main"], | ||
"plugins": [ | ||
"@semantic-release/commit-analyzer", | ||
"@semantic-release/release-notes-generator", | ||
"@semantic-release/changelog", | ||
"@semantic-release/npm", | ||
"@semantic-release/github", | ||
[ | ||
"@semantic-release/git", | ||
{ | ||
"assets": ["package.json", "CHANGELOG.md"], | ||
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" | ||
} | ||
] | ||
] | ||
}; | ||
|
||
module.exports = releaseConfig; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# @devmy/dotenv2shell - Load Environment Variables from .env File | ||
|
||
This TypeScript CLI lets you easily load environment variables from a `.env` file into your current shell session with [@dotenv-run/core](https://www.npmjs.com/package/@dotenv-run/core). It provides flexibility through various options and supports both zsh and bash. | ||
|
||
- ✅ Load environment variables from .env files | ||
- ✅ Load environment variables from .env.vault files | ||
- ✅ Expand environment variables API_URL=$API_BASE/users | ||
- ✅ Define environment variables for a specific environment (e.g. .env.production) | ||
- ✅ Load priorities of .env.* files (e.g. .env.production > .env) | ||
- ✅ Hierarchical cascading configuration in monorepo projects (Nx, Turbo, etc.) apps/next-app/.env > apps/.env > .env | ||
|
||
## Usage | ||
|
||
```bash | ||
npx @devmy/dotenv2shell [options] | ||
``` | ||
|
||
### Options | ||
|
||
* `-o, --override`: Override existing environment variables on your machine with values from the `.env` file (default: false). | ||
* `-p, --prefix`: Prefix to filter environment variables to load (e.g., `MY_APP_`). | ||
* `-r, --root`: Root directory to search for the `.env` file (default: current working directory). | ||
* `-f, --files`: Comma-separated list of `.env` files to load (default: `.env`). | ||
* `-d, --dotenv_key`: Manually specify the `DOTENV_KEY` for decryption (if using `.env.vault`). | ||
|
||
### Examples | ||
|
||
* Load the default `.env` file from the current directory: | ||
|
||
```bash | ||
eval $(npx @devmy/dotenv2shell) | ||
``` | ||
|
||
* Load a specific `.env` file with a prefix and override existing variable: | ||
|
||
```zsh | ||
eval $(npx @devmy/dotenv2shell -f my-env.env -p MY_APP_ -o) | ||
``` | ||
|
||
## Handling Backslash Escapes | ||
|
||
In some cases, environment variables loaded from the `.env` file may contain special characters that require backslash escapes to be interpreted correctly by the shell. This is particularly relevant when dealing with paths, file names, ssh-keys or other strings that might contain characters like spaces, commas, or backslashes themselves. | ||
|
||
If you encounter issues with environment variables not behaving as expected, check for any special characters in their values and consider using backslash escapes to ensure they are treated as literal characters. For example: | ||
|
||
```bash | ||
eval $(npx @devmy/dotenv2shell) && | ||
echo -e "$DEPLOY_GITHUB_SSH_KEY" | ssh-add - | ||
``` | ||
|
||
|
||
Remember that the -e option in echo is used to enable backslash escapes when printing strings, but it's not necessary when loading environment variables. The shell will automatically handle backslash escapes when interpreting environment variable values. |
Oops, something went wrong.