Created
November 19, 2016 01:42
-
-
Save erictherobot/27ac33d06827d2d82be4d23b9389bd7b to your computer and use it in GitHub Desktop.
nextjs-installer.sh
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
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment