Skip to content
This repository has been archived by the owner on Sep 4, 2018. It is now read-only.

Commit

Permalink
initial setup
Browse files Browse the repository at this point in the history
  • Loading branch information
trodrigues committed Feb 27, 2015
0 parents commit d4754b4
Show file tree
Hide file tree
Showing 10 changed files with 197 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
env:
browser: true
node: true
ecmaFeatures:
jsx: true
arrowFunctions: true
binaryLiterals: true
blockBindings: true
defaultParams: true
forOf: true
generators: true
objectLiteralComputedProperties: true
objectLiteralDuplicateProperties: true
objectLiteralShorthandMethods: true
objectLiteralShorthandProperties: true
octalLiterals: true
regexUFlag: true
regexYFlag: true
superInFunctions: true
templateStrings: true
unicodeCodePointEscapes: true
globalReturn: true
rules:
browser: true
node: true
no-unused-vars: 1
strict: [2, "never"]
quotes: "single"
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build
node_modules
config.json
49 changes: 49 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
export PATH := ./node_modules/.bin:$(PATH)
export SHELL := /bin/bash

source_dir = src
source_js_path = $(source_dir)/javascripts
source_css_path = $(source_dir)/stylesheets

source_index = $(source_dir)/index.html
source_js_files = $(shell find $(source_js_path) -name "*.js")
source_app_js = $(source_js_path)/app.js
source_css_files = $(shell find $(source_css_path) -name "*.styl")
source_main_css = $(source_css_path)/main.styl

app_index = build/index.html
app_js = build/js/main.js
app_css = build/css/main.css
build_dir = build

js_debug := --debug
css_debug := --sourcemap-inline

.PHONY: all all_production watch clean production

all: $(app_index) $(app_js) $(app_css)

watch: clean all
watchy -w $(source_js_path),$(source_css_path) -- make all

clean:
rm -rf build
rm -rf production

# deactivate debugging flags for production
production: js_debug =
production: css_debug =
production: clean $(app_index) $(app_js) $(app_css)

$(app_index):
mkdir -p $(build_dir)
cp $(source_index) $(app_index)

$(app_js): $(source_js_files)
mkdir -p $(dir $@)
browserify $(js_debug) -t 6to5ify -t reactify $(source_app_js) > $@

$(app_css): $(source_css_files)
mkdir -p $(dir $@)
stylus $(css_debug) --include $(source_css_path) < $(source_main_css) > $(app_css)

10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# guide-app-sw

## Installation

You can run this yourself with:

$ npm install
$ node app.js


16 changes: 16 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
var express = require('express'); // Express web server framework
var fs = require('fs');

var config = require('./config.json');

var app = express();

app.use(express.static(__dirname + '/build'));

app.get('/*', function (req, res) {
res.type('html');
res.send(fs.readFileSync('build/index.html'));
});

console.log('Listening on '+config.port);
app.listen(config.port);
4 changes: 4 additions & 0 deletions config.json.default
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"accessToken": "ACCESS_TOKEN",
"space": "SPACE_ID"
}
21 changes: 21 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"author": "Tiago Rodrigues",
"name": "guide-app-sw",
private: true,
"description": "",
"version": "0.0.1",
"main": "app.js",
"dependencies": {
"axios": "^0.5.0",
"express": "~4.0.0",
"immutable": "^3.6.2",
"react-router": "^0.12.0"
},
"devDependencies": {
"6to5ify": "^3.1.2",
"browserify": "^8.1.0",
"react": "^0.12.2",
"reactify": "^0.17.1",
"stylus": "^0.49.3"
}
}
13 changes: 13 additions & 0 deletions src/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html>
<head>
<title></title>
<link rel="stylesheet" href="/css/main.css" type="text/css" media="screen" charset="utf-8">
<meta charset="utf-8">
<script src="/js/main.js"></script>
</head>

<body></body>

</html>

35 changes: 35 additions & 0 deletions src/javascripts/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
const React = require('react');
const Router = require('react-router');
const {Route, RouteHandler, DefaultRoute, HistoryLocation} = Router;

const LoginButton = require('./components/login');
const Home = require('./components/home');
const SuccessfulLogin = require('./components/successful_login');
const FailedLogin = require('./components/failed_login');

const App = React.createClass({
render() {
return (
<main>
<nav>
Some nav maybe
</nav>

<RouteHandler/>
</main>
);
}
});

const routes = (
<Route handler={App} path="/">
<DefaultRoute handler={Home}/>
<Route name="successful_login" handler={SuccessfulLogin}/>
<Route name="failed_login" handler={FailedLogin}/>
</Route>
);

Router.run(routes, HistoryLocation, Handler => {
React.render(<Handler/>, document.getElementById('appContainer'));
});

18 changes: 18 additions & 0 deletions src/stylesheets/main.styl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
Main styles
Styleguide 1.0
*/

/*
Body styles
Styles the body
Markup:
body
Styleguide 1.1
*/
body
font-size: 10px

0 comments on commit d4754b4

Please sign in to comment.