Created
April 24, 2020 19:11
-
-
Save mrice32/def97e239f7bfc72f590c98f47b0d145 to your computer and use it in GitHub Desktop.
Flatten script
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
#!/usr/bin/env bash | |
# Must run from protocol/ | |
# Usage: ./flatten.sh ~/SOME_TARGET_DIRECTORY | |
TARGET_DIR=$1 | |
mkdir -p $TARGET_DIR | |
find ./core/contracts/ -name '*.sol' -type f -exec cp {} $TARGET_DIR \; | |
find ./node_modules/\@openzeppelin/contracts/ -name '*.sol' -type f -exec cp {} $TARGET_DIR \; | |
find $TARGET_DIR/ -type f -exec sed -i.bak "s/import \".*\/\([^/]*\.sol\)/import \".\/\1/g" {} \; | |
rm -rf $TARGET_DIR/*.bak |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment