Skip to content

Instantly share code, notes, and snippets.

@brito
Last active October 28, 2017 09:11
Show Gist options
  • Save brito/c109bc289319970b1750677a718822f4 to your computer and use it in GitHub Desktop.
Save brito/c109bc289319970b1750677a718822f4 to your computer and use it in GitHub Desktop.
#!/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'
@brito
Copy link
Author

brito commented Oct 27, 2017

• See also .npm-init.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment