Skip to content

Commit

Permalink
build(package.json): force use yarn (#181)
Browse files Browse the repository at this point in the history
Adds preinstall npm script that will encourage installing dependencies using yarn

closes #36
  • Loading branch information
Victor Singh authored and acatl committed Jan 27, 2018
1 parent 7a95d38 commit ca72293
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"packages/*"
],
"scripts": {
"preinstall": "scripts/preinstall-script.js",
"precommit": "lint-staged",
"commit": "git-cz",
"test": "jest --coverage",
Expand Down Expand Up @@ -51,5 +52,6 @@
"standard",
"jest --bail --findRelatedTests"
]
}
},
"dependencies": {}
}
24 changes: 24 additions & 0 deletions scripts/preinstall-script.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env node

const setup =
'\nhttps://github.com/ViacomInc/data-point/blob/master/CONTRIBUTING.md#setup\n'

if (process.env.npm_execpath.indexOf('yarn') === -1) {
console.error(
'\x1b[41m',
'Error: You must use yarn to install dependencies.\n\n',
'For help setting up this project please vist:',
'\x1b[0m',
'\x1b[36m',
'\n',
setup
)
process.exit(1)
}

console.warn(
'\x1b[36m%s\x1b[0m',
'\nWe recommend using yarn for this project instead of npm.\n' +
'\nTo learn more about why we use yarn visit:\n' +
setup
)

0 comments on commit ca72293

Please sign in to comment.