{"id":18668294,"url":"https://github.com/markis/if-ver","last_synced_at":"2026-05-12T07:39:05.047Z","repository":{"id":45254226,"uuid":"86937650","full_name":"markis/if-ver","owner":"markis","description":"Simple if-version check for node","archived":false,"fork":false,"pushed_at":"2023-07-19T07:11:35.000Z","size":76,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-28T08:47:58.549Z","etag":null,"topics":["bash","npm","package-json","scripting"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/if-ver","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/markis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-04-01T19:32:29.000Z","updated_at":"2021-12-27T20:04:44.000Z","dependencies_parsed_at":"2024-06-21T02:14:44.852Z","dependency_job_id":"a143a9f1-15b5-4d81-bb4f-c22998f6ce00","html_url":"https://github.com/markis/if-ver","commit_stats":{"total_commits":47,"total_committers":3,"mean_commits":"15.666666666666666","dds":0.04255319148936165,"last_synced_commit":"4f19670d5add59f21de18a38d45a1cf18d19c09e"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markis%2Fif-ver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markis%2Fif-ver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markis%2Fif-ver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/markis%2Fif-ver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/markis","download_url":"https://codeload.github.com/markis/if-ver/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239498661,"owners_count":19648918,"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":["bash","npm","package-json","scripting"],"created_at":"2024-11-07T08:42:11.272Z","updated_at":"2025-11-06T16:30:30.285Z","avatar_url":"https://github.com/markis.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# if-ver - simple node version check\n\n\n[![node](https://img.shields.io/node/v/if-ver.svg)](https://www.npmjs.com/package/if-ver)\n[![npm test](https://github.com/markis/if-ver/actions/workflows/test.yml/badge.svg)](https://github.com/markis/if-ver/actions/workflows/test.yml)\n\n## Description\n\nCheck installed node version against a requested version using an comparison operator.\nThe main purpose of this script is make it easier to only run scripts if the node version is correct.\nThis is meant to be simple and have zero dependencies, so that it will be very exportable and versatile.\n\n### Installation\n\n```\nnpm install if-ver --save-dev\n```\n\n```\nyarn add if-ver --dev\n```\n\n## Usage\n\n```bash\nif-ver [comparison-operator] [semantic-version]\n```\n\n### package.json usage\n```json\n\"scripts\": {\n  \"test\": \"if-ver -gt 4 || exit 0; run-node-4-thing\"\n}\n```\n\n### Comparison operators:\n\nSimilar to the bash comparision operators:\n\n  * -eq - is equal to\n  * -ne - is not equal to\n  * -gt - is greater than\n  * -lt - is less than\n  * -ge - is greater than or equal to\n  * -le - is less than or equal to\n\n## Examples:\n\n  Only run eslint if node version is at least 4 (else do nothing):\n  ```json\n  \"scripts\": {\n    \"lint\": \"if-ver -gt 4 || exit 0; eslint *.js\"\n  }\n  ```\n\n  Only compile typescript if node version is at least 4.2 (else do nothing):\n  ```json\n  \"scripts\": {\n    \"build\": \"if-ver -gt 4.2 || exit 0; tsc\"\n  }\n  ```\n\n  Only run webpack if node version is (\u003e= 4.3 \u0026\u0026 \u003c5) || \u003e 5.10 (else do nothing):\n  ```json\n  \"scripts\": {\n    \"build\": \"(if-ver -ge 4.3 \u0026\u0026 if-ver -lt 5) || if-ver -gt 5.10 || exit 0; webpack\"\n  }\n  ```\n\n  Only run rollup if node version is \u003e= 0.12 (else do nothing):\n  ```json\n  \"scripts\": {\n    \"build\": \"if-ver -ge 0.12 || exit 0; rollup -c\"\n  }\n  ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkis%2Fif-ver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarkis%2Fif-ver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarkis%2Fif-ver/lists"}