-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Fractal Project Structure #684
Changes from all commits
641ce78
3a22e34
33b256a
6a30c23
0965e8c
f725c6b
f5690de
a4e1d2a
811fdfe
24d134f
1153389
16fc801
99dd0b7
f8f9770
bc7f539
735fc9b
5950392
2bf1bf3
68a12a1
80b3d35
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,7 +77,6 @@ config.globals = { | |
'__PROD__' : config.env === 'production', | ||
'__TEST__' : config.env === 'test', | ||
'__DEBUG__' : config.env === 'development' && !argv.no_debug, | ||
'__DEBUG_NEW_WINDOW__' : !!argv.nw, | ||
'__BASENAME__' : JSON.stringify(process.env.BASENAME || '') | ||
} | ||
|
||
|
@@ -100,17 +99,14 @@ config.compiler_vendor = config.compiler_vendor | |
// ------------------------------------ | ||
// Utilities | ||
// ------------------------------------ | ||
config.utils_paths = (() => { | ||
const resolve = path.resolve | ||
|
||
const base = (...args) => | ||
resolve.apply(resolve, [config.path_base, ...args]) | ||
|
||
return { | ||
base : base, | ||
client : base.bind(null, config.dir_client), | ||
dist : base.bind(null, config.dir_dist) | ||
} | ||
})() | ||
const resolve = path.resolve | ||
const base = (...args) => | ||
Reflect.apply(resolve, null, [config.path_base, ...args]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @justingreenberg I'm not familiar with using the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just found https://github.com/tvcutsem/harmony-reflect/wiki so maybe that will clear things up. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that's a great resource, pretty much says it all... basically, Reflect provides a nice functional first-class api for certain primitive methods, ie apply and operators ie. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No worries about reverting, I just learned some new things today is all ;) |
||
|
||
config.utils_paths = { | ||
base : base, | ||
client : base.bind(null, config.dir_client), | ||
dist : base.bind(null, config.dir_dist) | ||
} | ||
|
||
export default config |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* @flow */ | ||
import React from 'react' | ||
import classes from './Counter.scss' | ||
|
||
// FlowType annotations | ||
type Props = { | ||
counter: number, | ||
doubleAsync: Function, | ||
increment: Function | ||
} | ||
|
||
export const Counter = (props: Props) => ( | ||
<div> | ||
<h2 className={classes.counterContainer}> | ||
Counter: | ||
{' '} | ||
<span className={classes['counter--green']}> | ||
{props.counter} | ||
</span> | ||
</h2> | ||
<button className='btn btn-default' onClick={props.increment}> | ||
Increment | ||
</button> | ||
{' '} | ||
<button className='btn btn-default' onClick={props.doubleAsync}> | ||
Double (Async) | ||
</button> | ||
</div> | ||
) | ||
|
||
Counter.propTypes = { | ||
counter: React.PropTypes.number.isRequired, | ||
doubleAsync: React.PropTypes.func.isRequired, | ||
increment: React.PropTypes.func.isRequired | ||
} | ||
|
||
export default Counter |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import Counter from './Counter' | ||
|
||
export default Counter |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import React from 'react' | ||
import { IndexLink, Link } from 'react-router' | ||
import classes from './Header.scss' | ||
|
||
export const Header = () => ( | ||
<div> | ||
<h1>React Redux Starter Kit</h1> | ||
<IndexLink to='/' activeClassName={classes.activeRoute}> | ||
Home | ||
</IndexLink> | ||
{' · '} | ||
<Link to='/counter' activeClassName={classes.activeRoute}> | ||
Counter | ||
</Link> | ||
</div> | ||
) | ||
|
||
export default Header |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.activeRoute { | ||
font-weight: bold; | ||
text-decoration: underline; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import Header from './Header' | ||
|
||
export default Header |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Woah, never seen this before.