-
-
Notifications
You must be signed in to change notification settings - Fork 299
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When set, excludes git ignored files from patch creation.
- Loading branch information
Showing
7 changed files
with
685 additions
and
3 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
61 changes: 61 additions & 0 deletions
61
integration-tests/exclude-git-ignored-files/exclude-git-ignored-files.sh
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,61 @@ | ||
# make sure errors stop the script | ||
set -e | ||
|
||
echo "add patch-package" | ||
yarn add $1 | ||
|
||
echo "intitialize a git repo" | ||
git init | ||
|
||
addedFileName=addedFileName.md | ||
addedFile=node_modules/lodash/$addedFileName | ||
addedIgnoredFileName=addedIgnoredFileName.md | ||
addedIgnoredFile=node_modules/lodash/$addedIgnoredFileName | ||
removedFileName=fp/__.js | ||
removedFile=node_modules/lodash/$removedFileName | ||
removedIgnoredFileName=fp.js | ||
removedIgnoredFile=node_modules/lodash/$removedIgnoredFileName | ||
|
||
echo "add not ignored file" | ||
echo "this should be patched" > $addedFile | ||
|
||
echo "add ignored file" | ||
echo "this should be ginored" > $addedIgnoredFile | ||
|
||
echo "remove a not ignored file" | ||
rm $removedFile | ||
|
||
echo "remove an ignored file" | ||
rm $removedIgnoredFile | ||
|
||
echo "config .gitignore" | ||
echo $addedIgnoredFileName > .gitignore | ||
echo $removedIgnoredFileName >> .gitignore | ||
|
||
echo "generate patch file" | ||
npx patch-package lodash --git-ignore | ||
|
||
echo "remove node_modules" | ||
rm -rf node_modules | ||
|
||
echo "resintall and patch node_modules" | ||
yarn | ||
npx patch-package | ||
|
||
echo "check that not ignored file was added" | ||
ls $addedFile | ||
|
||
echo "check that ignored file was not added" | ||
if ls $addedIgnoredFile | ||
then | ||
exit 1 | ||
fi | ||
|
||
echo "check that not ignored file was removed" | ||
if ls $removedFile | ||
then | ||
exit 1 | ||
fi | ||
|
||
echo "check that ignored file was not removed" | ||
ls $removedIgnoredFile |
6 changes: 6 additions & 0 deletions
6
integration-tests/exclude-git-ignored-files/exclude-git-ignored-files.test.ts
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,6 @@ | ||
import { runIntegrationTest } from "../runIntegrationTest" | ||
|
||
runIntegrationTest({ | ||
projectName: "exclude-git-ignored-files", | ||
shouldProduceSnapshots: false, | ||
}) |
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,14 @@ | ||
{ | ||
"name": "exclude-git-ignored-files", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"lodash": "4.17.4" | ||
} | ||
} |
Oops, something went wrong.