Skip to content

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.

License

jesusgraterol/gui-environment

Repository files navigation

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

# Using a custom source path
$ npx gui-environment --src="custom-src" --init

Include the gui-environment binary in your package.json file:

...
"scripts": {
  "build-dev": "gui-environment --development && tsc && ...",
  "build-staging": "gui-environment --staging && tsc && ...",
  "build-production": "gui-environment --production && tsc && ...",

  // Using a custom source path
  "build-dev": "gui-environment --src='custom-src' --development && tsc && ...",
}
...

Output Example

project
    │
    src/
    │  ├───components/
    │  │         └───...
    │  ├───environment/
    │  |         ├───environment.development.ts
    │  |         ├───environment.production.ts
    │  |         ├───environment.staging.ts
    │  |         ├───environment.ts
    │  |         ├───index.ts
    │  |         └───types.ts
    │  └───main.tsx
    │
    package.json
    tscofig.json
    ...

Usage

Once initialized, include your environment variables in the following files accordingly:

  1. environment.development.ts

  2. environment.production.ts

  3. environment.staging.ts

Use the environment variables anywhere:

// main.tsx
import { ENVIRONMENT } from './environment';

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

# Unit Tests
$ npm run test:unit

# Integration Tests
$ npm run test:integration

License

MIT


Acknowledgments


Deployment

Install dependencies:

$ npm install

Build the project:

$ npm start

Publish to npm:

$ npm publish

About

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.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published