generated from ministryofjustice/hmpps-template-typescript
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add rename script * PR reviews * Removing unused vars
- Loading branch information
1 parent
ac0dfa6
commit c8a5587
Showing
10 changed files
with
62 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"name": "hmpps-template-typescript", | ||
"version": "0.0.1", | ||
"description": "HMPPS Template Typescript", | ||
"description": "HMPPS Typescript Template", | ||
"repository": "[email protected]:ministryofjustice/hmpps-template-typescript.git", | ||
"license": "MIT", | ||
"scripts": { | ||
|
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,46 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
if ! echo "$BASH_VERSION" | grep -E "^[45]" &>/dev/null; then | ||
echo "Found bash version: $BASH_VERSION" | ||
echo "Ensure you are using bash version 4 or 5" | ||
exit 1 | ||
fi | ||
|
||
if [[ $# -ge 1 ]]; then | ||
PROJECT_INPUT=$1 | ||
else | ||
read -rp "New project name e.g. prison-visits >" PROJECT_INPUT | ||
fi | ||
|
||
PROJECT_NAME_LOWER=${PROJECT_INPUT,,} # lowercase | ||
PROJECT_NAME_HYPHENS=${PROJECT_NAME_LOWER// /-} # spaces to hyphens | ||
|
||
PROJECT_NAME=${PROJECT_NAME_HYPHENS//[^a-z0-9-]/} # remove all other characters | ||
|
||
read -ra PROJECT_NAME_ARRAY <<<"${PROJECT_NAME//-/ }" # convert to array | ||
PROJECT_DESCRIPTION=${PROJECT_NAME_ARRAY[*]^} # convert array back to string thus capitalising first character | ||
|
||
echo "Found: Project of $PROJECT_DESCRIPTION" | ||
echo " Project name of $PROJECT_NAME" | ||
|
||
echo "Performing search and replace" | ||
|
||
# exclude files that get in the way and don't make any difference | ||
EXCLUDES="( -path ./dist -o -path ./node_modules -o -path ./assets -o -path ./.git -o -path ./rename-project.bash -o -path ./README.md )" | ||
# shellcheck disable=SC2086 | ||
find . $EXCLUDES -prune -o -type f -exec /usr/bin/sed -i.bak \ | ||
-e "s/hmpps-template-typescript/$PROJECT_NAME/g" \ | ||
-e "s/HMPPS Typescript Template/$PROJECT_DESCRIPTION/g" {} \; -exec rm '{}.bak' \; | ||
|
||
echo "Performing directory renames" | ||
|
||
# move helm stuff to new name | ||
mv "helm_deploy/hmpps-template-typescript" "helm_deploy/$PROJECT_NAME" | ||
|
||
# lastly remove ourselves | ||
rm rename-project.bash | ||
|
||
echo "Completed." | ||
echo "Please now review changes" |
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