Skip to content

Commit

Permalink
feat(#12): add command-line options for custom environment variable p…
Browse files Browse the repository at this point in the history
…refix and disabling prefix usage (#14)
  • Loading branch information
dennzimm authored Mar 14, 2024
1 parent bcc0c18 commit 0b5737f
Show file tree
Hide file tree
Showing 24 changed files with 2,470 additions and 345 deletions.
7 changes: 7 additions & 0 deletions .changeset/odd-kings-fetch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"npmrc-replace-env": minor
---

- Add utils with unit tests
- Add command-line options for custom environment variable prefix and disabling prefix usage
- Bump typescript, @types/node packages
19 changes: 18 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,25 @@ on:
- "**"

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
with:
version: 8
- uses: actions/setup-node@v4
with:
node-version: 21.x
cache: "pnpm"

- run: pnpm install --frozen-lockfile
- run: pnpm run lint
- run: pnpm run test

build:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
Expand All @@ -18,4 +35,4 @@ jobs:
cache: "pnpm"

- run: pnpm install --frozen-lockfile
- run: pnpm run lint && pnpm run build
- run: pnpm run build
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"conventionalCommits.scopes": [
"readme",
"changeset"
"changeset",
"deps"
]
}
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ yarn add npmrc-replace-env
pnpm add npmrc-replace-env
```

**Note**: While installing the package is an option, it's important to highlight that it is not required for using the utility. The utility can be directly invoked using npx without installing the package.
[!NOTE]
While installing the package is an option, it's important to note that it's not required to use the utility. The utility can be invoked directly with npx without installing the package.

## Usage

Expand Down Expand Up @@ -79,6 +80,20 @@ NPMRC_FA_AUTH_TOKEN=your_fontawesome_token_value

For more detailed configuration options and information about using `.env` files, refer to the [dotenv-flow documentation](https://www.npmjs.com/package/dotenv-flow).

## Command Line Options

The utility supports the following command-line options for customization:

| Option | Alias | Description | Default |
|-----------------|-------|------------------------------------------------|----------------------|
| `--prefix` | `-p` | Custom environment variable prefix | `NPMRC_`|
| `--without-prefix`| `-w`| Do not use any prefix for environment variables| `false` |

These options provide flexibility in configuring environment variables and allow tailoring the utility to your specific needs.

[!NOTE]
To display the help message for command-line options, use the `--help` or `-h` option when invoking the utility:

## Contributing

Contributions are welcome! If you encounter issues or have suggestions, please feel free to open an [issue](https://github.com/dennzimm/npmrc-replace-env/issues) or submit a [pull request](https://github.com/dennzimm/npmrc-replace-env/pulls).
Expand Down
5 changes: 5 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
};
12 changes: 9 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,22 @@
"scripts": {
"build": "tsup src/index.ts src/cli.ts --format cjs,esm --dts",
"release": "pnpm run build && changeset publish",
"test": "jest",
"lint": "tsc"
},
"dependencies": {
"dotenv-flow": "^4.1.0"
"dotenv-flow": "^4.1.0",
"yargs": "^17.7.2"
},
"devDependencies": {
"@changesets/cli": "^2.27.1",
"@types/node": "^20.11.19",
"@types/jest": "^29.5.12",
"@types/node": "^20.11.27",
"@types/yargs": "^17.0.32",
"jest": "^29.7.0",
"ts-jest": "^29.1.2",
"tsup": "^8.0.2",
"typescript": "^5.3.3"
"typescript": "^5.4.2"
},
"files": [
"dist/*.js",
Expand Down
Loading

0 comments on commit 0b5737f

Please sign in to comment.