envilder 0.3.0 β†’ 0.3.1

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.
@@ -1,48 +1,51 @@
1
- name: 🌱 unit-tests
2
-
3
- on:
4
- workflow_dispatch: {}
5
-
6
- pull_request:
7
- branches:
8
- - "*"
9
- types:
10
- - opened
11
- - reopened
12
- - synchronize
13
- - ready_for_review
14
- paths:
15
- - ".github/workflows/unit-tests.yml"
16
- - "src/**"
17
-
18
- concurrency:
19
- group: ${{ github.workflow }}-${{ github.head_ref || github.sha }}
20
- cancel-in-progress: true
21
-
22
- jobs:
23
- envilder-test:
24
- runs-on: ubuntu-24.04
25
- if: ${{ !github.event.pull_request.draft }}
26
- timeout-minutes: 30
27
-
28
- steps:
29
- - name: πŸš€ ♂️ Checkout
30
- uses: actions/checkout@v4
31
-
32
- - name: πŸ› οΈ Setup Node.js with Cache
33
- uses: actions/setup-node@v4
34
- with:
35
- node-version: '20.x'
36
- cache: 'yarn'
37
-
38
- - name: πŸ“¦ Install packages
39
- run: yarn install
40
-
41
- - name: πŸ” Run code quality checker
42
- run: yarn lint
43
-
44
- - name: 🚧 Build
45
- run: yarn build
46
-
47
- - name: πŸš΄β€β™€οΈ Run unit tests
48
- run: yarn test
1
+ name: 🌱 unit-tests
2
+
3
+ on:
4
+ workflow_dispatch: {}
5
+
6
+ pull_request:
7
+ branches:
8
+ - "*"
9
+ types:
10
+ - opened
11
+ - reopened
12
+ - synchronize
13
+ - ready_for_review
14
+ paths:
15
+ - ".github/workflows/unit-tests.yml"
16
+ - "src/**"
17
+
18
+ concurrency:
19
+ group: ${{ github.workflow }}-${{ github.head_ref || github.sha }}
20
+ cancel-in-progress: true
21
+
22
+ jobs:
23
+ envilder-test:
24
+ runs-on: ubuntu-24.04
25
+ if: ${{ !github.event.pull_request.draft }}
26
+ timeout-minutes: 30
27
+
28
+ steps:
29
+ - name: πŸš€ ♂️ Checkout
30
+ uses: actions/checkout@v4
31
+
32
+ - name: πŸ› οΈ Setup Node.js with Cache
33
+ uses: actions/setup-node@v4
34
+ with:
35
+ node-version: '20.x'
36
+ cache: 'yarn'
37
+
38
+ - name: πŸ“¦ Install packages
39
+ run: yarn install --frozen-lockfile
40
+
41
+ - name: πŸ” Run formatting checker
42
+ run: yarn format
43
+
44
+ - name: πŸ” Run code quality checker
45
+ run: yarn lint
46
+
47
+ - name: 🚧 Build
48
+ run: yarn build
49
+
50
+ - name: πŸš΄β€β™€οΈ Run unit tests
51
+ run: yarn test
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2024 MarΓ§al Albert
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.
1
+ MIT License
2
+
3
+ Copyright (c) 2024 MarΓ§al Albert
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 CHANGED
@@ -1,144 +1,144 @@
1
- ![Envilder](https://github.com/user-attachments/assets/f646a3e7-6ae2-4f3b-8f51-3807067fc99c)
2
-
3
- Envilder is a CLI tool for managing AWS SSM Parameter Store parameters and automatically generating the required
4
- `.env` file. This tool simplifies project environment variable management, avoiding manual updates and ensuring
5
- consistency across environments.
6
-
7
- # ✨ Features
8
-
9
- - πŸ”’ Fetch parameters securely from AWS SSM Parameter Store.
10
- - ⚑ Automatically generates a `.env` file with specified parameters.
11
- - πŸ›‘οΈ Handles encrypted SSM parameters.
12
- - πŸͺΆ Lightweight and simple to use.
13
- - πŸ”„ Support for multiple AWS profiles.
14
-
15
- # Prerequisites
16
-
17
- Before using `Envilder`, ensure that you have the AWS CLI installed and properly configured on your local
18
- machine. This configuration is required for `Envilder` to access and manage parameters in AWS SSM.
19
-
20
- ## AWS CLI Installation & Configuration
21
-
22
- 1. Install the AWS CLI by following the instructions [here](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html).
23
- 2. After installation, configure the AWS CLI using the following command:
24
-
25
- ```bash
26
- aws configure
27
- ```
28
-
29
- You'll be prompted to provide:
30
- - AWS Access Key ID
31
- - AWS Secret Access Key
32
- - Default region name (e.g., `us-east-1`)
33
- - Default output format (e.g., `json`)
34
-
35
- Make sure that the AWS credentials you're using have the appropriate permissions to access the SSM Parameter
36
- Store in your AWS account.
37
-
38
- # Installation
39
-
40
- You can install `Envilder` globally using yarn. This will allow you to use the `envilder` command from any
41
- directory on your system.
42
-
43
- ```bash
44
- yarn global add envilder
45
- ```
46
-
47
- # πŸ“¦ Installation
48
-
49
- You can install **envilder** globally or locally using npm:
50
-
51
- ```bash
52
- npm install -g envilder
53
- ```
54
-
55
- # πŸš€ Usage
56
-
57
- Envilder requires two arguments:
58
-
59
- - `--map <path>`: Path to a JSON file mapping environment variable names to SSM parameters.
60
- - `--envfile <path>`: Path where the generated .env file will be saved.
61
-
62
- Optional arguments:
63
-
64
- - `--profile <name>`: AWS CLI profile to use for credentials (if not using the default profile).
65
-
66
- # πŸ”§ Example
67
-
68
- 1. Create a mapping file `param_map.json`:
69
-
70
- ```json
71
- {
72
- "SECRET_TOKEN": "/path/to/ssm/token",
73
- "SECRET_KEY": "/path/to/ssm/password"
74
- }
75
- ```
76
-
77
- 2. Run envilder to generate your `.env` file:
78
-
79
- ```bash
80
- envilder --map=param_map.json --envfile=.env
81
- ```
82
-
83
- 3. To use a specific AWS profile:
84
-
85
- ```bash
86
- envilder --map=param_map.json --envfile=.env --profile=dev-account
87
- ```
88
-
89
- 4. The `.env` file will be generated in the specified location.
90
-
91
- ## 🌐 Working with Multiple AWS Profiles
92
-
93
- If you work with multiple AWS accounts or environments, you can configure different profiles in your AWS credentials file:
94
-
95
- 1. Edit your AWS credentials file (usually at `~/.aws/credentials` on Linux/Mac or `%USERPROFILE%\.aws\credentials` on Windows):
96
-
97
- ```ini
98
- [default]
99
- aws_access_key_id=YOUR_DEFAULT_ACCESS_KEY
100
- aws_secret_access_key=YOUR_DEFAULT_SECRET_KEY
101
-
102
- [dev-account]
103
- aws_access_key_id=YOUR_DEV_ACCESS_KEY
104
- aws_secret_access_key=YOUR_DEV_SECRET_KEY
105
-
106
- [prod-account]
107
- aws_access_key_id=YOUR_PROD_ACCESS_KEY
108
- aws_secret_access_key=YOUR_PROD_SECRET_KEY
109
- ```
110
-
111
- 2. When running Envilder, specify which profile to use with the `--profile` option:
112
-
113
- ```bash
114
- # For development environment
115
- envilder --map=param_map.json --envfile=.env.development --profile=dev-account
116
-
117
- # For production environment
118
- envilder --map=param_map.json --envfile=.env.production --profile=prod-account
119
- ```
120
-
121
- # πŸ“‚ Sample `.env` Output
122
-
123
- ```makefile
124
- SECRET_TOKEN=mockedEmail@example.com
125
- SECRET_KEY=mockedPassword
126
- ```
127
-
128
- # πŸ§ͺ Running Tests
129
-
130
- To run the tests with coverage:
131
-
132
- ```bash
133
- yarn test
134
- ```
135
-
136
- Here you can see the current coverage report: <https://macalbert.github.io/envilder/>
137
-
138
- # πŸ“ License
139
-
140
- This project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details.
141
-
142
- # πŸ™Œ Contributing
143
-
144
- Contributions are welcome! Feel free to submit issues and pull requests.
1
+ ![Envilder](https://github.com/user-attachments/assets/f646a3e7-6ae2-4f3b-8f51-3807067fc99c)
2
+
3
+ Envilder is a CLI tool for managing AWS SSM Parameter Store parameters and automatically generating the required
4
+ `.env` file. This tool simplifies project environment variable management, avoiding manual updates and ensuring
5
+ consistency across environments.
6
+
7
+ # ✨ Features
8
+
9
+ - πŸ”’ Fetch parameters securely from AWS SSM Parameter Store.
10
+ - ⚑ Automatically generates a `.env` file with specified parameters.
11
+ - πŸ›‘οΈ Handles encrypted SSM parameters.
12
+ - πŸͺΆ Lightweight and simple to use.
13
+ - πŸ”„ Support for multiple AWS profiles.
14
+
15
+ # Prerequisites
16
+
17
+ Before using `Envilder`, ensure that you have the AWS CLI installed and properly configured on your local
18
+ machine. This configuration is required for `Envilder` to access and manage parameters in AWS SSM.
19
+
20
+ ## AWS CLI Installation & Configuration
21
+
22
+ 1. Install the AWS CLI by following the instructions [here](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html).
23
+ 2. After installation, configure the AWS CLI using the following command:
24
+
25
+ ```bash
26
+ aws configure
27
+ ```
28
+
29
+ You'll be prompted to provide:
30
+ - AWS Access Key ID
31
+ - AWS Secret Access Key
32
+ - Default region name (e.g., `us-east-1`)
33
+ - Default output format (e.g., `json`)
34
+
35
+ Make sure that the AWS credentials you're using have the appropriate permissions to access the SSM Parameter
36
+ Store in your AWS account.
37
+
38
+ # Installation
39
+
40
+ You can install `Envilder` globally using yarn. This will allow you to use the `envilder` command from any
41
+ directory on your system.
42
+
43
+ ```bash
44
+ yarn global add envilder
45
+ ```
46
+
47
+ # πŸ“¦ Installation
48
+
49
+ You can install **envilder** globally or locally using npm:
50
+
51
+ ```bash
52
+ npm install -g envilder
53
+ ```
54
+
55
+ # πŸš€ Usage
56
+
57
+ Envilder requires two arguments:
58
+
59
+ - `--map <path>`: Path to a JSON file mapping environment variable names to SSM parameters.
60
+ - `--envfile <path>`: Path where the generated .env file will be saved.
61
+
62
+ Optional arguments:
63
+
64
+ - `--profile <name>`: AWS CLI profile to use for credentials (if not using the default profile).
65
+
66
+ # πŸ”§ Example
67
+
68
+ 1. Create a mapping file `param-map.json`:
69
+
70
+ ```json
71
+ {
72
+ "SECRET_TOKEN": "/path/to/ssm/token",
73
+ "SECRET_KEY": "/path/to/ssm/password"
74
+ }
75
+ ```
76
+
77
+ 2. Run envilder to generate your `.env` file:
78
+
79
+ ```bash
80
+ envilder --map=param-map.json --envfile=.env
81
+ ```
82
+
83
+ 3. To use a specific AWS profile:
84
+
85
+ ```bash
86
+ envilder --map=param-map.json --envfile=.env --profile=dev-account
87
+ ```
88
+
89
+ 4. The `.env` file will be generated in the specified location.
90
+
91
+ ## 🌐 Working with Multiple AWS Profiles
92
+
93
+ If you work with multiple AWS accounts or environments, you can configure different profiles in your AWS credentials file:
94
+
95
+ 1. Edit your AWS credentials file (usually at `~/.aws/credentials` on Linux/Mac or `%USERPROFILE%\.aws\credentials` on Windows):
96
+
97
+ ```ini
98
+ [default]
99
+ aws_access_key_id=YOUR_DEFAULT_ACCESS_KEY
100
+ aws_secret_access_key=YOUR_DEFAULT_SECRET_KEY
101
+
102
+ [dev-account]
103
+ aws_access_key_id=YOUR_DEV_ACCESS_KEY
104
+ aws_secret_access_key=YOUR_DEV_SECRET_KEY
105
+
106
+ [prod-account]
107
+ aws_access_key_id=YOUR_PROD_ACCESS_KEY
108
+ aws_secret_access_key=YOUR_PROD_SECRET_KEY
109
+ ```
110
+
111
+ 2. When running Envilder, specify which profile to use with the `--profile` option:
112
+
113
+ ```bash
114
+ # For development environment
115
+ envilder --map=param-map.json --envfile=.env.development --profile=dev-account
116
+
117
+ # For production environment
118
+ envilder --map=param-map.json --envfile=.env.production --profile=prod-account
119
+ ```
120
+
121
+ # πŸ“‚ Sample `.env` Output
122
+
123
+ ```makefile
124
+ SECRET_TOKEN=mockedEmail@example.com
125
+ SECRET_KEY=mockedPassword
126
+ ```
127
+
128
+ # πŸ§ͺ Running Tests
129
+
130
+ To run the tests with coverage:
131
+
132
+ ```bash
133
+ yarn test
134
+ ```
135
+
136
+ Here you can see the current coverage report: <https://macalbert.github.io/envilder/>
137
+
138
+ # πŸ“ License
139
+
140
+ This project is licensed under the MIT License - see the [LICENSE](./LICENSE) file for details.
141
+
142
+ # πŸ™Œ Contributing
143
+
144
+ Contributions are welcome! Feel free to submit issues and pull requests.
package/biome.json CHANGED
@@ -1,17 +1,8 @@
1
1
  {
2
2
  "$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
3
3
  "files": {
4
- "include": [
5
- "./src/**",
6
- "./tests/**",
7
- "package.json",
8
- "biome.json",
9
- ".secretlintrc.json",
10
- "tsconfig.json",
11
- "tsconfig.build.json",
12
- "vite.config.ts",
13
- "repopack.config.json"
14
- ]
4
+ "include": ["./src/**", "./tests/**"],
5
+ "ignore": ["**/node_modules/**", "**/lib/**", "**/dist/**", "**/coverage/**", "**/.lock", "**/.md"]
15
6
  },
16
7
  "organizeImports": {
17
8
  "enabled": true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "envilder",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "A CLI tool to generate .env files from AWS SSM parameters",
5
5
  "exports": {
6
6
  ".": {
@@ -11,16 +11,19 @@
11
11
  "envilder": "lib/cli/cliRunner.js"
12
12
  },
13
13
  "scripts": {
14
- "clean": "rimraf lib",
15
- "test-run": "npm run build && node lib/cli/cliRunner.js --map=tests/sample/param_map.json --envfile=.env",
16
- "build": "npm run clean && tsc -p tsconfig.build.json --sourceMap --declaration",
17
- "lint": "biome lint --write && biome format --write && biome check --write && tsc --noEmit && secretlint **/*",
14
+ "clean": "npx jest --clearCache && yarn cache clean --force && npx rimraf lib && npx rimraf node_modules && npx rimraf coverage && npx rimraf yarn.lock",
15
+ "test-run": "yarn build && node lib/cli/cliRunner.js --map=tests/sample/param-map.json --envfile=tests/sample/autogenerated.env",
16
+ "build": "tsc -p tsconfig.build.json --sourceMap --declaration",
17
+ "format": "npx biome format",
18
+ "format:write": "npx biome format --write",
19
+ "lint": "npx secretlint \"**/*\" && biome lint --write && biome format --write && biome check --write && tsc --noEmit",
20
+ "lint:fix": "npx biome lint --fix",
18
21
  "test": "vitest run --reporter verbose --coverage",
19
- "cli-run": "npm run build && node --trace-warnings lib",
20
- "npm-publish": "npm run lint && npm run build && npm publish",
21
- "npm-release-patch": "npm version patch && npm run npm-publish",
22
- "npm-release-minor": "npm version minor && npm run npm-publish",
23
- "npm-release-prerelease": "npm version prerelease && npm run npm-publish"
22
+ "cli-run": "yarn build && node --trace-warnings lib",
23
+ "npm-publish": "yarn lint && yarn build && yarn publish",
24
+ "npm-release-patch": "yarn version --new-version patch",
25
+ "npm-release-minor": "yarn version --new-version minor",
26
+ "npm-release-prerelease": "yarn version --new-version prerelease"
24
27
  },
25
28
  "keywords": [],
26
29
  "repository": {
@@ -37,10 +40,8 @@
37
40
  },
38
41
  "type": "module",
39
42
  "dependencies": {
40
- "@aws-sdk/client-ssm": "^3.654.0",
43
+ "@aws-sdk/client-ssm": "^3.806.0",
41
44
  "@aws-sdk/credential-providers": "^3.806.0",
42
- "@secretlint/core": "^9.2.1",
43
- "@secretlint/secretlint-rule-preset-recommend": "^9.0.0",
44
45
  "@types/node": "^22.5.5",
45
46
  "commander": "^13.1.0",
46
47
  "dotenv": "^16.4.5",
@@ -48,19 +49,16 @@
48
49
  },
49
50
  "devDependencies": {
50
51
  "@biomejs/biome": "^1.9.1",
52
+ "@secretlint/secretlint-rule-preset-recommend": "^9.3.2",
51
53
  "@vitest/coverage-v8": "^3.1.1",
52
54
  "rimraf": "^6.0.1",
53
- "secretlint": "^9.0.0",
55
+ "secretlint": "^9.3.2",
54
56
  "ts-node": "^10.9.2",
55
57
  "typescript": "^5.6.2",
56
58
  "vitest": "^3.1.1"
57
59
  },
58
- "resolutions": {
59
- "string-width": "4.2.3",
60
- "strip-ansi": "6.0.1"
61
- },
62
60
  "engines": {
63
61
  "node": ">=20.0.0",
64
62
  "yarn": ">=1.22"
65
63
  }
66
- }
64
+ }
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env node
2
-
3
2
  import { Command } from 'commander';
4
3
  import { run } from '../index.js';
5
4
 
@@ -33,14 +33,23 @@ vi.mock('@aws-sdk/client-ssm', () => {
33
33
  });
34
34
 
35
35
  describe('Envilder CLI', () => {
36
+ const mockMapPath = './tests/param-map.json';
37
+ const mockEnvFilePath = './tests/.env.test';
38
+
36
39
  afterEach(() => {
37
40
  vi.clearAllMocks();
41
+
42
+ if (fs.existsSync(mockEnvFilePath)) {
43
+ fs.unlinkSync(mockEnvFilePath);
44
+ }
45
+
46
+ if (fs.existsSync(mockMapPath)) {
47
+ fs.unlinkSync(mockMapPath);
48
+ }
38
49
  });
39
50
 
40
51
  it('Should_GenerateEnvFileFromSSMParameters_When_ValidSSMParametersAreProvided', async () => {
41
52
  // Arrange
42
- const mockMapPath = './tests/param_map.json';
43
- const mockEnvFilePath = './tests/.env.test';
44
53
  const paramMapContent = {
45
54
  NEXT_PUBLIC_CREDENTIAL_EMAIL: '/path/to/ssm/email',
46
55
  NEXT_PUBLIC_CREDENTIAL_PASSWORD: '/path/to/ssm/password',
@@ -54,14 +63,10 @@ describe('Envilder CLI', () => {
54
63
  const envFileContent = fs.readFileSync(mockEnvFilePath, 'utf-8');
55
64
  expect(envFileContent).toContain('NEXT_PUBLIC_CREDENTIAL_EMAIL=mockedEmail@example.com');
56
65
  expect(envFileContent).toContain('NEXT_PUBLIC_CREDENTIAL_PASSWORD=mockedPassword');
57
- fs.unlinkSync(mockEnvFilePath);
58
- fs.unlinkSync(mockMapPath);
59
66
  });
60
67
 
61
68
  it('Should_ThrowError_When_SSMParameterIsNotFound', async () => {
62
69
  // Arrange
63
- const mockMapPath = './tests/param_map.json';
64
- const mockEnvFilePath = './tests/.env.test';
65
70
  const paramMapContent = {
66
71
  NEXT_PUBLIC_CREDENTIAL_EMAIL: 'non-existent parameter',
67
72
  };
@@ -72,14 +77,10 @@ describe('Envilder CLI', () => {
72
77
 
73
78
  // Assert
74
79
  await expect(action).rejects.toThrow('ParameterNotFound: non-existent parameter');
75
- fs.unlinkSync(mockMapPath);
76
80
  });
77
81
 
78
82
  it('Should_AppendNewSSMParameters_When_EnvFileContainsExistingVariables', async () => {
79
83
  // Arrange
80
- const mockMapPath = './tests/param_map.json';
81
- const mockEnvFilePath = './tests/.env.test';
82
-
83
84
  const existingEnvContent = 'EXISTING_VAR=existingValue';
84
85
  fs.writeFileSync(mockEnvFilePath, existingEnvContent);
85
86
  const paramMapContent = {
@@ -96,14 +97,10 @@ describe('Envilder CLI', () => {
96
97
  expect(updatedEnvFileContent).toContain('EXISTING_VAR=existingValue');
97
98
  expect(updatedEnvFileContent).toContain('NEXT_PUBLIC_CREDENTIAL_EMAIL=mockedEmail@example.com');
98
99
  expect(updatedEnvFileContent).toContain('NEXT_PUBLIC_CREDENTIAL_PASSWORD=mockedPassword');
99
- fs.unlinkSync(mockEnvFilePath);
100
- fs.unlinkSync(mockMapPath);
101
100
  });
102
101
 
103
102
  it('Should_OverwriteSSMParameters_When_EnvFileContainsSameVariables', async () => {
104
103
  // Arrange
105
- const mockMapPath = './tests/param_map.json';
106
- const mockEnvFilePath = './tests/.env.test';
107
104
  const existingEnvContent = 'NEXT_PUBLIC_CREDENTIAL_EMAIL=oldEmail@example.com';
108
105
  fs.writeFileSync(mockEnvFilePath, existingEnvContent);
109
106
  const paramMapContent = {
@@ -119,14 +116,10 @@ describe('Envilder CLI', () => {
119
116
  const updatedEnvFileContent = fs.readFileSync(mockEnvFilePath, 'utf-8');
120
117
  expect(updatedEnvFileContent).toContain('NEXT_PUBLIC_CREDENTIAL_EMAIL=mockedEmail@example.com');
121
118
  expect(updatedEnvFileContent).toContain('NEXT_PUBLIC_CREDENTIAL_PASSWORD=mockedPassword');
122
- fs.unlinkSync(mockEnvFilePath);
123
- fs.unlinkSync(mockMapPath);
124
119
  });
125
120
 
126
121
  it('Should_LogWarning_When_SSMParameterHasNoValue', async () => {
127
122
  // Arrange
128
- const mockMapPath = './tests/param_map.json';
129
- const mockEnvFilePath = './tests/.env.test';
130
123
  const paramMapContent = {
131
124
  NEXT_PUBLIC_CREDENTIAL_PASSWORD: '/path/to/ssm/password_no_value',
132
125
  };
@@ -138,14 +131,10 @@ describe('Envilder CLI', () => {
138
131
 
139
132
  // Assert
140
133
  expect(consoleSpy).toHaveBeenCalledWith(expect.stringContaining('Warning: No value found for'));
141
- fs.unlinkSync(mockEnvFilePath);
142
- fs.unlinkSync(mockMapPath);
143
134
  });
144
135
 
145
136
  it('Should_ConfigureSSMClientWithProfile_When_ProfileIsProvided', async () => {
146
137
  // Arrange
147
- const mockMapPath = './tests/param_map.json';
148
- const mockEnvFilePath = './tests/.env.test';
149
138
  const mockProfile = 'test-profile';
150
139
  const paramMapContent = {
151
140
  NEXT_PUBLIC_CREDENTIAL_EMAIL: '/path/to/ssm/email',
@@ -0,0 +1 @@
1
+ TOKEN_SECRET=this_is_for_test
package/vitest.config.js CHANGED
@@ -1,12 +1,12 @@
1
- // vitest.config.js
2
- import { defineConfig } from 'vitest/config';
3
-
4
- export default defineConfig({
5
- test: {
6
- coverage: {
7
- provider: 'v8',
8
- reporter: ['text', 'html'],
9
- reportsDirectory: './coverage',
10
- },
11
- },
12
- });
1
+ // vitest.config.js
2
+ import { defineConfig } from 'vitest/config';
3
+
4
+ export default defineConfig({
5
+ test: {
6
+ coverage: {
7
+ provider: 'v8',
8
+ reporter: ['text', 'html'],
9
+ reportsDirectory: './coverage',
10
+ },
11
+ },
12
+ });
@@ -1,10 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Parses CLI arguments and runs the environment file generator.
4
- *
5
- * Expects `--map` and `--envfile` options to be provided, with an optional `--profile` for AWS CLI profile selection. Invokes the main process to generate a `.env` file from AWS SSM parameters based on the provided mapping.
6
- *
7
- * @throws {Error} If either `--map` or `--envfile` arguments are missing.
8
- */
9
- export declare function cliRunner(): Promise<void>;
10
- //# sourceMappingURL=cliRunner.d.ts.map