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:
npm install -D gui-environment
Initialize your project's environment:
npx gui-environment --init
npx gui-environment --src="custom-src" --init
Include the gui-environment
binary in your package.json
file:
...
"scripts": {
"build-dev": "gui-environment --development && vite && ...",
"build-staging": "gui-environment --staging && vite && ...",
"build-production": "gui-environment --production && tsc -b && vite build && ...",
"build-dev": "gui-environment --src='custom-src' --development && vite && ...",
}
...
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:
Use the environment variables anywhere:
import { ENVIRONMENT } from './environment/environment.ts';
ENVIRONMENT
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
Running the Tests
npm run test:unit
npm run test:integration
License
MIT
Deployment
Install dependencies:
npm install
Build the project:
npm start
Publish to npm
:
npm publish