Run yarn as pre-commit hook if package.json was changed (#225)
This commit is contained in:
parent
03de20f043
commit
b3bfd40195
@ -121,6 +121,10 @@
|
||||
"test/*.js": [
|
||||
"prettier --trailing-comma all --write",
|
||||
"git add"
|
||||
],
|
||||
"package.json": [
|
||||
"node ./scripts/yarn-install.js",
|
||||
"git add yarn.lock"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
13
experimental/babel-preset-env/scripts/yarn-install.js
Normal file
13
experimental/babel-preset-env/scripts/yarn-install.js
Normal file
@ -0,0 +1,13 @@
|
||||
"use strict";
|
||||
|
||||
const exec = require("child_process").exec;
|
||||
|
||||
const runIfYarn = fn => {
|
||||
exec("yarn -V", error => {
|
||||
if (error === null) fn();
|
||||
});
|
||||
};
|
||||
runIfYarn(() => {
|
||||
console.log("`package.json` was changed. Running yarn...🐈");
|
||||
exec("yarn");
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user