-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(init): use postinstall for yarn v2
- Loading branch information
Showing
11 changed files
with
120 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# shellcheck shell=bash | ||
|
||
# shellcheck source=./_functions.sh | ||
. "$(dirname "$0")/_functions.sh" | ||
|
||
title "init" | ||
tempDir="/tmp/husky-yarn-1-test" | ||
|
||
rm -rf $tempDir | ||
|
||
# generated by pretest script | ||
tgz="./husky-*.tgz" | ||
|
||
# Create directory | ||
mkdir -p $tempDir | ||
|
||
# Install | ||
cp $tgz $tempDir/husky.tgz | ||
yarn set version berry | ||
cd $tempDir && yarn init -y && yarn add ./husky.tgz | ||
|
||
init_git | ||
yarn husky init | ||
npm set-script test "echo \"msg from pre-commit hook\" && exit 1" | ||
|
||
# Debug | ||
# cat .husky/* | ||
|
||
# Test package.json scripts | ||
grep '"postinstall": "husky install"' package.json || ok | ||
grep '"prepublishOnly": "pinst --disable"' package.json || ok | ||
grep '"postpublish": "pinst --enable"' package.json || ok | ||
|
||
# Test core.hooksPath | ||
test_hooksPath ".husky" | ||
|
||
# Test pre-commit | ||
git add package.json | ||
git commit -m "should fail" || ok | ||
|
||
# Uninstall | ||
yarn remove husky | ||
git config core.hooksPath || ok |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# shellcheck shell=bash | ||
|
||
# shellcheck source=./_functions.sh | ||
. "$(dirname "$0")/_functions.sh" | ||
|
||
title "init" | ||
tempDir="/tmp/husky-yarn-2-test" | ||
|
||
rm -rf $tempDir | ||
|
||
# generated by pretest script | ||
tgz="./husky-*.tgz" | ||
|
||
# Create directory | ||
mkdir -p $tempDir | ||
|
||
# Install | ||
cp $tgz $tempDir/husky.tgz | ||
yarn set version berry | ||
cd $tempDir && yarn init -y && yarn add ./husky.tgz | ||
|
||
init_git | ||
yarn husky init | ||
npm set-script test "echo \"msg from pre-commit hook\" && exit 1" | ||
|
||
# Test package.json scripts | ||
grep '"postinstall": "husky install"' package.json || ok | ||
grep '"prepublishOnly": "pinst --disable"' package.json || ok | ||
grep '"postpublish": "pinst --enable"' package.json || ok | ||
|
||
# Test core.hooksPath | ||
test_hooksPath ".husky" | ||
|
||
# Test pre-commit | ||
git add package.json | ||
git commit -m "should fail" || ok | ||
|
||
# Uninstall | ||
yarn remove husky | ||
git config core.hooksPath || ok |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters