{"id":13658862,"url":"https://github.com/simonkberg/nyr","last_synced_at":"2025-04-24T11:32:59.718Z","repository":{"id":70675086,"uuid":"78242750","full_name":"simonkberg/nyr","owner":"simonkberg","description":"A tiny helper that knows if you are running a script via npm or Yarn, to let you chain your commands for either.","archived":true,"fork":false,"pushed_at":"2019-07-22T14:07:31.000Z","size":71,"stargazers_count":12,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-12T04:26:55.029Z","etag":null,"topics":["cli","nodejs","npm","yarn"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/nyr","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/simonkberg.png","metadata":{"files":{"readme":"readme.md","changelog":"CHANGELOG.md","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}},"created_at":"2017-01-06T22:12:46.000Z","updated_at":"2023-03-04T06:01:53.000Z","dependencies_parsed_at":"2023-04-29T19:24:44.681Z","dependency_job_id":null,"html_url":"https://github.com/simonkberg/nyr","commit_stats":{"total_commits":22,"total_committers":3,"mean_commits":7.333333333333333,"dds":0.09090909090909094,"last_synced_commit":"61be8c25128792724e721cd1cc835f6952add7d3"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonkberg%2Fnyr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonkberg%2Fnyr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonkberg%2Fnyr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonkberg%2Fnyr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simonkberg","download_url":"https://codeload.github.com/simonkberg/nyr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250618709,"owners_count":21460140,"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":["cli","nodejs","npm","yarn"],"created_at":"2024-08-02T05:01:03.287Z","updated_at":"2025-04-24T11:32:59.401Z","avatar_url":"https://github.com/simonkberg.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# DEPRECATED\n\nI don't recommend this package and consider its usage a bad practice. Collaborators to your project should all use the same package manager to guarantee reproducible builds. Instead of supporting ambiguous usage of different package manager for collaboration on your project, you should enforce the usage of just one.\n\nReleased versions will continue to work but are unsupported and contain dependencies with known security vulnerabilities. Use at your own risk.\n\n# nyr (npm-yarn-run) [![Travis][build-badge]][build-link] [![npm package][npm-badge]][npm-link]\n\nA tiny helper that knows if you are running a script via [npm] or [Yarn],\nto let you chain your commands for either.\n\nUse as a replacement for `x run` in your package scripts.\n\n```sh\n$ yarn add nyr\n$ npm install --save nyr\n```\n\n## Example\nThe intention is for this to be used as a CLI in your `package.json`:\n```json\n{\n  \"name\": \"example-project\",\n  \"main\": \"index.js\",\n  \"scripts\": {\n    \"lint:eslint\": \"eslint\",\n    \"lint:stylelint\": \"stylelint\",\n    \"lint\": \"nyr lint:eslint \u0026\u0026 nyr lint:stylelint\"\n  }\n}\n```\n\nNow if you run `npm run lint` or `yarn lint`, then `lint:eslint` and\n`lint:stylelint` will be executed with `npm run x` or `yarn run x` depending\non whichever you called the script with.\n\n\u003e **Note:** `run` is implied before all arguments. Yarn is clever and will\ncheck for user-defined script if you run an unrecognized command, but npm\nonly works like that with a handful of pre-defined script names (for good\nreasons, as this avoids conflicts). For compatibility reasons, _all_ commands\nwill be executed with `run` (prepended if not manually provided) for _both_\nnpm and Yarn.\n\n## Node API\nYou can use this package as a node module as well:\n```js\nconst {\n  bin,    // (String)  path to executed binary (yarn or npm)\n  args,   // (Array)   arguments passed to the script (with \"run\" first)\n  cwd,    // (String)  where the script was executed from\n  isYarn, // (Boolean) if it was executed with Yarn\n  isNPM,  // (Boolean) if it was executed with npm\n} = require('nyr')\n```\nThis would probably only be useful if it's a script you intend to call from\nyour scripts in `package.json`, as calling it directly with `node` wouldn't\nprovide much useful information (and `args` would likely be off).\n\n## Why?\nI like Yarn, and I wish everyone would use it. But I also don't want to make\nany assumptions about what tool people are running yet, so I'd like to keep\nmy scripts in `package.json` compatible with both, while still having them\nneat and tidy.\n\nThere's actually already a similar tool (which I've been using) available\ncalled [yarn-or-npm] (`yon`). However, it relies on checking if Yarn is\navailable on your system, and not which tool you're actually using.\n\nI also needed a tool which correctly pipes all i/o and returns the correct\nexit codes, so tests and CI pass or fail as expected.\n\nIt does however cover more use-cases, so I'd recommend checking it out if\nyou need something more extensive!\n\n## License\n\n[MIT] © 2017 [Simon Kjellberg]\n\n[build-badge]: https://img.shields.io/travis/simonkberg/nyr/master.svg?style=flat-square\n[build-link]: https://travis-ci.org/simonkberg/nyr\n[npm-badge]: https://img.shields.io/npm/v/nyr.svg?style=flat-square\n[npm-link]: https://www.npmjs.org/package/nyr\n[npm]: https://docs.npmjs.com/cli/npm\n[Yarn]: https://yarnpkg.com/\n[yarn-or-npm]: https://www.npmjs.com/package/yarn-or-npm\n[MIT]: ./license\n[Simon Kjellberg]: mailto:simon.kjellberg@gmail.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonkberg%2Fnyr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimonkberg%2Fnyr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonkberg%2Fnyr/lists"}