-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Scaffold from https://github.com/topheman/react-es6-redux
- Loading branch information
0 parents
commit 296a25e
Showing
24 changed files
with
839 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"stage": 1, | ||
"loose": "all" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# http://editorconfig.org | ||
root = true | ||
|
||
[*] | ||
# change these settings to your own preference | ||
indent_style = space | ||
indent_size = 2 | ||
|
||
# it's recommend to keep these unchanged | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false | ||
|
||
[{package,bower}.json] | ||
indent_style = space | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"env": { | ||
"mocha": true, | ||
"jasmine": true, | ||
"protractor": true | ||
}, | ||
"globals": { | ||
"goToUrl": true, | ||
"waitUntilIsElementPresent": true | ||
}, | ||
"extends": "airbnb", | ||
"parser": "babel-eslint", | ||
"rules": { | ||
// disable requiring trailing commas because it might be nice to revert to | ||
// being JSON at some point, and I don't want to make big changes now. | ||
"comma-dangle": 0, | ||
"brace-style": [2, "stroustrup"], | ||
"no-console": 0, | ||
"padded-blocks": 0, | ||
"indent": [2, 2, {"SwitchCase": 1}], | ||
"spaced-comment": 1 | ||
}, | ||
"plugins":[ | ||
"react" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules | ||
.idea | ||
build | ||
*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
'use strict'; | ||
|
||
function projectIsGitManaged(){ | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
try { | ||
// Query the entry | ||
var stats = fs.lstatSync(path.join(__dirname,'.git')); | ||
|
||
// Is it a directory? | ||
if (stats.isDirectory()) { | ||
return true; | ||
} | ||
return false; | ||
} | ||
catch (e) { | ||
return false; | ||
} | ||
} | ||
|
||
function getInfos(){ | ||
var gitActive = projectIsGitManaged(); | ||
var gitRev = require('git-rev-sync'); | ||
var moment = require('moment'); | ||
var pkg = require('./package.json'); | ||
var infos = { | ||
pkg: pkg, | ||
today: moment(new Date()).format('DD/MM/YYYY'), | ||
year: new Date().toISOString().substr(0, 4), | ||
gitRevisionShort: gitActive ? gitRev.short() : null, | ||
gitRevisionLong: gitActive ? gitRev.long() : null, | ||
urlToCommit: null | ||
}; | ||
infos.urlToCommit = gitActive ? _getUrlToCommit(pkg, infos.gitRevisionLong) : null; | ||
return infos; | ||
} | ||
|
||
/** | ||
* Called in default mode by webpack (will format it correctly in comments) | ||
* Called in formatted mode by gulp (for html comments) | ||
* @param {String} mode default/formatted | ||
* @returns {String} | ||
*/ | ||
function getBanner(mode){ | ||
var _ = require('lodash'); | ||
var infos = getInfos(); | ||
var compiled = _.template([ | ||
'<%= pkg.name %>', | ||
'', | ||
'<%= pkg.description %>', | ||
'', | ||
'@version v<%= pkg.version %> - <%= today %>', | ||
'<% if(gitRevisionShort !== null) { %>@revision #<%= gitRevisionShort %><% if (urlToCommit !== null) { %> - <%= urlToCommit %><% } %><% } %>', | ||
'@author <%= (pkg.author && pkg.author.name) ? pkg.author.name : pkg.author %>', | ||
'@copyright <%= year %>(c) <%= (pkg.author && pkg.author.name) ? pkg.author.name : pkg.author %>', | ||
'@license <%= pkg.license %>', | ||
'' | ||
].join(mode === 'formatted' ? '\n * ' : '\n')); | ||
return compiled(infos); | ||
} | ||
|
||
function getBannerHtml(){ | ||
return '<!--\n * \n * ' + getBanner('formatted') + '\n-->\n'; | ||
} | ||
|
||
function _getUrlToCommit(pkg, gitRevisionLong){ | ||
var urlToCommit = null; | ||
//retrieve and reformat repo url from package.json | ||
if (typeof(pkg.repository) === 'string') { | ||
urlToCommit = pkg.repository; | ||
} | ||
else if (typeof(pkg.repository.url) === 'string') { | ||
urlToCommit = pkg.repository.url; | ||
} | ||
//check that there is a git repo specified in package.json & it is a github one | ||
if (urlToCommit !== null && /^https:\/\/github.com/.test(urlToCommit)) { | ||
urlToCommit = urlToCommit.replace(/.git$/, '/tree/' + gitRevisionLong);//remove the .git at the end | ||
} | ||
return urlToCommit; | ||
} | ||
|
||
module.exports.getInfos = getInfos; | ||
module.exports.getBanner = getBanner; | ||
module.exports.getBannerHtml = getBannerHtml; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
'use strict'; | ||
|
||
var gulp = require('gulp'); | ||
var inject = require('gulp-inject'); | ||
var processhtml = require('gulp-processhtml'); | ||
var gutil = require('gulp-util'); | ||
var minifyHtml = require('gulp-minify-html'); | ||
var gulpif = require('gulp-if'); | ||
var rename = require('gulp-rename'); | ||
var footer = require('gulp-footer'); | ||
|
||
var common = require('./common'); | ||
|
||
var NODE_ENV = process.env.NODE_ENV ? process.env.NODE_ENV.toLowerCase() : 'dev'; | ||
var DEVTOOLS = process.env.DEVTOOLS ? true : false; | ||
if(NODE_ENV === 'production'){ | ||
console.log('PRODUCTION mode'); | ||
} | ||
else{ | ||
console.log('DEVELOPMENT mode'); | ||
} | ||
if(DEVTOOLS){ | ||
console.log('DEVTOOLS active'); | ||
} | ||
|
||
function getWebpackHash(){ | ||
try{ | ||
return require('./build/stats.json').hash; | ||
} | ||
catch(e){ | ||
throw new Error('./build/stats.json file missing, please relaunch the build', e); | ||
} | ||
} | ||
|
||
function getTagFromFilepath(filepath){ | ||
//fix path | ||
filepath = filepath.replace('/build','.'); | ||
gutil.log('Injecting', filepath); | ||
//return tag | ||
if(/\.js$/.test(filepath)){ | ||
return '<script src="' + filepath + '"></script>'; | ||
} | ||
if(/\.css$/.test(filepath)){ | ||
return '<link rel="stylesheet" href="' + filepath + '">'; | ||
} | ||
throw new Error('Unrecognized file type (not js or css'); | ||
} | ||
|
||
gulp.task('compile', function() { | ||
var hash = (NODE_ENV === 'production' && DEVTOOLS ? '-devtools' : '') + (NODE_ENV === 'production' ? '-'+getWebpackHash() : ''); | ||
return gulp.src('./public/index.html') | ||
.pipe(inject( gulp.src('./build/assets/js/bundle'+hash+'.js', {read: false}), { | ||
starttag: '<!-- inject:js -->', | ||
transform: getTagFromFilepath | ||
})) | ||
.pipe(inject( gulp.src('./build/assets/css/main'+hash+'.css', {read: false}), { | ||
starttag: '<!-- inject:css -->', | ||
transform: getTagFromFilepath | ||
})) | ||
.pipe(processhtml()) | ||
.pipe(gulpif(NODE_ENV === 'production' && DEVTOOLS === false ? true : false, minifyHtml({empty: true}))) //only minify html in production (when producing a devtool version) | ||
.pipe(footer(common.getBannerHtml())) | ||
.pipe(gulpif(NODE_ENV === 'production' && DEVTOOLS === true ? true : false, rename('devtools.html'))) //when producing a devtools version, rename (not to erase the existing index.html) | ||
.pipe(gulp.dest('./build')); | ||
}); | ||
|
||
gulp.task('build', ['compile']); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
{ | ||
"name": "d3-react-rxjs-experiments", | ||
"version": "0.0.1", | ||
"description": "", | ||
"main": "gulpfile.js", | ||
"scripts": { | ||
"test": "npm run lint", | ||
"lint": "./node_modules/.bin/eslint --ext .js --ext .jsx src test", | ||
"lint-watch": "./node_modules/.bin/esw --watch --ext .js --ext .jsx src test", | ||
"build": "./node_modules/.bin/webpack --progress && ./node_modules/.bin/gulp build", | ||
"clean": "./node_modules/.bin/webpack --clean-only", | ||
"build-prod": "NODE_ENV=production ./node_modules/.bin/webpack --progress -p && NODE_ENV=production ./node_modules/.bin/gulp build", | ||
"serve-build": "./node_modules/.bin/serve --port 9001 build", | ||
"webpack": "./node_modules/.bin/webpack-dev-server --progress --colors --hot --inline", | ||
"webpack-dev": "DEVTOOLS=true npm run webpack" | ||
}, | ||
"pre-commit": [ | ||
"test" | ||
], | ||
"author": "Christophe Rosset <tophe@topheman.com> (http://labs.topheman.com/)", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"babel-core": "^5.8.25", | ||
"babel-eslint": "^4.1.6", | ||
"babel-loader": "^5.3.2", | ||
"css-loader": "^0.19.0", | ||
"del": "^2.0.2", | ||
"eslint": "^1.10.3", | ||
"eslint-config-airbnb": "^1.0.2", | ||
"eslint-loader": "^1.1.1", | ||
"eslint-plugin-react": "^3.11.2", | ||
"eslint-watch": "^2.1.4", | ||
"extract-text-webpack-plugin": "^0.8.2", | ||
"file-loader": "^0.8.4", | ||
"git-rev-sync": "^1.4.0", | ||
"gulp": "^3.9.0", | ||
"gulp-footer": "^1.0.5", | ||
"gulp-if": "^2.0.0", | ||
"gulp-inject": "^3.0.0", | ||
"gulp-minify-html": "^1.0.4", | ||
"gulp-processhtml": "^1.1.0", | ||
"gulp-rename": "^1.2.2", | ||
"gulp-util": "^3.0.6", | ||
"json-loader": "^0.5.3", | ||
"load-grunt-tasks": "^3.3.0", | ||
"lodash": "^3.10.1", | ||
"minimist": "^1.2.0", | ||
"moment": "^2.10.6", | ||
"node-sass": "^3.3.3", | ||
"pre-commit": "^1.1.2", | ||
"react-hot-loader": "^1.3.0", | ||
"run-sequence": "^1.1.4", | ||
"sass-loader": "^3.0.0", | ||
"serve": "^1.4.0", | ||
"style-loader": "^0.12.4", | ||
"url-loader": "^0.5.6", | ||
"webpack": "^1.12.2", | ||
"webpack-dev-server": "^1.12.0" | ||
}, | ||
"dependencies": { | ||
"bootstrap-sass": "^3.3.5", | ||
"es6-promise": "^3.0.2", | ||
"history": "~1.13.1", | ||
"react": "^0.14.3", | ||
"react-dom": "^0.14.3", | ||
"react-router": "^1.0.2" | ||
}, | ||
"private": true | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head lang="en"> | ||
<meta charset="UTF-8"> | ||
<title>Topheman - d3-react-rxjs-experiments</title> | ||
<!-- inject:css --> | ||
<!-- endinject --> | ||
|
||
<!-- build:remove --> | ||
<link rel="stylesheet" type="text/css" href="./assets/css/main.css"> | ||
<!-- /build --> | ||
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no"> | ||
</head> | ||
<body> | ||
<div id="app-container"></div> | ||
<!-- inject:js --> | ||
<!-- endinject --> | ||
|
||
<!-- build:remove --> | ||
<script src="http://localhost:8080/webpack-dev-server.js"></script> | ||
<script src="./assets/js/bundle.js"></script> | ||
<!-- /build --> | ||
|
||
<!-- Google Analytics --> | ||
<script type="text/javascript"> | ||
var _gaq = _gaq || []; | ||
_gaq.push(['_setAccount', 'UA-41002835-1']); | ||
_gaq.push(['_setDomainName', 'topheman.github.io']); | ||
_gaq.push(['_setAllowLinker', true]); | ||
_gaq.push(['_trackPageview']); | ||
(function() { | ||
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | ||
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | ||
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); | ||
})(); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
global.Promise = global.Promise || require('es6-promise').Promise; | ||
|
||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import { Router } from 'react-router'; | ||
import createHashHistory from 'history/lib/createHashHistory'; | ||
|
||
const history = createHashHistory({queryKey: 'hash'}); | ||
|
||
import routes from './routes.js'; | ||
|
||
const rootElement = <Router history={history}>{routes}</Router>; | ||
|
||
ReactDOM.render(rootElement, document.getElementById('app-container')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React from 'react'; | ||
|
||
import TwitterButton from './../TwitterButton/TwitterButton.js'; | ||
|
||
const Footer = () => ( | ||
<footer className="footer container"> | ||
<p> | ||
©2015 <a href="http://labs.topheman.com/">labs.topheman.com</a> - Christophe Rosset<br/> | ||
<TwitterButton/> | ||
</p> | ||
</footer> | ||
); | ||
|
||
export default Footer; |
Oops, something went wrong.