https://github.com/jesusgraterol/gui-environment
The gui-environment package is a command-line tool that simplifies managing environment variables for your application. Easily set up different configurations based on your build mode (development or production) for a smooth development workflow.
https://github.com/jesusgraterol/gui-environment
development env environment environment-variables production react typescript vite
Last synced: 5 months ago
JSON representation
The gui-environment package is a command-line tool that simplifies managing environment variables for your application. Easily set up different configurations based on your build mode (development or production) for a smooth development workflow.
- Host: GitHub
- URL: https://github.com/jesusgraterol/gui-environment
- Owner: jesusgraterol
- License: mit
- Created: 2024-05-02T16:37:25.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-07-28T14:36:01.000Z (11 months ago)
- Last Synced: 2025-10-22T01:59:27.947Z (8 months ago)
- Topics: development, env, environment, environment-variables, production, react, typescript, vite
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/gui-environment
- Size: 211 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# GUI Environment
The `gui-environment` package is a command-line tool that simplifies managing environment variables for your application. Easily set up different configurations based on your build mode (development, staging or production) for a smooth development workflow.
## Getting Started
Install the package:
```bash
npm i -D gui-environment
```
Initialize your project's environment:
```bash
npx gui-environment --init
# using a custom source path
npx gui-environment --src="custom-src" --init
```
Include the `gui-environment` binary in your `package.json` file:
```json
...
"scripts": {
"build-dev": "gui-environment --development && tsc -b && vite build && ...",
"build-staging": "gui-environment --staging && tsc -b && vite build && ...",
"build-production": "gui-environment --production && tsc -b && vite build && ...",
// using a custom source path
"build-dev": "gui-environment --src='custom-src' --development && tsc -b && vite build && ...",
}
...
```
### Output Example
```
project
│
src/
│ ├───components/
│ │ └───...
│ ├───environment/
│ | ├───environment.development.ts
│ | ├───environment.production.ts
│ | ├───environment.staging.ts
│ | ├───environment.ts
│ | └───types.ts
│ └───main.tsx
│
package.json
tsconfig.json
...
```
### Usage
Once initialized, include your environment variables in the following files accordingly:
- `environment.development.ts`
- `environment.production.ts`
- `environment.staging.ts`
- `types.ts`
Use the environment variables anywhere:
```typescript
// main.tsx
import { ENVIRONMENT } from './environment/environment.ts';
ENVIRONMENT
// {
// production: false,
// version: '1.0.0'
// }
```
**Important:** keep in mind that whatever data you include in these files will be public when your app is deployed. Avoid sharing sensitive information such as API keys, secrets, etc...
## Built With
- TypeScript
## Running the Tests
```bash
# unit tests
npm run test:unit
# integration tests
npm run test:integration
```
## License
[MIT](https://choosealicense.com/licenses/mit/)