Created
August 16, 2017 21:49
-
-
Save AlbinoDrought/1ca5b85b292dcb53872e7635179f8b50 to your computer and use it in GitHub Desktop.
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/sh | |
# create-index.sh | |
# Creates an ES6-compatible index.js file for all files in a folder. | |
# | |
# Usage: | |
# ./create-index.sh src/ | |
# Recursive Usage: | |
# ls -R src/ | grep : | sed 's/://' | xargs -I@ ./create-index.sh @ | |
# | |
# By default, includes all file extensions (.js, .vue) | |
# To configure, hack it yourself ;) | |
ls -p --sort=extension $1 | grep -v / | grep -v index | sed 's/\.[^.]*$//' | xargs -I@ echo "export { default as @ } from './@';" > $1/index.js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment