Skip to content

Instantly share code, notes, and snippets.

@kkismd
Forked from anonymous/minprj-react-flow
Created May 30, 2016 11:25
Show Gist options
  • Save kkismd/774abf9532286fd9f9d010e7cf4fe4c5 to your computer and use it in GitHub Desktop.
Save kkismd/774abf9532286fd9f9d010e7cf4fe4c5 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