Created
May 8, 2016 04:33
-
-
Save reyhansofian/1ea2f83b3b36c2cc0145ade29475ed8b to your computer and use it in GitHub Desktop.
Create package.json to each component folder
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 | |
for dirs in ~/Projects/hostel/public_html/assets/reservation/components/*; do | |
if [ -d "$dirs" ]; then | |
for dir in $dirs; do | |
for comp in $dir/*; do | |
if [ -d "$comp" ]; then | |
for pol in $comp/*.jsx; do | |
cd $comp && touch package.json | |
str=${pol##*/} | |
rjsx=${str//.jsx} | |
echo "//${rjsx} | |
{ | |
\"name\": \"${rjsx}\", | |
\"main\": \"${str}\" | |
}" > package.json | |
done | |
fi | |
done | |
done | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment