Skip to content

Commit

Permalink
Use yarn to install dependencies if yarn.lock is available (#32)
Browse files Browse the repository at this point in the history
* Add check for yarn.lock and use yarn to install if available

* Add check for yarn executable

* Bump version

* Fix init script, add postinstall

* Fix shellcheck issues

* Tweak postinstall script

* Tweak postinstall script

* Remove postinstall
  • Loading branch information
bostrom authored Apr 18, 2017
1 parent 454bcdf commit b328c16
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
16 changes: 14 additions & 2 deletions bin/motley-eslint-init.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
PKG=eslint-config-airbnb;
npm info "$PKG@latest" peerDependencies --json | command sed 's/[\{\},]//g ; s/: /@/g' | xargs npm install --save-dev "$PKG@latest"
#!/bin/bash

PKG=eslint-config-airbnb

# Default to installing using npm
INSTALL="npm install --save-dev"

# Is this a yarn project and yarn is found in PATH, then install using yarn
if [[ -f $(PWD)/yarn.lock && -x $(which yarn) ]]
then
INSTALL="yarn add --dev"
fi

npm info "$PKG@latest" peerDependencies --json | command sed 's/[\{\},]//g ; s/: /@/g' | xargs $INSTALL "$PKG@latest"
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-config-motley",
"version": "6.0.1",
"version": "6.1.0",
"description": "Motley Agency's ESLint configuration",
"main": ".eslintrc.js",
"scripts": {
Expand Down

0 comments on commit b328c16

Please sign in to comment.