{"name":"yarn-or-npm","version":"2.0.2","description":"Use Yarn or npm to execute a command","files":["index.js","bin/"],"bin":{"yarn-or-npm":"bin/index.js","yon":"bin/index.js"},"main":"index.js","repository":{"url":"git+ssh://git@github.com/camacho/yarn-or-npm.git","type":"git"},"author":{"name":"Patrick Camacho","email":"patrick@daftdevelopers.com"},"license":"MIT","dependencies":{"cross-spawn":"^5.0.0"},"gitHead":"5cef42efc6a04ab0186aa55e5197a552e652d931","bugs":{"url":"https://github.com/camacho/yarn-or-npm/issues"},"homepage":"https://github.com/camacho/yarn-or-npm#readme","_id":"yarn-or-npm@2.0.2","scripts":{},"_shasum":"76420caf665f0d981701493fb1c5f0e68d78daa5","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.3.0","_npmUser":{"name":"camachgk","email":"patrick@daftdevelopers.com"},"dist":{"shasum":"76420caf665f0d981701493fb1c5f0e68d78daa5","tarball":"http://registry-npm.ywwl.com/yarn-or-npm/download/yarn-or-npm-2.0.2.tgz","integrity":"sha512-1kUHiYUgTkTGI4dKPn4bN0JwMPwTCQNS5E/6OL7dHPCEqPngY68fIywICPkIhgMEbPYMOz1NX72CzZ+nf8nEGA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBhUt00YZgVxbF7SPVFTJB9k3+tPk7mFE5uVtkxwwdUbAiBkLrvGUd9mm/6HPzDiizI9nhudnXwyQ2vahVjs3GLrKA=="}],"size":2038,"noattachment":false,"key":"/yarn-or-npm/-/yarn-or-npm-2.0.2.tgz"},"maintainers":[{"name":"camachgk","email":"patrick@daftdevelopers.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/yarn-or-npm-2.0.2.tgz_1478107089578_0.7764189848676324"},"directories":{},"readme":"# yarn-or-npm\n\nExecute scripts with Yarn or npm.\n\n```sh\nyarn add -D yarn-or-npm\n# or\nnpm i --save-dev yarn-or-npm\n```\n\nThe client is determined by a series of ordered checks:\n\n1. `yarn.lock` file is in the nearest package directory - **yarn**\n1. `package-lock.json` file is in the nearest package directory - **npm**\n1. `yarn` is installed - **yarn**\n1. Fallback - **npm**\n\n## Module\n\n```js\nimport yarnOrNpm, { spawn, hasYarn, hasNpm } from 'yarn-or-npm';\n\n// String of `yarn` or `npm` returned\nconsole.log(yarnOrNpm());\n\n// Boolean values for hasYarn, hasNpm\nconsole.log(hasYarn());\n\n// Spawn yarn or npm command\nspawn(['init']);\n\n// Spawn sync option\nspawn.sync(['init'], { stdio: 'inherit' });\n```\n\nUnder the covers, there are cached lookup values being used for efficiency. These can be manually cleared:\n\n```js\nimport yarnOrNpm from 'yarn-or-npm';\nimport { spawnSync } from 'child_process';\n\nconsole.log(yarnOrNpm.hasYarn()); // false\n\nspawnSync('npm', ['i', '-g', 'yarn'], { stdio: 'inherit' });\n\nconsole.log(yarnOrNpm.hasYarn()); // false (cached)\n\nyarnOrNpm.clearCache();\nconsole.log(yarnOrNpm.hasYarn()); // true\n```\n\n## CLI\n\n```sh\nyarn-or-npm <command>\n# Can also use `yon` shorthand\nyon <command>\n```\n\n## Package\n\nModules with bin files can be called directly in `package.json` scripts:\n\n```json\n{\n  \"devDependencies\": {\n    ...\n    \"yarn-or-npm\": \"^1.0.0\"\n  },\n  \"scripts\": {\n    \"compile\": \"babel src --out-dir dist\",\n    \"lint\": \"eslint .\",\n    \"prepublish\": \"yarn-or-npm run lint && yarn-or-npm run compile\"\n  }\n}\n```\n","publish_time":1478107091529,"_cnpm_publish_time":1478107091529,"dist-tags":{"latest":"3.0.1"}}