Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
schiehll committed May 18, 2019
0 parents commit 6cffa95
Show file tree
Hide file tree
Showing 16 changed files with 6,943 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"presets": [
[
"@babel/preset-env",
{
"modules": false
}
],
"@babel/preset-react"
],
"plugins": ["@babel/plugin-proposal-optional-chaining"]
}
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
root = true

[*]
end_of_line = LF
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
max_line_length = 80
19 changes: 19 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"parser": "babel-eslint",
"plugins": ["react"],
"rules": {
"react/jsx-uses-vars": 2,
"react/jsx-uses-react": 2,
"no-unused-vars": [
"error",
{
"vars": "all",
"args": "none",
"ignoreRestSiblings": true
}
],
"no-else-return": "error",
"no-unreachable": "error",
"prefer-const": "error"
}
}
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Coverage directory used by tools like istanbul
coverage

# Dependency directories
node_modules/

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env

# General
.DS_Store

# Build
public
5 changes: 5 additions & 0 deletions .huskyrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"hooks": {
"pre-commit": "lint-staged"
}
}
4 changes: 4 additions & 0 deletions .lintstagedrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"src/**/*.js": ["eslint --fix", "git add"],
"src/**/*.{js,md,json}": ["prettier --write", "git add"]
}
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"singleQuote": true,
"semi": false
}
34 changes: 34 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "kerbs",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"scripts": {
"build": "node -r @babel/register node_modules/.bin/webpack --mode production --config webpack/webpack.config.js",
"dev": "node -r @babel/register node_modules/.bin/webpack-dev-server --hot --config webpack/webpack.dev.js"
},
"devDependencies": {
"@babel/core": "^7.4.4",
"@babel/plugin-proposal-optional-chaining": "^7.2.0",
"@babel/preset-env": "^7.4.4",
"@babel/preset-react": "^7.0.0",
"@babel/register": "^7.4.4",
"@mdx-js/loader": "^1.0.19",
"babel-eslint": "^10.0.1",
"babel-loader": "^8.0.6",
"eslint": "^5.16.0",
"eslint-plugin-react": "^7.13.0",
"html-webpack-plugin": "^3.2.0",
"husky": "^2.3.0",
"lint-staged": "^8.1.7",
"prettier": "^1.17.1",
"webpack": "^4.31.0",
"webpack-cli": "^3.3.2",
"webpack-dev-server": "^3.4.1",
"webpack-merge": "^4.2.1"
},
"dependencies": {
"react": "^16.8.6",
"react-dom": "^16.8.6"
}
}
6 changes: 6 additions & 0 deletions src/Kerbs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import React from 'react'
import Doc from './doc.mdx'

const Kerbs = () => <Doc />

export default Kerbs
3 changes: 3 additions & 0 deletions src/doc.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Overview

Some project overview
12 changes: 12 additions & 0 deletions src/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Kerbs</title>
</head>

<body>
<div id="root"></div>
</body>
</html>
17 changes: 17 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React from 'react'
import ReactDOM from 'react-dom'
import Kerbs from './Kerbs'

const root = document.getElementById('root')

const render = Component => {
ReactDOM.render(<Component />, root)
}

render(Kerbs)

if (module.hot) {
module.hot.accept('./Kerbs', () => {
render(Kerbs)
})
}
3 changes: 3 additions & 0 deletions webpack/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["@babel/preset-env"]
}
46 changes: 46 additions & 0 deletions webpack/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import HtmlWebpackPlugin from 'html-webpack-plugin'
import path from 'path'

const resolve = filePath => path.resolve(__dirname, '../', filePath)

export default {
entry: [resolve('src/index')],

output: {
path: resolve('public'),
publicPath: '/',
filename: 'static/[name].[hash].js',
chunkFilename: 'static/[name].[hash].chunk.js'
},

module: {
rules: [
{
test: /\.js$/,
include: [resolve('src')],
loader: 'babel-loader'
},
{
test: /\.mdx$/,
use: ['babel-loader', '@mdx-js/loader']
}
]
},

resolve: {
modules: ['node_modules', resolve('src')]
},

plugins: [
new HtmlWebpackPlugin({
template: resolve('src/index.html'),
chunksSortMode: 'none'
})
],

stats: {
modules: false,
children: false,
colors: true
}
}
17 changes: 17 additions & 0 deletions webpack/webpack.dev.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import merge from 'webpack-merge'
import config from './webpack.config.js'

export default merge.strategy({ entry: 'prepend' })(config, {
mode: 'development',
devtool: 'source-map',

devServer: {
compress: true,
historyApiFallback: true,
stats: {
modules: false,
children: false,
colors: true
}
}
})
Loading

0 comments on commit 6cffa95

Please sign in to comment.