Repository: arefaslani/next-boilerplate
Branch: master
Commit: 7d9e5fb424e4
Files: 32
Total size: 19.6 KB
Directory structure:
gitextract_m99q8486/
├── .babelrc
├── .eslintignore
├── .eslintrc.json
├── .flowconfig
├── .gitignore
├── .prettierignore
├── .storybook/
│ ├── config.js
│ └── webpack.config.js
├── README.md
├── components/
│ └── NProgress/
│ └── index.js
├── next.config.js
├── package.json
├── pages/
│ ├── _app.js
│ ├── _document.js
│ ├── index.js
│ ├── post.js
│ ├── secret.js
│ └── signin.js
├── postcss.config.js
├── routes.js
├── server/
│ └── index.js
├── services/
│ ├── api/
│ │ └── index.js
│ └── auth/
│ ├── authenticate.js
│ └── sign_in.js
├── static/
│ └── css/
│ └── nprogress.css
├── store/
│ ├── index.js
│ ├── posts/
│ │ ├── actions.js
│ │ ├── reducer.js
│ │ └── sagas.js
│ ├── reducer.js
│ └── sagas.js
└── stories/
└── index.js
================================================
FILE CONTENTS
================================================
================================================
FILE: .babelrc
================================================
{
"presets": [
[
"next/babel",
{
"preset-env": {
"modules": "commonjs"
}
}
]
],
"plugins": [
[
"styled-components",
{
"ssr": true,
"displayName": true,
"preprocess": false
}
],
"transform-flow-strip-types",
[
"module-resolver",
{ "root": ["./"] }
]
]
}
================================================
FILE: .eslintignore
================================================
/.next/**
/node_modules/**
================================================
FILE: .eslintrc.json
================================================
{
"parser": "babel-eslint",
"extends": [
"airbnb",
"prettier",
"plugin:flowtype/recommended"
],
"plugins": [
"flowtype"
],
"settings": {
"import/resolver": {
"babel-module": {}
}
},
"rules": {
"react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }],
"no-unused-vars": ["error", { "args": "none" }],
"import/no-extraneous-dependencies": ["error", { "devDependencies": true }],
"jsx-a11y/anchor-is-valid": ["error", {
"components": ["Link"],
"specialLink": ["route"],
"aspects": ["invalidHref", "preferButton"]
}],
"import/extensions": "off",
"import/no-unresolved": "off"
}
}
================================================
FILE: .flowconfig
================================================
[ignore]
.*/node_modules/config-chain/test/broken.json
.*/node_modules/npmconf/test/fixtures/package.json
[include]
[libs]
[lints]
[options]
module.system.node.resolve_dirname=node_modules
module.system.node.resolve_dirname=.
module.file_ext=.css
module.file_ext=.scss
module.file_ext=.js
module.file_ext=.jsx
module.file_ext=.json
[strict]
================================================
FILE: .gitignore
================================================
# See https://help.github.com/ignore-files/ for more about ignoring files.
# dependencies
/node_modules
# testing
/coverage
# production
/build
/dist
/.next
# misc
.DS_Store
.env
npm-debug.log*
yarn-debug.log*
yarn-error.log*
scss/**/*.css
================================================
FILE: .prettierignore
================================================
.next/**
node_modules/**
================================================
FILE: .storybook/config.js
================================================
import { configure } from "@storybook/react";
function loadStories() {
require("../stories");
}
configure(loadStories, module);
================================================
FILE: .storybook/webpack.config.js
================================================
// you can use this file to add your custom webpack plugins, loaders and anything you like.
// This is just the basic way to add additional webpack configurations.
// For more information refer the docs: https://storybook.js.org/configurations/custom-webpack-config
// IMPORTANT
// When you add this file, we won't add the default configurations which is similar
// to "React Create App". This only has babel loader to load JavaScript.
module.exports = {
plugins: [
// your custom plugins
],
module: {
rules: [
// add your custom rules.
]
}
};
================================================
FILE: README.md
================================================
# NEXT Boilerplate
Lightweight Next boilerplate!
## Background
We had tough times working with Next to make it our beloved framework. We opened issues (https://github.com/zeit/next.js/issues/3131), make pull requests and discuss a lot in the slack channel of NextJs. Unfortunately some of our must have features was not supported at that time. So we started creating a boilerplate that had all the features we wanted on top of Next.
## Features
* **redux** for handling application state
* **redux-saga** for handling async actions and side-effects
* **next-routes** for handling dynamic routes
* **axios** for making HTTP requests
* **dotenv** for using environment variables
* **express** as the server
* **redux-devtools** in development
* **redux-logger** in development for managing actions and state changes they cause
* **universal-cookie-express** as a middleware for easily writing cookies
* **compression** for compressing static assets
* **babel-plugin-module-resolver** for importing modules related to the root directory
* **prettier** and **eslint** configured with **airbnb**'s styleguide for formating code
* **husky** and **lint-staged** for autoformatting code before commit
* **styled-components** allows you to write actual CSS code to style your components.
this boilerplate also includes **flow** and **storybook** that you can easily remove them if you don't like.
For more information please read the [docs](https://arefaslani.github.io/next-boilerplate)
================================================
FILE: components/NProgress/index.js
================================================
import React from "react";
import Head from "next/head";
import NProgress from "nprogress";
import { Router } from "routes";
NProgress.configure({ showSpinner: false });
Router.onRouteChangeStart = url => {
NProgress.start();
};
Router.onRouteChangeComplete = () => NProgress.done();
Router.onRouteChangeError = () => NProgress.done();
export default () => (