{"id":16293729,"url":"https://github.com/axetroy/nodapt","last_synced_at":"2026-01-12T00:40:04.484Z","repository":{"id":233152237,"uuid":"786166809","full_name":"axetroy/nodapt","owner":"axetroy","description":"node version manager for version constraint","archived":false,"fork":false,"pushed_at":"2024-10-10T01:11:54.000Z","size":2875,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-10T01:15:18.958Z","etag":null,"topics":["fnm","nodejs","nvm","version-manager","virtual-node-env"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@axetroy/virtual-node-env","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/axetroy.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-13T16:12:30.000Z","updated_at":"2024-10-10T01:05:45.000Z","dependencies_parsed_at":"2024-04-16T02:26:28.692Z","dependency_job_id":"5375d6e7-df6c-4538-8fda-d65dd93a5608","html_url":"https://github.com/axetroy/nodapt","commit_stats":{"total_commits":160,"total_committers":1,"mean_commits":160.0,"dds":0.0,"last_synced_commit":"524f32f63f35d68389101c84165e080b8025f2ab"},"previous_names":["axetroy/virtual-node-env","axetroy/nodapt"],"tags_count":46,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axetroy%2Fnodapt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axetroy%2Fnodapt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axetroy%2Fnodapt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axetroy%2Fnodapt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/axetroy","download_url":"https://codeload.github.com/axetroy/nodapt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244543802,"owners_count":20469562,"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":["fnm","nodejs","nvm","version-manager","virtual-node-env"],"created_at":"2024-10-10T20:12:11.004Z","updated_at":"2026-01-12T00:40:04.476Z","avatar_url":"https://github.com/axetroy.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"English | [中文简体](README_zh-CN.md)\n\n[![Build Status](https://github.com/axetroy/nodapt/workflows/ci/badge.svg)](https://github.com/axetroy/nodapt/actions)\n[![Go Report Card](https://goreportcard.com/badge/github.com/axetroy/nodapt)](https://goreportcard.com/report/github.com/axetroy/nodapt)\n![Latest Version](https://img.shields.io/github/v/release/axetroy/nodapt.svg)\n[![996.icu](https://img.shields.io/badge/link-996.icu-red.svg)](https://996.icu)\n![Repo Size](https://img.shields.io/github/repo-size/axetroy/nodapt.svg)\n\n### Introduction\n\nNodapt (/noʊˈdæpt/) is a command-line tool designed to work with multiple Node.js versions. It automatically selects and uses the appropriate Node.js version to run commands based on the version constraints specified in the `package.json` file.\n\n### Background\n\nWhen developing Node.js projects, it is common to switch between different Node.js versions. For example, Project A might require `16.x.y`, while Project B uses `20.x.y`.\n\nHowever, traditional global version management tools (e.g., nvm) often fall short in meeting these needs due to the following issues:\n\n1. **Limited cross-platform support**: nvm is not very convenient to use on Windows.\n2. **Pre-installation requirements**: nvm requires pre-installing specific versions, which is not ideal for CI/CD environments.\n3. **Lack of Monorepo support**: In Monorepo setups, different subprojects may require different Node.js versions, which nvm cannot handle effectively.\n\nTo address these challenges, Nodapt was developed. It automatically selects and installs the appropriate Node.js version to run commands based on the version constraints in `package.json`.\n\n### Features\n\n- [x] Cross-platform support (Mac/Linux/Windows)\n- [x] Automatically select and install the appropriate Node.js version to run commands\n- [x] Support for running commands with a specified Node.js version\n- [x] Support for Node.js version constraints in `package.json`\n- [x] Monorepo project support\n- [x] CI/CD environment support\n- [x] Compatibility with other Node.js version managers (e.g., nvm, n, fnm)\n- [x] Support for opening a new shell session with the `nodapt use \u003cversion\u003e` command\n\n### Usage\n\n```bash\n# Automatically select the appropriate Node.js version to run a command\n$ nodapt node -v\n\n# Run a command with a specified Node.js version\n$ nodapt use ^18 node -v\n\n# Specify a version range and open a new shell session\n$ nodapt use 20\n```\n\n### Integrating with Your Node.js Project\n\n1. Add Node.js version constraints to your `package.json` file:\n\n```diff\n+  \"engines\": {\n+    \"node\": \"^20.x.x\"\n+  },\n  \"scripts\": {\n    \"dev\": \"vite dev\"\n  }\n```\n\n2. Use the `nodapt` command to run scripts:\n\n```diff\n- yarn dev\n+ nodapt yarn dev\n```\n\nRun `nodapt --help` to see more options.\n\n### Installation\n\n#### Install via [Cask](https://github.com/cask-pkg/cask.rs) (Mac/Linux/Windows)\n\n```bash\n$ cask install github.com/axetroy/nodapt\n$ nodapt --help\n```\n\n#### Install via npm\n\n```bash\n$ npm install @axetroy/nodapt -g\n$ nodapt --help\n```\n\n### Uninstallation\n\n```bash\n$ nodapt clean # or remove the ~/.nodapt directory\n# Then remove the executable file or uninstall it via your package manager\n```\n\n### Node.js Version Selection Algorithm\n\nThis section explains how `nodapt` behaves and selects the appropriate Node.js version when executed:\n\n1. Check if a `package.json` file exists in the current directory.\n2. If it exists:\n   1. Check if the `engines.node` field specifies a version constraint:\n      - If the currently installed version satisfies the constraint, use it directly.\n      - If not, select the latest matching version from the remote list, install it, and then run the command.\n   2. If `engines.node` is not specified, run the command directly.\n3. If `package.json` does not exist, run the command directly.\n\n### Similar Projects\n\n- [https://github.com/jdx/mise](https://github.com/jdx/mise)\n- [https://github.com/gvcgo/version-manager](https://github.com/gvcgo/version-manager)\n- [https://github.com/version-fox/vfox](https://github.com/version-fox/vfox)\n\n### License\n\nThis project is licensed under the [Anti-996 License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faxetroy%2Fnodapt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faxetroy%2Fnodapt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faxetroy%2Fnodapt/lists"}