Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxnelson997 committed Mar 2, 2018
0 parents commit fe85bc2
Show file tree
Hide file tree
Showing 21 changed files with 497 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"presets": [
"env",
"react"
],
"plugins": [
"babel-plugin-transform-class-properties",
"babel-plugin-transform-object-rest-spread"
]
}
8 changes: 8 additions & 0 deletions .gitignore.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# nodejs
node_modules/
npm-debug.log
yarn-error.log

# project
dist/
env.js
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2016 Micooz

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
1 change: 1 addition & 0 deletions Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: node server.js
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# React with Bootstrap Starter Project

> Provided for the students of the [Bottega Code School](https://bottega.tech/)
*Fork from [es6-webpack2-starter](https://github.com/micooz/es6-webpack2-starter)*
6 changes: 6 additions & 0 deletions env.example.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
devServer: {
host: 'localhost',
port: 3000
}
};
6 changes: 6 additions & 0 deletions env.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
devServer: {
host: 'localhost',
port: 3000
}
};
70 changes: 70 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{
"name": "react-bootstrap",
"version": "1.0.0",
"description": "Basic skeleton codebase for React with Bootstrap applications.",
"scripts": {
"postinstall": "cp env.example.js env.js",
"start": "webpack-dev-server --config webpack/dev.config.js --watch",
"build": "cross-env NODE_ENV=production webpack --config webpack/prod.config.js --progress --display-error-details --color",
"heroku-postbuild": "npm run build",
"precommit": "eslint src",
"prod": "NODE_ENV=production node server.js"
},
"repository": {
"type": "git",
"url": "git@github.com:bottega-code-school/js-builder.git"
},
"keywords": [
"es6",
"es7",
"webpack2",
"webpack3",
"starter",
"template",
"postcss",
"sass",
"css module"
],
"author": "Your Name Here",
"license": "MIT",
"bugs": {
"url": "https://github.com/bottega-code-school/js-builder/issues"
},
"homepage": "https://github.com/bottega-code-school/js-builder",
"devDependencies": {
"webpack-dev-server": "^2.5.1"
},
"dependencies": {
"autoprefixer": "^7.1.2",
"babel-core": "^6.25.0",
"babel-eslint": "^7.2.3",
"babel-loader": "^7.1.1",
"babel-plugin-transform-class-properties": "^6.24.1",
"babel-plugin-transform-object-rest-spread": "^6.23.0",
"babel-polyfill": "^6.23.0",
"babel-preset-env": "^1.6.0",
"babel-preset-react": "^6.1.18",
"bootstrap": "^4.0.0-alpha.5",
"clean-webpack-plugin": "^0.1.16",
"copy-webpack-plugin": "^4.0.1",
"cross-env": "^5.0.1",
"css-loader": "^0.28.4",
"eslint": "^4.2.0",
"eslint-loader": "^1.9.0",
"eslint-plugin-react": "^7.1.0",
"express": "^4.16.2",
"extract-text-webpack-plugin": "^2.1.2",
"file-loader": "^0.11.2",
"html-webpack-plugin": "^2.29.0",
"node-sass": "^4.5.3",
"postcss-loader": "^2.0.6",
"react": "^16.2.0",
"react-dom": "^16.0.0",
"reactstrap": "^5.0.0-alpha.4",
"sass-loader": "^6.0.6",
"style-loader": "^0.18.2",
"url-loader": "^0.5.9",
"webpack": "^3.1.0",
"webpack-merge": "^4.1.0"
}
}
24 changes: 24 additions & 0 deletions proxy/rules.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module.exports = {
'/node-0': {
target: 'https://api.github.com',
secure: true,
headers: {
'Host': 'api.github.com',
'Cookie': '' // send cookie on demand
},
pathRewrite: function (path) {
return path.replace(/^\/node-0/, ''); // remove '/node-0' prefix when requesting
}
},
'/node-1': {
target: 'https://registry.npmjs.org',
secure: true,
headers: {
'Host': 'registry.npmjs.org',
'Cookie': '' // send cookie on demand
},
pathRewrite: function (path) {
return path.replace(/^\/node-1/, ''); // remove '/node-1' prefix when requesting
}
}
};
8 changes: 8 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const express = require('express');
const port = process.env.PORT || 8080;
const app = express();

app.use(express.static(__dirname + '/dist/'));
app.listen(port);

console.log("server started");
15 changes: 15 additions & 0 deletions src/bootstrap.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from 'react';
import ReactDOM from 'react-dom';

import App from './components/app';

import 'bootstrap/dist/css/bootstrap.css';
import './style/main.scss';

function main() {
ReactDOM.render(
<App />
, document.querySelector('.app-wrapper'));
}

document.addEventListener('DOMContentLoaded', main);
11 changes: 11 additions & 0 deletions src/components/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React, { Component } from 'react';

export default class App extends Component {
render() {
return (
<div>
<h1>DevCamp React Starter</h1>
</div>
);
}
}
Empty file added src/style/main.scss
Empty file.
7 changes: 7 additions & 0 deletions src/vendor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/* eslint-disable global-require */

// polyfills and vendors

if (!window._babelPolyfill) {
require('babel-polyfill');
}
4 changes: 4 additions & 0 deletions static/assets/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
### put your assets here

1. images
2. other standalone libraries(no npm support)
Empty file added static/favicon.ico
Empty file.
15 changes: 15 additions & 0 deletions static/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet">
<title>DevCamp React Starter</title>
</head>

<body>
<div class="app-wrapper"></div>
</body>

</html>
57 changes: 57 additions & 0 deletions webpack/common.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// webpack plugins
const CommonsChunkPlugin = require('webpack/lib/optimize/CommonsChunkPlugin');

module.exports = {

entry: {
'app': [
'./src/bootstrap.js'
],
'vendor': './src/vendor.js'
},

resolve: {

extensions: ['.js', '.scss'],

modules: ['node_modules']

},

module: {

rules: [

{
test: /\.js$/,
exclude: /node_modules/,
use: ['babel-loader']
},

{
test: /\.json$/,
loader: 'json'
},

{
test: /\.(jpg|png|gif|eot|svg|ttf|woff|woff2)$/,
loader: 'file',
},

{
test: /\.(mp4|webm)$/,
loader: 'url?limit=10000'
}

]

},

plugins: [
new CommonsChunkPlugin({
name: ['app', 'vendor'],
minChunks: Infinity
})
]

};
94 changes: 94 additions & 0 deletions webpack/dev.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
const path = require('path');
const webpackMerge = require('webpack-merge');
const webpackCommon = require('./common.config');

const env = require('../env');
const proxyRules = require('../proxy/rules');

// webpack plugins
const HtmlWebpackPlugin = require('html-webpack-plugin');
const DefinePlugin = require('webpack/lib/DefinePlugin');
const HotModuleReplacementPlugin = require('webpack/lib/HotModuleReplacementPlugin');

module.exports = webpackMerge(webpackCommon, {

devtool: 'inline-source-map',

output: {

path: path.resolve(__dirname, '../static/dist'),

filename: '[name].js',

sourceMapFilename: '[name].map',

chunkFilename: '[id]-chunk.js',

publicPath: '/'

},

module: {

rules: [
{
test: /\.s?css$/,
use: [
{
loader: 'style-loader'
},
{
loader: 'css-loader',
options: {
importLoaders: 2
}
},
{
loader: 'sass-loader',
options: {
outputStyle: 'expanded',
sourceMap: true,
sourceMapContents: true
}
}
]
}
]

},

plugins: [
new DefinePlugin({
'process.env': {
NODE_ENV: "'development'"
}
}),
new HtmlWebpackPlugin({
inject: true,
template: path.resolve(__dirname, '../static/index.html'),
favicon: path.resolve(__dirname, '../static/favicon.ico')
}),
new HotModuleReplacementPlugin()
],

devServer: {
host: env.devServer.host || 'localhost',
port: env.devServer.port || 3000,
contentBase: path.resolve(__dirname, '../static'),
watchContentBase: true,
compress: true,
hot: true,
historyApiFallback: {
disableDotRule: true
},
watchOptions: {
ignored: /node_modules/
},
overlay: {
warnings: true,
errors: true
},
proxy: proxyRules
}

});
5 changes: 5 additions & 0 deletions webpack/postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
plugins: {
'autoprefixer': {},
}
};

0 comments on commit fe85bc2

Please sign in to comment.