{"id":15497397,"url":"https://github.com/heapwolf/test-env","last_synced_at":"2025-03-18T03:28:55.571Z","repository":{"id":12674941,"uuid":"15346971","full_name":"heapwolf/test-env","owner":"heapwolf","description":"Conditional output based on an environment variable","archived":false,"fork":false,"pushed_at":"2013-12-26T15:29:30.000Z","size":132,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-24T10:47:26.825Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/heapwolf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-12-20T19:56:37.000Z","updated_at":"2014-06-27T03:38:34.000Z","dependencies_parsed_at":"2022-09-02T08:51:49.161Z","dependency_job_id":null,"html_url":"https://github.com/heapwolf/test-env","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heapwolf%2Ftest-env","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heapwolf%2Ftest-env/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heapwolf%2Ftest-env/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heapwolf%2Ftest-env/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/heapwolf","download_url":"https://codeload.github.com/heapwolf/test-env/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244149332,"owners_count":20406356,"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":[],"created_at":"2024-10-02T08:33:22.948Z","updated_at":"2025-03-18T03:28:55.550Z","avatar_url":"https://github.com/heapwolf.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![build-status](https://www.codeship.io/projects/50ca8900-4c7b-0131-1043-328a0651e296/status)](https://www.codeship.io/projects/11256)\n\n# SYNOPSIS\nBash programming does not read clearly inside a `package.json` script field. \nThis program helps test environment variables and create conditional output.\n\n# EXAMPLE\n`package.json` scripts likely want some context about their environment. In \nthis example we want to add the `--debug` flag to the `browserify` program\nbefore we run it, but only if the `NODE_ENV` environment variable has not\nbeen set.\n\n```json\n\"scripts\": {\n  \"build-js\": \"browserify $(test-env !NODE_ENV '--debug') browser/*.js \u003e static/bundle.js\"\n}\n```\n\n# USAGE\n## TESTING\nIf the variable exists, the second argument will be written to `stdout`. If the test is false, \nand a third variable is supplied it will be printed.\n\n```bash\n$test-env VARIABLE_NAME Yes\n```\n\n```bash\n$test-env VARIABLE_NAME Yep Nope\n```\n\nIf the variable does not exist, the second argument will be written to `stdout`. If the test \nis false, and a third variable is supplied it will be printed.\n\n```bash\n$test-env !USER \"Yeah ok, sure\"\n```\n\n```bash\n$test-env !USER 1 2\n```\n\n## COMPARING\nThe comparison operators are supported\n\n - `==` (or `eq`) Equal\n - `!=` (or `not`) Not Equal\n - `gt` Greater Than\n - `lt` Less Than\n - `gte` Greater Than or Equal To\n - `lte` Less Than or Equal To\n\n```bash\n$test-env SHLVL == 2 Yep Nope\nYep\n```\n\n```bash\n$test-env SHLVL gte 1 OK \"NOT OK\"\nOK\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheapwolf%2Ftest-env","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fheapwolf%2Ftest-env","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheapwolf%2Ftest-env/lists"}