Created
May 11, 2023 09:10
-
-
Save johnnieskywalker/7bcd85e99519475668ae843058abf7d1 to your computer and use it in GitHub Desktop.
Flatten all files from contracts folder and save to flattened directory
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
#!/bin/bash | |
CONTRACTS_DIR="./contracts" | |
FLATTENED_DIR="./flattened" | |
mkdir -p "$FLATTENED_DIR" | |
for FILE in "${CONTRACTS_DIR}"/*.sol; do | |
if [[ -f "$FILE" ]] && [[ -r "$FILE" ]]; then | |
FILE_NAME="$(basename "${FILE%.sol}")" | |
npx hardhat flatten "${FILE}" > "${FLATTENED_DIR}/${FILE_NAME}_flattened.sol" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment