Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save reyhansofian/1ea2f83b3b36c2cc0145ade29475ed8b to your computer and use it in GitHub Desktop.
Save reyhansofian/1ea2f83b3b36c2cc0145ade29475ed8b to your computer and use it in GitHub Desktop.
Create package.json to each component folder
!#/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