-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #913 from Accenture/task/912-ensure-mcdev-collabor…
…ators-auto-update-their-dependencies-on-git-pull Task/912 ensure mcdev collaborators auto update their dependencies on git pull
- Loading branch information
Showing
3 changed files
with
49 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,31 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
# ### git commit message template ### | ||
git config commit.template .git/templatemessage | ||
TICKETID=`git rev-parse --abbrev-ref HEAD | LC_ALL=en_US.utf8 grep -oP '((feature|bug|bugfix|fix|hotfix|task|chore)\/)\K\d{1,7}'` | ||
echo "[POST_CHECKOUT] Setting template commit to $TICKETID" | ||
echo "#$TICKETID: " > ".git/templatemessage" | ||
echo "#$TICKETID: " > ".git/templatemessage" | ||
|
||
|
||
# ### run npm install ### | ||
echo "[POST-CHECKOUT] 📦 Checking for changes to dependencies" | ||
# define how to split strings into array elements | ||
IFS=$'\n' | ||
# $1 is the new HEAD pointer | ||
NEWHEAD=$1 | ||
# $2 is the previous HEAD pointer | ||
OLDHEAD=$2 | ||
# extract all paths to package-lock.json files | ||
PACKAGE_LOCK_REGEX="(^package-lock\.json)" | ||
PACKAGES=$(git diff --name-only $NEWHEAD $OLDHEAD | grep -E $PACKAGE_LOCK_REGEX || true) | ||
|
||
if [[ ${PACKAGES[@]} ]]; then | ||
for package in $PACKAGES; do | ||
echo "📦 $package was changed." | ||
done | ||
echo "📦 Running npm install to update your dependencies..." | ||
npm install | ||
else | ||
echo "📦 All packages up-to-date. No need to run npm install." | ||
fi |
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,21 @@ | ||
#!/bin/sh | ||
# ### run npm install ### | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
|
||
echo "[POST-MERGE] 📦 Checking for changes to dependencies" | ||
|
||
IFS=$'\n' | ||
# extract all paths to package-lock.json files | ||
PACKAGE_LOCK_REGEX="(^package-lock\.json)" | ||
PACKAGES=$(git diff --name-only HEAD^1 HEAD | grep -E $PACKAGE_LOCK_REGEX || true) | ||
|
||
if [[ ${PACKAGES[@]} ]]; then | ||
for package in $PACKAGES; do | ||
echo "📦 $package was changed." | ||
done | ||
echo "📦 Running npm install to update your dependencies..." | ||
npm install | ||
else | ||
echo "📦 All packages up-to-date. No need to run npm install." | ||
fi |
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
npm run docs | ||
git update-index --add docs/dist/documentation.md | ||
npx --no lint-staged |