{"id":20995127,"url":"https://github.com/blackboxvision/create-env","last_synced_at":"2025-08-04T14:41:35.244Z","repository":{"id":52161022,"uuid":"131539225","full_name":"BlackBoxVision/create-env","owner":"BlackBoxVision","description":"🚀 Create .env files based on CI environmental values","archived":false,"fork":false,"pushed_at":"2022-12-07T02:13:10.000Z","size":104,"stargazers_count":11,"open_issues_count":5,"forks_count":0,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-04-02T23:40:37.488Z","etag":null,"topics":["cd","ci","env","javascript","library","nodejs"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BlackBoxVision.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-29T23:50:17.000Z","updated_at":"2022-01-09T15:17:37.000Z","dependencies_parsed_at":"2023-01-24T12:46:47.271Z","dependency_job_id":null,"html_url":"https://github.com/BlackBoxVision/create-env","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlackBoxVision%2Fcreate-env","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlackBoxVision%2Fcreate-env/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlackBoxVision%2Fcreate-env/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BlackBoxVision%2Fcreate-env/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BlackBoxVision","download_url":"https://codeload.github.com/BlackBoxVision/create-env/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254230817,"owners_count":22036248,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cd","ci","env","javascript","library","nodejs"],"created_at":"2024-11-19T07:21:49.614Z","updated_at":"2025-05-14T21:30:59.229Z","avatar_url":"https://github.com/BlackBoxVision.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# :rocket: Create-Env :rocket: \n[![NPM Version](https://img.shields.io/npm/v/create-env.svg?maxAge=2592000)](https://img.shields.io/npm/v/create-env.svg?maxAge=2592000) [![License: MIT](https://img.shields.io/badge/License-MIT-brightgreen.svg)](https://opensource.org/licenses/MIT)  [![Build Status](https://travis-ci.org/BlackBoxVision/create-env.svg?branch=master)](https://travis-ci.org/BlackBoxVision/create-env) [![Coverage Status](https://coveralls.io/repos/github/BlackBoxVision/create-env/badge.svg?branch=master)](https://coveralls.io/github/BlackBoxVision/create-env?branch=master) [![codecov](https://codecov.io/gh/BlackBoxVision/create-env/branch/master/graph/badge.svg)](https://codecov.io/gh/BlackBoxVision/create-env) \n![npm](https://img.shields.io/npm/dm/create-env.svg)\n\n\n`create-env` is an utility to help you create .env files based on CI/CD environmental values. \n\n## Use case\n\nYou use Gitlab-CI/CD or another CI/CD to perform a build of a software artifact and you want to use the provided CI/CD secret variables as a `.env` file. This is where `create-env` comes to the rescue. \n\n## How it Works\n\nYou have defined your secret-variables inside of the CI/CD, and your variables uses a prefix like `DEV_`, `TEST_`, `PROD_`. `create-env` will take the current environment for your CI/CD pipeline, a prefix related to that environment, and the name of the file you want as output. \n\nThen, it will generate that .env file, and remove the `prefix` of each secret-variable.\n\ne.g: \n\n- `Your secret-variables`:\n\n```shell\nTEST_NODE_ENV=production\nTEST_PORT=8080\n````\n\n- `Your .env file output`:\n\n```shell\nNODE_ENV=production\nPORT=8080\n```\n\n## Installation\n\n`create-env` needs to be installed as a global dependency: \n\n### NPM\n\n```shell\nnpm i -g create-env\n```\n\n### YARN\n\n```shell\nyarn global add create-env\n```\n\n## Creating a .env file\n\nTo create a `.env file` you have to run `create-env` with the following parameters:\n\n```shell\n# Default\ncreate-env --env-file .env --env-prefix TEST_\n\n# NPX\nnpx create-env --env-file .env --env-prefix TEST_\n```\n\n`create-env` comes with a set of default prefixes (`DEV_`, `TEST_`, `PROD_`), if your secret-variables use those default prefixes, you can run `create-env` with the following parameters, the only thing your have to pass is the `env` which can be one of `development`, `testing` or `production`:\n\n```shell\n# Default\ncreate-env --env testing --env-file .env --use-default-prefix\n\n# NPX\nnpx create-env --env testing --env-file .env --use-default-prefix\n``` \n\n## TODO\n\n- [ ] Add `--from-template` option. (In order to support .env generation based on another .env file).\n- [ ] Add `--no-prefix` option. (In order to support generate a .env file with all the env variables).\n- [ ] Add `--type` option. (In order to support other formats like JSON envs).\n- [ ] Add `--help` option. \n\n## Issues\n\nIf you raise a bug, please, open an [issue](https://github.com/BlackBoxVision/create-env/issues).\n\n## Contributing\n\nPRs are welcome. Any kind of contribution is welcome. \n\n## License\n\n`create-env` is licensed as [MIT](https://github.com/BlackBoxVision/create-env/blob/master/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblackboxvision%2Fcreate-env","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblackboxvision%2Fcreate-env","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblackboxvision%2Fcreate-env/lists"}