Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/glenngr/yarn-or-die
Force using yarn instead of npm
https://github.com/glenngr/yarn-or-die
force npm npm-scripts utility yarn
Last synced: about 21 hours ago
JSON representation
Force using yarn instead of npm
- Host: GitHub
- URL: https://github.com/glenngr/yarn-or-die
- Owner: glenngr
- License: mit
- Created: 2017-10-14T13:08:31.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-10-30T20:18:12.000Z (over 7 years ago)
- Last Synced: 2024-04-25T00:01:52.447Z (10 months ago)
- Topics: force, npm, npm-scripts, utility, yarn
- Language: JavaScript
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# yarn-or-die
Force using yarn instead of npm in package.json scripts.
## Installing
Install as a dev dependency.
```sh
npm install --save-dev yarn-or-die
```Or using yarn
```sh
yarn add -D yarn-or-die
```## Using
In package.json, add a pre-script that ensures yarn is being used. Example:
```json
"scripts": {
"pretest": "yarn-or-die",
"test": "echo hello"
}
```If you want to ensure yarn is being used to install packages, you can do like this:
```json
"scripts": {
"preinstall": "yarn-or-die"
}
```If you now issue the command `npm install`, an exception will be thrown and install will not run. If you run `yarn` or `yarn install`, the installation will continue. This can be useful if you depend on all developers in your team using the `yarn.lock` file.
Use `yarn --ignore-scripts` or `npm install --ignore-scripts` if you run into trouble the first time you run `yarn`, `yarn install` or `npm install` because `yarn-or-die` is not installed