{"id":14155485,"url":"https://github.com/danielhuang/cotton","last_synced_at":"2025-04-12T15:40:39.437Z","repository":{"id":40300569,"uuid":"503963324","full_name":"danielhuang/cotton","owner":"danielhuang","description":"A package manager for JavaScript projects. `cotton install` runs faster than `rm -rf node_modules`.","archived":false,"fork":false,"pushed_at":"2025-04-09T02:03:15.000Z","size":1085,"stargazers_count":303,"open_issues_count":14,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-09T03:19:40.201Z","etag":null,"topics":["hacktoberfest","javascript","npm","package-manager","pnpm","yarn"],"latest_commit_sha":null,"homepage":"https://cotton.js.org","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danielhuang.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":"2022-06-16T00:41:11.000Z","updated_at":"2025-04-08T22:49:32.000Z","dependencies_parsed_at":"2024-05-16T00:04:40.904Z","dependency_job_id":"2bcc7571-4efc-4109-b797-3b5f17e4a76e","html_url":"https://github.com/danielhuang/cotton","commit_stats":{"total_commits":751,"total_committers":6,"mean_commits":"125.16666666666667","dds":0.2316910785619174,"last_synced_commit":"756e26b87d9cd31111659db98bd26fdc7dd54412"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielhuang%2Fcotton","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielhuang%2Fcotton/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielhuang%2Fcotton/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danielhuang%2Fcotton/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danielhuang","download_url":"https://codeload.github.com/danielhuang/cotton/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248590771,"owners_count":21129887,"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":["hacktoberfest","javascript","npm","package-manager","pnpm","yarn"],"created_at":"2024-08-17T08:03:27.680Z","updated_at":"2025-04-12T15:40:39.416Z","avatar_url":"https://github.com/danielhuang.png","language":"Rust","funding_links":[],"categories":["package-manager"],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\t\u003cimg width=\"400\" src=\"logo.svg\"\u003e\n\u003c/div\u003e\n\n\u003cp align=\"center\"\u003e\n  Simple and speedy package manager\n\u003c/p\u003e\n\n---\n\n**Simple:** Cotton works with web applications, including those built with [React](https://reactjs.org/), [Next.js](https://nextjs.org/), [Vite](https://vitejs.dev/), [TypeScript](https://www.typescriptlang.org/), [ESLint](https://eslint.org/), and more.\n\n**Speedy:** With a fast network, `cotton install` runs faster than `rm -rf node_modules`.\n\n**Trouble free:** Ever run into errors when you forget to run `yarn`? No more. With Cotton, `node_modules` would never get out of sync.\n\n**Quickstart** for [Netlify](#using-netlify) • [Cloudflare Pages](#using-cloudflare-pages)\n\n## Benchmarks\n\n### [Bun's benchmark](https://github.com/oven-sh/bun/tree/main/bench/install)\n\n| Tool         | With lockfile and cache |\n| ------------ | ----------------------- |\n| Cotton       | **0.270s**              |\n| Bun 1.2      | 0.536s                  |\n| pnpm 9.15.4  | 2.015s                  |\n| Yarn 1.22.22 | 2.633s                  |\n| npm 10.8.2   | 4.031s                  |\n\n### Installing packages used by [create-react-app](https://create-react-app.dev/):\n\n| Tool   | Initial install | With lockfile only | With lockfile and cache |\n| ------ | --------------- | ------------------ | ----------------------- |\n| Cotton | **4.0s**        | **1.8s**           | **0.3s**                |\n| pnpm   | 24.3s           | 17.9s              | 5.5s                    |\n| Yarn   | 31.9s           | 27.0s              | 10.6s                   |\n| npm    | 35.4s           | 21.3s              | 13.0s                   |\n\nSee [benchmark](benchmark.md) for more information.\n\n## Installation\n\n### Install from source\n\n```\ncargo install --locked --git https://github.com/danielhuang/cotton\n```\n\n### Install compiled artifact (Linux-only)\n\nDownload and install the compiled binary:\n\n```\nsudo curl -f#SL --compressed --tlsv1.2 https://api.cirrus-ci.com/v1/artifact/github/danielhuang/cotton/Build/binaries/target/x86_64-unknown-linux-gnu/release/cotton -o /usr/local/bin/cotton\nsudo chmod +x /usr/local/bin/cotton\n```\n\n## Get started\n\n### Install packages\n\n```\ncotton install\n```\n\nThis will install packages to `node_modules` and save `cotton.lock` if needed.\n\n### Run a script\n\nTo run the `start` script:\n\n```\ncotton run start\n```\n\nTo automatically restart the script when `package.json` changes:\n\n```\ncotton run start --watch package.json\n```\n\nUnlike other package managers, Cotton does not require installing packages before running scripts. Missing packages will be installed on-demand automatically.\n\n### Update package versions\n\n```\ncotton update\n```\n\nThis will load the latest available versions of dependencies (including transitive dependencies) and save registry information to `cotton.lock`. Specified versions in `package.json` are not modified.\n\n### Allow install scripts\n\nIf dependencies require install scripts (such as `puppeteer` or `electron`) to function, add this to `cotton.toml`:\n\n```toml\nallow_install_scripts = true\n```\n\n## Using as part of CI/CD?\n\nIn order to use Cotton, you have 2 options:\n\n- Commit the binary to the repository, working similarly to committing Yarn 2+ (recommended)\n- Download Cotton on-demand as part of the build process\n\nIf the binary is committed to the repository, use `./cotton` instead of `cotton`.\n\n### Using Netlify\n\nFirst, modify the configuration in `netlify.toml`, and add these lines:\n\n```toml\n[build.environment]\n  NPM_FLAGS=\"--version\"\n```\n\nMake sure `yarn.lock` is not present.\n\nAdd a command to remove `node_modules` from the build directory after the build finishes. Since Netlify stores its cache using tar, caching and extracting `node_modules` would be slower than reinstalling using Cotton.\n\nFor example, if the build command was\n\n```sh\ncotton run build\n```\n\nAdd another command to the end:\n\n```sh\ncotton run build \u0026\u0026 mv node_modules _node_modules\n```\n\nThis would disable Netlify's cache.\n\n### Using Cloudflare Pages\n\nSet the environment variable `NPM_FLAGS` to `--version`. Make sure that there is no `yarn.lock` in the repository.\n\n## Limitations\n\n- Cotton does not currently support Git repositories or local paths as dependencies; only registries and direct urls are supported.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielhuang%2Fcotton","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanielhuang%2Fcotton","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanielhuang%2Fcotton/lists"}