Commit a51858b13e497beda1e5deb1c48381c361a0ccfa
slpash
Michael Williams committed on 11/27/2015, 11:46:08 AMParent: 881e0db0626731290a9e89886bd428bf34791416
Files changed
package.json | changed |
.gitignore | added |
app/api.js | added |
app/client.js | added |
app/package.json | added |
app/server.js | added |
app/services/index.js | added |
app/services/static.js | added |
feature/index.js | added |
feature/steps.js | added |
package.json | ||
---|---|---|
@@ -3,9 +3,18 @@ | ||
3 | 3 | "version": "0.0.0", |
4 | 4 | "description": "production-quality TodoMVC example", |
5 | 5 | "main": "index.js", |
6 | 6 | "scripts": { |
7 | - "test": "ava" | |
7 | + "lint": "snazzy", | |
8 | + "format": "snazzy --format", | |
9 | + "test": "(npm run spec & npm run feature)", | |
10 | + "spec": "node spec", | |
11 | + "feature": "node feature", | |
12 | + "dev-server": "nodemon app/server", | |
13 | + "prod-server": "node app/server", | |
14 | + "dev-client": "budo app/client.js -d --serve bundle.js --live", | |
15 | + "prod-client": "browserify app/client.js -o bundle.js -g uglifyify" | |
16 | + | |
8 | 17 | }, |
9 | 18 | "repository": { |
10 | 19 | "type": "git", |
11 | 20 | "url": "git+https://github.com/ahdinosaur/craftworks-todomvc.git" |
@@ -22,11 +31,20 @@ | ||
22 | 31 | "feathers", |
23 | 32 | "ddd", |
24 | 33 | "tcomb" |
25 | 34 | ], |
26 | - "author": "Mikey <michael.williams@enspiral.com> (http://dinosaur.os)", | |
35 | + "author": "Mikey <michael.williams@enspiral.com> (http://dinosaur.is)", | |
27 | 36 | "license": "ISC", |
28 | 37 | "bugs": { |
29 | 38 | "url": "https://github.com/ahdinosaur/craftworks-todomvc/issues" |
30 | 39 | }, |
31 | - "homepage": "https://github.com/ahdinosaur/craftworks-todomvc#readme" | |
40 | + "homepage": "https://github.com/ahdinosaur/craftworks-todomvc#readme", | |
41 | + "devDependencies": { | |
42 | + "cuke-tap": "^1.0.2", | |
43 | + "jsdom": "^7.1.0", | |
44 | + "nodemon": "^1.8.1", | |
45 | + "tape": "^4.2.2" | |
46 | + }, | |
47 | + "dependencies": { | |
48 | + "ramda": "^0.18.0" | |
49 | + } | |
32 | 50 | } |
app/api.js |
---|
app/client.js | ||
---|---|---|
@@ -1,0 +1,26 @@ | ||
1 | +const React = require('react') | |
2 | +const { render } = require('react-dom') | |
3 | +const { createStore, applyMiddleware } = require('redux') | |
4 | +const { Provider } = require('react-redux') | |
5 | +const logger = require('redux-logger') | |
6 | +const thunk = require('redux-thunk') | |
7 | + | |
8 | +const reducer = require('./reducers') | |
9 | +const { getAllTodos } = require('./actions') | |
10 | +const App = require('./containers/App') | |
11 | + | |
12 | +const middleware = process.env.NODE_ENV === 'production' ? | |
13 | + [ thunk ] : | |
14 | + [ thunk, logger() ] | |
15 | + | |
16 | +const createStoreWithMiddleware = applyMiddleware(...middleware)(createStore) | |
17 | +const store = createStoreWithMiddleware(reducer) | |
18 | + | |
19 | +store.dispatch(getAllTodos()) | |
20 | + | |
21 | +render( | |
22 | + <Provider store={store}> | |
23 | + <App /> | |
24 | + </Provider>, | |
25 | + document.getElementById('root') | |
26 | +) |
app/server.js | ||
---|---|---|
@@ -1,0 +1,5 @@ | ||
1 | +const feathers = require('feathers') | |
2 | + | |
3 | +const { createServices } = require('./services') | |
4 | + | |
5 | +createServices() |
app/services/index.js | ||
---|---|---|
@@ -1,0 +1,7 @@ | ||
1 | +var fs = require('fs') | |
2 | +var { filter } = require('rambda') | |
3 | + | |
4 | +filter( | |
5 | + fs.readdirSync(__dirname), | |
6 | + (name) => name.endsWith('index.js') | |
7 | +) |
app/services/static.js | ||
---|---|---|
@@ -1,0 +1,5 @@ | ||
1 | +const serveStatic = require('serve-static') | |
2 | + | |
3 | +function createStaticService (config) { | |
4 | + return serveStatic(config.root, config) | |
5 | +} |
feature/index.js | ||
---|---|---|
@@ -1,0 +1,7 @@ | ||
1 | +const cuke = require('cuke-tap') | |
2 | +const path = require('path') | |
3 | + | |
4 | +const features = [ path.join(__dirname, '/feature.feature') ] | |
5 | +const steps = [ require('./steps') ] | |
6 | + | |
7 | +cuke(features, steps) |
feature/steps.js | ||
---|---|---|
@@ -1,0 +1,11 @@ | ||
1 | +const test = require('cuke-tap') | |
2 | +const jsdom = require('jsdom') | |
3 | + | |
4 | +test.given(/^I am on the landing page$/, (t, world, params) => { | |
5 | + t.plan(1) | |
6 | + jsdom.env('http://localhost:9966', (err, window) => { | |
7 | + t.error(err) | |
8 | + world.window = window | |
9 | + t.pass('done') | |
10 | + }) | |
11 | +}) |
Built with git-ssb-web