Created
January 5, 2017 09:27
-
-
Save shahinism/14e2edef8cd05ee10651ae8e96d8b934 to your computer and use it in GitHub Desktop.
Transform express-generator generated project to ES6 syntax with Standard lint
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 | |
# Description: | |
# After generating project using express-generator, you can use | |
# this script to transform codes to ES6 syntax and standard lint | |
# friendly base. | |
# | |
# Requirements: | |
# You need following packages for this script to work: | |
# - express-generator | |
# - lebab | |
# - standard | |
# All this packages are available through npm so you can install them | |
# using `npm i -g a_module` | |
TARGETS="$(find . -iname '*.js') ./bin/www" | |
OPTIONS="let template arrow" | |
function lebab_transform () { | |
echo "Applying es6 transform '${1}' on '${2}'" | |
lebab --transform ${1} --replace ${2} | |
} | |
for option in $OPTIONS | |
do | |
for file in $TARGETS | |
do | |
lebab_transform $option $file | |
done | |
done | |
echo "Applying standard" | |
standard --fix |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment