Last active
March 1, 2021 09:38
-
-
Save leetwinski/66e25897130289a3abbcba21a5e3c5ad to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| #!/bin/bash | |
| if [[ -z "$1" ]]; then | |
| echo 'no service name provided' | |
| exit 0 | |
| fi | |
| NAME="$1" | |
| NAME_CAMEL=$(echo "$1" | sed -r 's/(^|-)([a-z])/\U\2/g') | |
| echo "new name is $NAME [camel cased: $NAME_CAMEL]" | |
| FILESET="$(find . -path ./node_modules -prune -false -o -type f -regex '.*\.\(md\|ts\)') $(find .github/workflows -type f)" | |
| echo $FILESET | |
| sed -i "s/nest-test/$NAME/g" $FILESET | |
| sed -i -r "s/(nest|test)-(service|sns|topic)/$NAME-\2/g" $FILESET | |
| for f in $(find -type f -name 'nest.*stack.*'); do | |
| sed -i -r "s/Nest(.*Stack)/$NAME_CAMEL\1/g" "$f" | |
| sed -i -r "s/nest(_test)?/$NAME/g" "$f" | |
| mv $f $(echo "$f" | sed "s/nest/$NAME/g") | |
| done | |
| sed -i "s/nest/$NAME/g" ./bin/main.ts | |
| sed -i "s/Nest/$NAME_CAMEL/g" ./bin/main.ts | |
| sed -i "s/nest/$NAME/g" ./README.md |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment