Skip to content

Instantly share code, notes, and snippets.

Created May 30, 2016 11:13
Show Gist options
  • Save anonymous/2d35805d4562c86ea250471fae0bac52 to your computer and use it in GitHub Desktop.
Save anonymous/2d35805d4562c86ea250471fae0bac52 to your computer and use it in GitHub Desktop.
#!/usr/bin/env sh
mkdir $1
cd $1
npm init -y
npm install -D babelify watchify babel-preset-es2015 babel-preset-react babel-plugin-syntax-flow babel-plugin-transform-flow-strip-types react react-dom
echo '{"presets": ["es2015", "react"], "plugins": ["transform-flow-strip-types", "syntax-flow"]}' > .babelrc
gibo Node OSX > .gitignore
cat <<EOF > .flowconfig
[ignore]
.*/node_modules/.*
[include]
[libs]
./interfaces
[options]
EOF
mkdir src
touch src/index.js
cat <<EOF > src/index.js
import ReactDOM from "react-dom";
import React from "react";
const el = document.querySelector(".main");
ReactDOM.render(<h1>Hello</h1>, el)
EOF
mkdir interfaces
touch interfaces/externs.js
touch interfaces/globals.js
mkdir public
cat <<EOF > public/index.html
<html>
<head>
<title>app</title>
<meta charset="utf8" >
</head>
<body>
<div class="main"></div>
<script src="bundle.js"></script>
</body>
</html>
EOF
echo "public/bundle.js" >> .gitignore
git init
git add .
git commit -m "Initial commit"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment