Last active
October 28, 2017 09:11
-
-
Save brito/c109bc289319970b1750677a718822f4 to your computer and use it in GitHub Desktop.
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 | |
######################### | |
echo "Name this new tool like a Class, eloquent command or clear imperative verb" | |
read | |
mkdir $REPLY | |
cd $REPLY | |
echo "Created directory $REPLY" | |
######################### | |
cat <<EOF > .gitignore | |
node_modules | |
package-lock.json | |
.env | |
EOF | |
git init | |
######################### | |
# watch + commit | |
brew install fswatch | |
git checkout master | |
git branch -D autosave | |
git branch autosave | |
cat <<-EOF > autosave.sh | |
echo "\$(date) \$0 \$@ \\n" | |
git status | |
jobs | |
pkill fswatch | |
message="\$(date)" | |
jobs | |
# git stash | |
git stash branch autosave | |
# git checkout autosave | |
# git stash apply | |
git commit -am "\$message" | |
git show | |
# git push? | |
git checkout - | |
# git stash pop | |
git rebase autosave | |
fswatch --event-flags --latency 5 --one-per-batch . | xargs -n1 "\$0" & | |
EOF | |
chmod a+x autosave.sh | |
fswatch --event-flags --latency 5 --one-per-batch . | xargs -n1 ./autosave.sh & | |
######################### | |
npm init -y | |
npm install | |
######################### | |
cat <<EOF > .babelrc | |
{ | |
"presets": [ | |
"env", | |
"stage-0" | |
] | |
} | |
EOF | |
######################### | |
cat <<EOF > .env | |
USER=$USER | |
LANG=$LANG | |
EOF | |
######################### | |
cat <<'EOF' > index.js | |
import dotenv from 'dotenv' | |
dotenv.config() | |
console.log(`${process.env.USER}, let’s rock`) | |
EOF | |
######################### | |
git add . | |
git commit -m 'No matter how hard the past, you can always begin again —Buddha' | |
# git log --graph --full-history --all --color --pretty=format:"%x1b[31m%h%x09%x1b[32m%d%x1b[0m%x20%s" | |
# git show | |
######################### | |
echo 'npm run index \n' | |
npm run index | |
echo | |
open index.js | |
######################### | |
echo 'YOUR MOVE' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
• See also .npm-init.js