Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
sugarshin committed May 7, 2016
0 parents commit a91d211
Show file tree
Hide file tree
Showing 14 changed files with 357 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .babelrc
@@ -0,0 +1,10 @@
{
"presets": ["es2015", "stage-2", "react"],
"env": {
"development": {
"presets": [
"power-assert"
]
}
}
}
14 changes: 14 additions & 0 deletions .eslintrc
@@ -0,0 +1,14 @@
{
"extends": ["eslint:recommended", "plugin:react/recommended"],
"parser": "babel-eslint",
"plugins": ["babel", "react"],
"env": {
"browser": true,
"node": true
},
"rules": {
"no-console": 1,
"react/jsx-uses-react": 1,
"react/jsx-uses-vars": 1
}
}
3 changes: 3 additions & 0 deletions .gitignore
@@ -0,0 +1,3 @@
node_modules
build
build-dev
36 changes: 36 additions & 0 deletions .stylintrc
@@ -0,0 +1,36 @@
{
"reporter": "stylint-stylish",
"blocks": false,
"brackets": "never",
"colons": "never",
"colors": false,
"commaSpace": "always",
"commentSpace": "always",
"cssLiteral": "never",
"depthLimit": false,
"duplicates": true,
"efficient": "always",
"extendPref": false,
"globalDupe": false,
"indentPref": false,
"leadingZero": "never",
"maxErrors": false,
"maxWarnings": false,
"mixed": false,
"namingConvention": false,
"namingConventionStrict": false,
"none": "never",
"noImportant": true,
"parenSpace": false,
"placeholders": "always",
"prefixVarsWithDollar": "always",
"quotePref": "single",
"semicolons": "never",
"sortOrder": false,
"stackedProperties": "never",
"trailingWhitespace": "never",
"universal": false,
"valid": true,
"zeroUnits": "never",
"zIndexNormalize": false
}
16 changes: 16 additions & 0 deletions .travis.yml
@@ -0,0 +1,16 @@
sudo: false
language: node_js
node_js:
- '6'
branches:
only:
- master
cache:
directories:
- node_modules
before_install:
- npm update -g npm
after_success:
- npm run build
deploy:
- ./node_modules/.bin/gh-pages -d build
40 changes: 40 additions & 0 deletions README.md
@@ -0,0 +1,40 @@
# log.sugarshin.net

[![Build Status][travis-image]][travis-url]
[![Dependency Status][david-image]][david-url]
[![Devdependency Status][david-dev-image]][david-dev-url]

https://log.sugarshin.net

## Start dev-server

```
npm start
```

## Run tests

```
npm test
```

## Build assets

```
NODE_ENV=production npm run build
```

## Deploy

Merge to master branch will trigger Travis CI that deploys assets to GitHub Pages.

## License

© sugarshin

[travis-image]: http://img.shields.io/travis/sugarshin/log.sugarshin.net/master.svg?branch=master&style=flat-square
[travis-url]: https://travis-ci.org/sugarshin/log.sugarshin.net
[david-image]: https://david-dm.org/sugarshin/log.sugarshin.net.svg?style=flat-square
[david-url]: https://david-dm.org/sugarshin/log.sugarshin.net
[david-dev-image]: https://david-dm.org/sugarshin/log.sugarshin.net/dev-status.svg?style=flat-square
[david-dev-url]: https://david-dm.org/sugarshin/log.sugarshin.net#info=devDependencies
Empty file added articles/.keep
Empty file.
89 changes: 89 additions & 0 deletions config/webpack.config.js
@@ -0,0 +1,89 @@
const path = require('path');
const webpack = require('webpack');

const production = process.env.NODE_ENV === 'production';
const cssModules = 'modules&importLoaders=1&localIdentName=[path][name]__[local]___[hash:base64:8]';
const cssLoader = production ? `css?minimize&${cssModules}` : `css?${cssModules}`;
const buildDev = 'build-dev';
const buildDir = production ? 'build' : buildDev;
const plugins = [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)
})
];
const entry = ['babel-polyfill', './src/index.js'];
if (production) {
plugins.push(new webpack.optimize.UglifyJsPlugin({ compress: { warnings: false } }));
} else {
plugins.push(new webpack.HotModuleReplacementPlugin());
entry.push(
'webpack-dev-server/client?http://localhost:8003',
'webpack/hot/dev-server'
);
}

module.exports = {
entry,
plugins,
cache: true,
output: {
path: path.resolve(__dirname, '..', buildDir, 'assets'),
filename: production ? 'app-[hash].js' : 'app.js',
publicPath: 'assets/'
},
display: { errorDetails: true },
resolve: {
extensions: ['', '.js', '.jsx']
},
module: {
preLoaders: [
{
test: /\.styl$/,
loader: 'stylint',
exclude: /node_modules/,
},
{
test: /\.jsx?$/,
loader: 'eslint',
exclude: /node_modules/
}
],
loaders: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel',
query: { presets: ['es2015', 'stage-2', 'react'] }
},
{
test: /\.styl$/,
loaders: ['style', cssLoader, 'postcss', 'stylus']
},
{
test: /\.css$/,
loaders: ['style', cssLoader, 'postcss']
},
{
test: /\.(jpe?g|png|gif|svg)$/,
loaders: [
'url?limit=102400&hash=sha512&digest=hex&name=[name]__[hash].[ext]',
'image-webpack?progressive&bypassOnDebug&optimizationLevel=7'
]
}
]
},
postcss: () => [
require('autoprefixer')({ browsers: ['last 3 versions'] }),
require('css-mqpacker'),
require('postcss-flexbugs-fixes'),
require('postcss-partial-import')()
],
stylus: {
include: ['node_modules']
},
devServer: {
contentBase: `./${buildDev}`,
hot: true,
publicPath: '/assets/'
}
};
93 changes: 93 additions & 0 deletions package.json
@@ -0,0 +1,93 @@
{
"name": "log.sugarshin.net",
"version": "1.0.0",
"description": "log.sugarshin.net",
"private": true,
"scripts": {
"a": "node script/article",
"start": "npm-run-all clean:dev --parallel pug:dev dev-server",
"pug:dev": "pug -o build-dev -Pw src/template/index.pug",
"dev-server": "webpack-dev-server --config config/webpack.config.js --port 8003 --progress",
"clean:dev": "if [ -d build-dev ]; then rm -rf build-dev; fi",
"lint:js": "eslint src",
"lint:styl": "stylint src",
"lint" : "npm-run-all lint:*",
"test-src": "mocha --compilers js:babel-register test/**/*.js",
"test": "npm-run-all lint test-src",
"clean:build": "if [ -d build ]; then rm -rf build; fi",
"pug:build": "pug -o build src/template/index.pug",
"webpack": "webpack --config config/webpack.config.js",
"build": "NODE_ENV=production sh script/build.sh"
},
"repository": {
"type": "git",
"url": "git+https://github.com/sugarshin/log.sugarshin.net.git"
},
"engines": {
"node": ">=6"
},
"author": "sugarshin",
"license": "MIT",
"bugs": {
"url": "https://github.com/sugarshin/log.sugarshin.net/issues"
},
"homepage": "https://github.com/sugarshin/log.sugarshin.net#readme",
"dependencies": {
"classnames": "^2.2.5",
"github-markdown-css": "^2.3.0",
"lodash": "^4.11.2",
"mirror-key-value": "^1.0.2",
"react": "^15.0.2",
"react-dom": "^15.0.2",
"react-redux": "^4.4.5",
"react-router": "^2.4.0",
"react-router-redux": "^4.0.4",
"redux": "^3.5.2",
"redux-thunk": "^2.0.1",
"remark": "^4.2.2",
"remark-react": "^2.1.0",
"sanitize.css": "^3.3.0",
"whatwg-fetch": "^1.0.0"
},
"devDependencies": {
"autoprefixer": "^6.3.6",
"babel-core": "^6.8.0",
"babel-eslint": "^6.0.4",
"babel-loader": "^6.2.4",
"babel-polyfill": "^6.8.0",
"babel-preset-es2015": "^6.6.0",
"babel-preset-power-assert": "^1.0.0",
"babel-preset-react": "^6.5.0",
"babel-preset-stage-2": "^6.5.0",
"babel-register": "^6.8.0",
"css-loader": "^0.23.1",
"css-mqpacker": "^4.0.1",
"eslint": "^2.9.0",
"eslint-loader": "^1.3.0",
"eslint-plugin-babel": "^3.2.0",
"eslint-plugin-react": "^5.0.1",
"feed": "^0.3.0",
"file-loader": "^0.8.5",
"gh-pages": "^0.11.0",
"image-webpack-loader": "^1.8.0",
"jsdom": "^8.5.0",
"mocha": "^2.4.5",
"npm-run-all": "^1.8.0",
"postcss-flexbugs-fixes": "^2.0.0",
"postcss-loader": "^0.9.1",
"postcss-partial-import": "^1.3.0",
"power-assert": "^1.4.0",
"pug-cli": "^1.0.0-alpha1",
"react-addons-test-utils": "^15.0.2",
"redux-devtools": "^3.2.0",
"style-loader": "^0.13.1",
"stylint": "^1.3.9",
"stylint-loader": "^1.0.0",
"stylint-stylish": "^1.2.2",
"stylus": "^0.54.5",
"stylus-loader": "^2.0.0",
"url-loader": "^0.5.7",
"webpack": "^1.13.0",
"webpack-dev-server": "^1.14.1"
}
}
9 changes: 9 additions & 0 deletions script/build.sh
@@ -0,0 +1,9 @@
#!/bin/bash
set -eu

CNAME=log.sugarshin.net

npm run clean:build && \
npm run webpack && \
MAIN_SCRIPT=/assets/$(basename `ls build/assets/app-*.js`) npm run pug:build
echo $CNAME > build/CNAME
37 changes: 37 additions & 0 deletions src/index.js
@@ -0,0 +1,37 @@
import 'whatwg-fetch';
import 'sanitize.css/lib/sanitize.styl';
import gmcss from 'github-markdown-css/github-markdown.css';
import React from 'react';
import ReactDOM from 'react-dom';
import styles from './index.styl';

function Hello(props) {
return <h1 className={styles.h1}>{props.name}</h1>;
}
Hello.propTypes = { name: React.PropTypes.string };

ReactDOM.render((
<div className={gmcss['markdown-body']}>
<Hello name='Aoi' />
<h2>h2</h2>
<h3>h3</h3>
<h4>h4</h4>
<h5>h5</h5>
<h6>h6</h6>
<p>ppppppppp</p>
<ul>
<li>ul</li>
<li>ul</li>
<li>ul</li>
<li>ul</li>
</ul>
<ol>
<li>ol</li>
<li>ol</li>
<li>ol</li>
<li>ol</li>
</ol>
<blockquote>blockquoteblockquote</blockquote>
<pre><code>codecodecodecodecode</code></pre>
</div>
), document.querySelector('#app-root'));
2 changes: 2 additions & 0 deletions src/index.styl
@@ -0,0 +1,2 @@
.h1
color indianred
8 changes: 8 additions & 0 deletions src/template/index.pug
@@ -0,0 +1,8 @@
doctype html
html
head
meta(charset="utf-8")
title log
body
#app-root
script(src=(process.env.MAIN_SCRIPT ? process.env.MAIN_SCRIPT : "/assets/app.js"))
Empty file added test/test.js
Empty file.

0 comments on commit a91d211

Please sign in to comment.