Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Boye Borg Nygård committed Sep 8, 2016
0 parents commit 020b594
Show file tree
Hide file tree
Showing 138 changed files with 6,266 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
root = true

[*]
end_of_line = lf
insert_final_newline = false
indent_style = space
indent_size = 2
106 changes: 106 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# From https://github.com/Danimoth/gitattributes/blob/master/Web.gitattributes

# Handle line endings automatically for files detected as text
# and leave all files detected as binary untouched.
* text=auto

#
# The above will handle all files NOT found below
#

#
## These files are text and should be normalized (Convert crlf => lf)
#

# source code
*.php text
*.css text
*.sass text
*.scss text
*.less text
*.styl text
*.js text eol=lf
*.coffee text
*.json text
*.htm text
*.html text
*.xml text
*.svg text
*.txt text
*.ini text
*.inc text
*.pl text
*.rb text
*.py text
*.scm text
*.sql text
*.sh text
*.bat text

# templates
*.ejs text
*.hbt text
*.jade text
*.haml text
*.hbs text
*.dot text
*.tmpl text
*.phtml text

# server config
.htaccess text

# git config
.gitattributes text
.gitignore text
.gitconfig text

# code analysis config
.jshintrc text
.jscsrc text
.jshintignore text
.csslintrc text

# misc config
*.yaml text
*.yml text
.editorconfig text

# build config
*.npmignore text
*.bowerrc text

# Heroku
Procfile text
.slugignore text

# Documentation
*.md text
LICENSE text
AUTHORS text


#
## These files are binary and should be left untouched
#

# (binary is a macro for -text -diff)
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.ico binary
*.mov binary
*.mp4 binary
*.mp3 binary
*.flv binary
*.fla binary
*.swf binary
*.gz binary
*.zip binary
*.7z binary
*.ttf binary
*.eot binary
*.woff binary
*.pyc binary
*.pdf binary
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Don't check auto-generated stuff into git
coverage
build
node_modules
stats.json

# Cruft
.DS_Store
npm-debug.log
.idea
18 changes: 18 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
language: node_js
sudo: true
dist: trusty
node_js:
- "5.0"
script: npm run build
before_install:
- export CHROME_BIN=/usr/bin/google-chrome
- export DISPLAY=:99.0
- sudo apt-get update
- sudo apt-get install -y libappindicator1 fonts-liberation
- wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
- sudo dpkg -i google-chrome*.deb
- sh -e /etc/init.d/xvfb start
notifications:
email:
on_failure: change
after_success: 'npm run coveralls'
44 changes: 44 additions & 0 deletions app/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<ifModule mod_rewrite.c>


#######################################################################
# GENERAL #
#######################################################################

# Make apache follow sym links to files
Options +FollowSymLinks
# If somebody opens a folder, hide all files from the resulting folder list
IndexIgnore */*


#######################################################################
# REWRITING #
#######################################################################

# Enable rewriting
RewriteEngine On

# If its not HTTPS
RewriteCond %{HTTPS} off

# Comment out the RewriteCond above, and uncomment the RewriteCond below if you're using a load balancer (e.g. CloudFlare) for SSL
# RewriteCond %{HTTP:X-Forwarded-Proto} !https

# Redirect to the same URL with https://, ignoring all further rules if this one is in effect
RewriteRule ^(.*) https://%{HTTP_HOST}/$1 [R,L]

# If we get to here, it means we are on https://

# If the file with the specified name in the browser doesn't exist
RewriteCond %{REQUEST_FILENAME} !-f

# and the directory with the specified name in the browser doesn't exist
RewriteCond %{REQUEST_FILENAME} !-d

# and we are not opening the root already (otherwise we get a redirect loop)
RewriteCond %{REQUEST_FILENAME} !\/$

# Rewrite all requests to the root
RewriteRule ^(.*) /

</ifModule>
66 changes: 66 additions & 0 deletions app/.nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
##
# Put this file in /etc/nginx/conf.d folder and make sure
# you have line 'include /etc/nginx/conf.d/*.conf;'
# in your main nginx configuration file
##

##
# Redirect to the same URL with https://
##

server {

listen 80;

# Type your domain name below
server_name example.com;

return 301 https://$server_name$request_uri;

}

##
# HTTPS configurations
##

server {

listen 443;

# Type your domain name below
server_name example.com;

ssl on;
ssl_certificate /path/to/certificate.crt;
ssl_certificate_key /path/to/server.key;

# Use only TSL protocols for more secure
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

# Always serve index.html for any request
location / {
# Set path
root /var/www/;
try_files $uri /index.html;
}

##
# If you want to use Node/Rails/etc. API server
# on the same port (443) config Nginx as a reverse proxy.
# For security reasons use a firewall like ufw in Ubuntu
# and deny port 3000/tcp.
##

# location /api/ {
#
# proxy_pass http://localhost:3000;
# proxy_http_version 1.1;
# proxy_set_header X-Forwarded-Proto https;
# proxy_set_header Upgrade $http_upgrade;
# proxy_set_header Connection 'upgrade';
# proxy_set_header Host $host;
# proxy_cache_bypass $http_upgrade;
#
# }

}
98 changes: 98 additions & 0 deletions app/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
/**
* app.js
*
* This is the entry file for the application, only setup and boilerplate
* code.
*/
import 'babel-polyfill';

/* eslint-disable import/no-unresolved */
// Load the manifest.json file and the .htaccess file
import '!file?name=[name].[ext]!./manifest.json';
import 'file?name=[name].[ext]!./.htaccess';
/* eslint-enable import/no-unresolved */

// Import all the third party stuff
import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import { applyRouterMiddleware, Router, browserHistory } from 'react-router';
import { syncHistoryWithStore } from 'react-router-redux';
import useScroll from 'react-router-scroll';
import LanguageProvider from 'containers/LanguageProvider';
import configureStore from './store';

// Import i18n messages
import { translationMessages } from './i18n';

// Import the CSS reset, which HtmlWebpackPlugin transfers to the build folder
import 'sanitize.css/sanitize.css';

// Create redux store with history
// this uses the singleton browserHistory provided by react-router
// Optionally, this could be changed to leverage a created history
// e.g. `const browserHistory = useRouterHistory(createBrowserHistory)();`
const initialState = {};
const store = configureStore(initialState, browserHistory);

// Sync history and store, as the react-router-redux reducer
// is under the non-default key ("routing"), selectLocationState
// must be provided for resolving how to retrieve the "route" in the state
import { selectLocationState } from 'containers/App/selectors';
const history = syncHistoryWithStore(browserHistory, store, {
selectLocationState: selectLocationState(),
});

// Set up the router, wrapping all Routes in the App component
import App from 'containers/App';
import createRoutes from './routes';
const rootRoute = {
component: App,
childRoutes: createRoutes(store),
};


const render = (translatedMessages) => {
ReactDOM.render(
<Provider store={store}>
<LanguageProvider messages={translatedMessages}>
<Router
history={history}
routes={rootRoute}
render={
// Scroll to top when going to a new page, imitating default browser
// behaviour
applyRouterMiddleware(useScroll())
}
/>
</LanguageProvider>
</Provider>,
document.getElementById('app')
);
};


// Hot reloadable translation json files
if (module.hot) {
// modules.hot.accept does not accept dynamic dependencies,
// have to be constants at compile-time
module.hot.accept('./i18n', () => {
render(translationMessages);
});
}

// Chunked polyfill for browsers without Intl support
if (!window.Intl) {
Promise.all([
System.import('intl'),
System.import('intl/locale-data/jsonp/en.js'),
]).then(() => render(translationMessages));
} else {
render(translationMessages);
}

// Install ServiceWorker and AppCache in the end since
// it's not most important operation and if main code fails,
// we do not want it installed
import { install } from 'offline-plugin/runtime';
install();
Loading

0 comments on commit 020b594

Please sign in to comment.