erictherobot
11/19/2016 - 1:42 AM

nextjs-installer.sh

nextjs-installer.sh

#!/bin/bash
# ./nextjs-installer <project-name>
# Author: Eric David Smith
# Create a new Next.js Project

echo "Creating Next.js Project: $1 ..."
mkdir $1
cd $1
mkdir pages
mkdir components
mkdir static
echo "Created directories pages, components, static"
cat <<'EOF' > package.json
{
  "name": "",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "scripts": {
    "dev": "next"
  },
  "dependencies": {
    "next": "^1.1.1",
    "react-bootstrap": "^0.30.6"
  }
}
EOF
yarn
yarn add next
echo "import React from 'react'
import { Button } from 'react-bootstrap'
export default () => (
  <div>Welcome to next.js! <Button>Hello Bootstrap</Button></div>
)" > pages/index.js
yarn dev
echo "Completed install!"
open http://localhost:3000