├── .babelrc ├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── index.html ├── package-lock.json ├── package.json ├── src ├── components │ └── App.js ├── index.js └── styles │ └── style.sass ├── test ├── App.test.js └── enzyme.setup.js ├── webpack.common.js ├── webpack.dev.js └── webpack.prod.js /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["@babel/env", "@babel/react"] 3 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Node 2 | node_modules/ 3 | 4 | # Project 5 | dist/ -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "lts/*" 4 | - "10" 5 | - "8" 6 | before_install: npm -g i greenkeeper-lockfile@1 7 | before_script: greenkeeper-lockfile-update 8 | script: 9 | - npm run build 10 | - npm run test 11 | after_script: greenkeeper-lockfile-upload -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Seth 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | [![Greenkeeper badge](https://badges.greenkeeper.io/itzsaga/react-boilerplate-blog.svg)](https://greenkeeper.io/) 3 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | My React Boilerplate 8 | 9 | 10 |
11 | 12 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "my-react-boilerplate", 3 | "version": "1.1.0", 4 | "description": "", 5 | "main": "index.js", 6 | "directories": { 7 | "test": "test" 8 | }, 9 | "scripts": { 10 | "build": "webpack --config webpack.prod.js", 11 | "start": "webpack-dev-server --config webpack.dev.js", 12 | "test": "jest ./test" 13 | }, 14 | "jest": { 15 | "setupFilesAfterEnv": [ 16 | "./test/enzyme.setup.js" 17 | ] 18 | }, 19 | "author": "", 20 | "license": "ISC", 21 | "devDependencies": { 22 | "@babel/cli": "^7.7.0", 23 | "@babel/core": "^7.7.2", 24 | "@babel/preset-env": "^7.7.1", 25 | "@babel/preset-react": "^7.7.0", 26 | "babel-core": "^7.0.0-bridge.0", 27 | "babel-jest": "^24.9.0", 28 | "babel-loader": "^8.0.6", 29 | "clean-webpack-plugin": "^3.0.0", 30 | "css-loader": "^3.2.0", 31 | "enzyme": "^3.10.0", 32 | "enzyme-adapter-react-16": "^1.15.1", 33 | "html-webpack-plugin": "^4.0.0", 34 | "jest": "^24.9.0", 35 | "node-sass": "^7.0.0", 36 | "react-test-renderer": "^16.11.0", 37 | "sass-loader": "^8.0.0", 38 | "style-loader": "^1.0.0", 39 | "webpack": "^4.41.2", 40 | "webpack-cli": "^3.3.10", 41 | "webpack-dev-server": "^3.9.0", 42 | "webpack-merge": "^4.2.2" 43 | }, 44 | "dependencies": { 45 | "react": "^18.0.0", 46 | "react-dom": "^18.0.0" 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/components/App.js: -------------------------------------------------------------------------------- 1 | import React, { Component } from 'react' 2 | 3 | class App extends Component { 4 | render() { 5 | return ( 6 |
7 |

Welcome to My Starter App

8 |
9 | ) 10 | } 11 | } 12 | 13 | export default App -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import ReactDOM from 'react-dom' 3 | import App from './components/App' 4 | 5 | import './styles/style.sass' 6 | 7 | ReactDOM.render( 8 | , 9 | document.getElementById('app') 10 | ) -------------------------------------------------------------------------------- /src/styles/style.sass: -------------------------------------------------------------------------------- 1 | body 2 | font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif 3 | color: white 4 | background: black -------------------------------------------------------------------------------- /test/App.test.js: -------------------------------------------------------------------------------- 1 | import App from '../src/components/App' 2 | import React from 'react' 3 | import { shallow } from 'enzyme' 4 | 5 | describe('App', () => { 6 | test('should match snapshot', () => { 7 | const wrapper = shallow() 8 | 9 | expect(wrapper.find('h1').text()).toBe('Welcome to My Starter App') 10 | expect(wrapper).toMatchSnapshot 11 | }) 12 | }) -------------------------------------------------------------------------------- /test/enzyme.setup.js: -------------------------------------------------------------------------------- 1 | import Enzyme from 'enzyme' 2 | import Adapter from 'enzyme-adapter-react-16' 3 | 4 | Enzyme.configure({ 5 | adapter: new Adapter() 6 | }) -------------------------------------------------------------------------------- /webpack.common.js: -------------------------------------------------------------------------------- 1 | const { CleanWebpackPlugin } = require('clean-webpack-plugin') 2 | const HtmlWebPackPlugin = require('html-webpack-plugin') 3 | const path = require('path') 4 | 5 | module.exports = { 6 | entry: { 7 | main: './src/index.js' 8 | }, 9 | output: { 10 | filename: '[name].[hash].js', 11 | path: path.resolve('./dist'), 12 | }, 13 | module: { 14 | rules: [ 15 | { 16 | test: /\.js$/, 17 | exclude: ['/node_modules'], 18 | use: [{ loader: 'babel-loader' }], 19 | }, 20 | { 21 | test: /\.s(a|c)ss$/, 22 | use: [{ 23 | loader: 'style-loader' 24 | }, { 25 | loader: 'css-loader' 26 | }, { 27 | loader: 'sass-loader' 28 | }], 29 | } 30 | ] 31 | }, 32 | plugins: [ 33 | new HtmlWebPackPlugin({ 34 | template: 'index.html' 35 | }), 36 | new CleanWebpackPlugin(), 37 | ] 38 | } 39 | -------------------------------------------------------------------------------- /webpack.dev.js: -------------------------------------------------------------------------------- 1 | 2 | const merge = require('webpack-merge'); 3 | const common = require('./webpack.common.js'); 4 | 5 | module.exports = merge(common, { 6 | mode: 'development', 7 | devServer: { 8 | host: 'localhost', 9 | port: 3000, 10 | open: true 11 | } 12 | }) -------------------------------------------------------------------------------- /webpack.prod.js: -------------------------------------------------------------------------------- 1 | const merge = require('webpack-merge'); 2 | const common = require('./webpack.common.js'); 3 | 4 | module.exports = merge(common, { 5 | mode: 'production', 6 | }) --------------------------------------------------------------------------------