Skip to content

Commit

Permalink
Initial and final commit for this boilerplate
Browse files Browse the repository at this point in the history
  • Loading branch information
João Guilherme committed Mar 17, 2018
1 parent 88afc8b commit f0e575b
Show file tree
Hide file tree
Showing 52 changed files with 9,297 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"presets": [
["@babel/env", {
"targets": {
"browsers": ["last 2 versions", "safari 7"]
},
"modules": false,
"loose": true
}],
"@babel/react"
],
"plugins": ["@babel/plugin-proposal-object-rest-spread"]
}
14 changes: 14 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# http://editorconfig.org

root = true

[*]
end_of_line = lf
insert_final_newline = true

[*.{js,jsx,ts,html,styl}]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
31 changes: 31 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"root": true,
"plugins": [
"import",
"react"
],
"extends": ["airbnb-base"],
"parserOptions": {
"ecmaFeatures": {
"jsx": true,
"modules": true
}
},
"rules": {
"class-methods-use-this": ["off"],
"complexity": ["error", 10],
"func-names": ["error", "never"],
"no-underscore-dangle": ["off"],
"no-unexpected-multiline": "error",
"no-unused-expressions": ["warn"],
"no-unused-vars": ["error", { "argsIgnorePattern" : "_" }],
"no-tabs": ["off"],
"object-shorthand": ["off"],
"no-mixed-spaces-and-tabs": ["off"],
"semi": ["error", "never"],
"space-before-function-paren": ["error", "always"],
"spaced-comment": ["off"],
"react/jsx-uses-react": "error",
"react/jsx-uses-vars": "error"
}
}
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Local things
/app/
/.yarnclean

# External
node_modules/
coverage/
tests/e2e/reports/
tests/e2e/screenshots/
.env
.DS_Store
*.log
yarn-error.log
yarn-debug.log
npm-debug.log*
npm-debug.log*
.chromedriver.log
*.tgz
*.zip
40 changes: 40 additions & 0 deletions .stylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"blocks": false,
"brackets": "always",
"colons": "always",
"colors": "always",
"commaSpace": "always",
"commentSpace": "always",
"cssLiteral": "never",
"customProperties": [],
"depthLimit": false,
"duplicates": false,
"efficient": false,
"exclude": [],
"extendPref": "@extends",
"globalDupe": false,
"groupOutputByFile": true,
"indentPref": 2,
"leadingZero": "never",
"maxErrors": 0,
"maxWarnings": 0,
"mixed": false,
"mixins": [],
"namingConvention": "BEM",
"namingConventionStrict": true,
"none": "never",
"noImportant": true,
"parenSpace": "never",
"placeholders": "always",
"prefixVarsWithDollar": "always",
"quotePref": "single",
"reporter": "stylint-stylish",
"semicolons": "always",
"sortOrder": "alphabetical",
"stackedProperties": "never",
"trailingWhitespace": "never",
"universal": "never",
"valid": true,
"zeroUnits": "never",
"zIndexNormalize": false
}
59 changes: 59 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
PKG:=yarn
DEPLOY:=build:prod
GOURCE:=gource

help:
@echo
@echo "✍🏽 Please use 'make <target>' where <target> is one of the commands below:"
@echo
@fgrep -h "##" $(MAKEFILE_LIST) | fgrep -v fgrep | sed -e "s/\\$$//" | sed -e "s/##//"
@echo

# ------------------------------------------------------------------------------------ #

build: ## build locally the files
$(PKG) build

build-prod: ## build on a prod-version
$(PKG) $(DEPLOY)

change-version: ## change the project version
$(PKG) version

clean: ## make it clean, pls sir
$(PKG) clean-files

deploy: build-prod

install: ## install missing dependencies
$(PKG)

i: install

pack: ## pack project in case of develirable
$(PKG) pack

server: ## runs locally on a 3000 port pre-defined on package.json
$(PKG) server

run: server
serve: run

start: clean build run

test: ## tests e2e tests
$(PKG) test

test-unit: ## runs unit tests
$(PKG) test:unit

test-unit-watch: ## watches for unit tests modification
$(PKG) test:unit-watch

tests: test test-unit

watch: ## watch what's important to
$(PKG) watch

gource:
@echo "No '$(GOURCE)' task was settled up 😞"
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: make serve
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# create-an-awesome-spa
👀 No server-side rendering, only a basic spa in react+redux built with <3

## How to install
Please, `make i` or `make install`

## How to contribute
- Run the command `make watch` for watching updates or `make build` to get project assets compiled.
- Commit your changes, then create your pull request

## How to run
Just `make run` and we're ready to rock! Access your http://localhost:3000/


## Todo
- [ ] Improve README.md
- [ ] Create your project board on [GitHub projects](https://help.github.com/articles/about-project-boards/)
- [ ] Preview your page and paste wireframes that represents your changes
21 changes: 21 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "create-an-awesome-spa",
"description": "👀 No server-side rendering, only a basic spa in react+redux built with <3",
"repository": "https://github.com/guicheffer/create-an-awesome-spa",
"logo": "",
"keywords": [
"react",
"redux",
"reactredux",
"html5",
"css3",
"jest",
"webpack",
"stylus",
"es6",
"nightwatch",
"spa",
"crud",
"localstorage"
]
}
122 changes: 122 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
{
"private": true,
"license": "UNLICENSED",
"name": "create-an-awesome-spa",
"description": "👀 No server-side rendering, only a basic spa in react+redux built with <3",
"version": "0.1.0",
"author": "João Guilherme <[email protected]>",
"homepage": "https://github.com/guicheffer/create-an-awesome-spa",
"config": {
"title": "A simple and basic spa",
"description": "👀 No server-side rendering, only a basic spa in react+redux built with <3",
"port": "3000",
"path": {
"dist": "app/",
"jest": "tests/unit/jest.config.js",
"liveUrl": "https://create-an-awesome-spa.herokuapp.com/static/",
"main": "index.html",
"nightwatch": "tests/e2e/nightwatch.conf.js",
"run": "run.js",
"shortcut32x32": "setup/favicon.ico",
"src": "src/app/",
"static": "static/",
"stylintrc": ".stylintrc",
"unitTests": [
"./tests/unit/specs/"
]
}
},
"scripts": {
"preinstall": "echo \"⚠️ Make sure node ~8.6.0 and yarn ~1.1.0 are being used!\"",
"clean-files": "rm -rf $npm_package_config_path_dist",
"chromedriver": "chromedriver --url-base=/wd/hub --verbose --log-path=chromedriver.log",
"test": "nightwatch --config $npm_package_config_path_nightwatch",
"test:unit": "jest --config $npm_package_config_path_jest --no-cache --notify --coverage",
"test:unit-watch": "jest --config $npm_package_config_path_jest --watch",
"start": "make start",
"server": "node $npm_package_config_path_run",
"heroku:before-deploy": "make tests",
"heroku-postbuild": "make deploy",
"prebuild": "make clean",
"build": "webpack --progress --env.dev",
"build:prod": "webpack --progress --env.prod",
"watch": "webpack --watch --env.dev"
},
"engines": {
"node": "~8.10.0",
"yarn": "~1.1.0"
},
"dependencies": {
"@babel/core": "^7.0.0-beta.40",
"@babel/plugin-proposal-object-rest-spread": "^7.0.0-beta.40",
"@babel/preset-env": "^7.0.0-beta.40",
"@babel/preset-react": "^7.0.0-beta.40",
"autoprefixer": "^8.1.0",
"axios": "^0.18.0",
"babel-loader": "^8.0.0-beta",
"copy-webpack-plugin": "^4.0.1",
"css-tree": "^1.0.0-alpha.28",
"cssnano": "^3.10.0",
"diacritics": "^1.3.0",
"es2015": "^0.0.0",
"eslint": "^4.2.0",
"eslint-config-airbnb-base": "^12.0.2",
"eslint-loader": "^2.0.0",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-react": "^7.7.0",
"express": "~4.16.2",
"extract-text-webpack-plugin": "^3.0.1",
"glob": "^7.1.2",
"history": "^4.7.2",
"html-loader": "^0.5.5",
"html-minifier": "^3.5.2",
"html-webpack-plugin": "^3.0.4",
"loader-utils": "~1.1.0",
"lodash": "^4.17.4",
"node-sass": "^4.5.3",
"node-static": "^0.7.10",
"path": "^0.12.7",
"postcss-loader": "^2.0.6",
"raw-loader": "^0.5.1",
"react": "^16.2.0",
"react-dom": "^16.0.0",
"react-redux": "^5.0.7",
"react-router": "^4.2.0",
"react-router-dom": "^4.2.2",
"react-router-redux": "^5.0.0-alpha.9",
"redux": "^3.7.2",
"redux-thunk": "^2.2.0",
"stylint": "^1.5.9",
"stylint-loader": "^1.0.0",
"stylint-stylish": "^1.4.0",
"stylus": "^0.54.5",
"stylus-loader": "^3.0.1",
"uglifyjs-webpack-plugin": "^1.2.2",
"watch": "^1.0.2",
"webpack": "^3.8.1"
},
"devDependencies": {
"chromedriver": "^2.32.3",
"jest": "^21.2.1",
"nightwatch": "^0.9.16"
},
"keywords": [
"react",
"redux",
"reactredux",
"html5",
"css3",
"jest",
"webpack",
"stylus",
"es6",
"nightwatch",
"spa",
"crud",
"localstorage"
],
"repository": {
"type": "git",
"url": "https://github.com/guicheffer/create-an-awesome-spa"
}
}
13 changes: 13 additions & 0 deletions run.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const { config } = require('./package.json')

const express = require('express')
const path = require('path')
const PORT = process.env.PORT || config.port || 8080

const app = express(),
staticServe = express.static(path.join(__dirname, config.path.dist))

app.use('/', staticServe)
app.use('*', staticServe)

app.listen(PORT, () => console.log(`Listening on ${ PORT }`))
24 changes: 24 additions & 0 deletions src/app/core/entry.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*- ⭐️ Abstract Entry Point
* ----------------------------------------------
*
* Each page has its own entry in a way that bundles can be loaded separately. This abstraction
* offers a simple way to create new bundles/entries by exposing a registry DSL that will be used
* to start each dependency.
*
* React's Application is being extended, so it becomes a starting point. Every
* dependency and set of page components are started here through declarative registers
* such as `stores`, `actions and dispatchers` and their `views`.
*
-*/

class AbstractEntry {
constructor ({ initilizationData }) { this._setup({ initilizationData }) }

_setup ({ initilizationData }) {
this.start({ initilizationData })
}

start () { throw Error('Missing start implementation.') }
}

export default AbstractEntry
9 changes: 9 additions & 0 deletions src/app/core/modules/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { combineReducers } from 'redux'
import { routerReducer } from 'react-router-redux'

import items from '../../main/modules/items'

export default combineReducers({
items,
routing: routerReducer,
})
Loading

0 comments on commit f0e575b

Please sign in to comment.