git ssb

1+

dinoworm ๐Ÿ› / catstack



Commit dd64a0d510ecc727cffa7698d15154b14189b73c

empty

Michael Williams committed on 11/27/2015, 11:46:16 AM
Parent: a51858b13e497beda1e5deb1c48381c361a0ccfa

Files changed

app/server.jschanged
app/services/index.jschanged
app/services/static.jschanged
package.jsonchanged
.babelrcadded
client.jsadded
server.jsadded
spec/index.jsadded
app/server.jsView
@@ -1,5 +1,11 @@
11 const feathers = require('feathers')
2+const { mapObj, reduce } = require('ramda')
23
3-const { createServices } = require('./services')
4+const createServices = require('./services')
45
5-createServices()
6+function start (config) {
7+ const services = mapObj(
8+ (serviceCreator, name) => serveCreator(config[name]),
9+ serviceCreators
10+ )
11+}
app/services/index.jsView
@@ -1,7 +1,23 @@
1-var fs = require('fs')
2-var { filter } = require('rambda')
1+const fs = require('fs')
2+const { map, filter, invoker, zip } = require('ramda')
3+const { join, basename } = require('path')
34
4-filter(
5- fs.readdirSync(__dirname),
6- (name) => name.endsWith('index.js')
5+const serviceCreatorNames = filter(
6+ (name) => name !== 'index',
7+ map(
8+ basename,
9+ fs.readdirSync(__dirname)
10+ )
711 )
12+
13+const serviceCreators = zip(
14+ serviceCreatorNames,
15+ map(
16+ (name) => {
17+ require(join(__dirname, name))
18+ },
19+ serviceCreatorNames
20+ )
21+)
22+
23+module.exports = serviceCreators
app/services/static.jsView
@@ -1,5 +1,7 @@
11 const serveStatic = require('serve-static')
22
3+module.exports = createStaticService
4+
35 function createStaticService (config) {
46 return serveStatic(config.root, config)
57 }
package.jsonView
@@ -8,13 +8,12 @@
88 "format": "snazzy --format",
99 "test": "(npm run spec & npm run feature)",
1010 "spec": "node spec",
1111 "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-
12+ "dev-server": "nodemon server",
13+ "prod-server": "node server",
14+ "dev-client": "budo client -d --serve bundle.js --live",
15+ "prod-client": "browserify client -o bundle.js -g uglifyify"
1716 },
1817 "repository": {
1918 "type": "git",
2019 "url": "git+https://github.com/ahdinosaur/craftworks-todomvc.git"
@@ -44,7 +43,12 @@
4443 "nodemon": "^1.8.1",
4544 "tape": "^4.2.2"
4645 },
4746 "dependencies": {
47+ "babel-core": "^6.2.1",
48+ "babel-plugin-transform-object-rest-spread": "^6.1.18",
49+ "babel-preset-es2015": "^6.1.18",
50+ "babel-preset-react": "^6.1.18",
51+ "feathers": "^1.2.0",
4852 "ramda": "^0.18.0"
4953 }
5054 }
.babelrcView
@@ -1,0 +1,9 @@
1+{
2+ "presets": [
3+ "es2015",
4+ "react"
5+ ],
6+ "plugins": [
7+ "transform-object-rest-spread"
8+ ]
9+}
client.jsView
@@ -1,0 +1,1 @@
1+require('./app/client')
server.jsView
@@ -1,0 +1,2 @@
1+require('babel-core/register')
2+require('./app/server')
spec/index.jsView

Built with git-ssb-web