Skip to content

Commit

Permalink
feat(configuration): Use example configuration in development mode by…
Browse files Browse the repository at this point in the history
… default.
  • Loading branch information
trevorgerhardt committed Mar 29, 2017
1 parent 8eec8e4 commit 6afc856
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 36 deletions.
1 change: 1 addition & 0 deletions client/filter-view/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@

.ExpandedSettings select {
margin: 0 4px;
color: var(--font-color);
}

.ExpandedSettings-typeIcon {
Expand Down
10 changes: 9 additions & 1 deletion configurations/example/messages.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
announcements:
next: Next

feedback-modal:
title: Tell us what you think!
placeholder: Is this a good or bad option?

options-view:
feedback-text: Results not accurate?
feedback-link-text: Help us improve!

plan:
update-routes:
invalid-coordinates: Invalid Coordinates.
Expand All @@ -26,4 +34,4 @@ welcome-flow:
carpool: I **carpool**
bike: I **bike**
transit: I take public **transit**
walk: I **walk**
walk: I **walk**
38 changes: 9 additions & 29 deletions configurations/example/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: Modeify
domain: modeify.co

entries:
- client/planner-app/index.js:assets/build/planner-app/build.js
- client/planner-app/style.css:assets/build/planner-app/build.css
- client/manager-app/index.js:assets/build/manager-app/build.js
- client/manager-app/style.css:assets/build/manager-app/build.css
- client/planner-app/index.js:build/planner-app/build.js
- client/planner-app/style.css:build/planner-app/build.css
- client/manager-app/index.js:build/manager-app/build.js
- client/manager-app/style.css:build/manager-app/build.css

announcements:

Expand Down Expand Up @@ -38,36 +38,16 @@ base_url: http://localhost:5000
google_site_verification:

mapbox_access_token:
mapbox_map_id:
mapbox_base_style:
mapbox_label_style:
mapbox_base_style_manager:

mapzen:
search:
api_key:

otp:
host: localhost
path: /otp/routers/default
port: 8080
r5:
url:
s3_bucket: ''
segmentio_key: ''
static_url: /assets

# Custom Environments
environments:

# For running tests
test:

# Default & development
development:

# Staging / QA / Production
production:
base_url:
opsworks:
otp_app_id:
otp_layer_id:
stack_id:
s3_bucket:
segmentio_key:
static_url:
17 changes: 15 additions & 2 deletions lib/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,19 @@ const app = module.exports = express()
app.set('view engine', 'jade')

if (config.env === 'development') {
const build = require('mastarm/lib/build')
const loadConfig = require('mastarm/lib/load-config')
const util = require('mastarm/lib/util')

const config = loadConfig(process.cwd(), 'configurations/example', 'development')
build({
config,
files: util.parseEntries(config.settings.entries),
watch: true
})
.then(() => console.log('JavaScript & CSS built..'))
.catch((err) => console.error('Error building JavaScript & CSS...', err))

app
.use(require('errorhandler')())
.use('/build', require('serve-static')(path.join(__dirname, '/../build')))
Expand Down Expand Up @@ -95,9 +108,9 @@ function setLocals (req, res, next) {
res.locals.application = config.application
res.locals.applicationName = config.name
res.locals.google_site_verification = config.google_site_verification
res.locals.minified = process.env.NODE_ENV !== 'development'
res.locals.minified = config.env !== 'development'
res.locals.segmentio_key = config.segmentio_key
res.locals.static_url = process.env.NODE_ENV !== 'development' ? config.static_url : ''
res.locals.static_url = config.env !== 'development' ? config.static_url : ''
res.locals.version = version
next()
}
6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"lonlng": "0.2.0",
"mandrill-api": "^1.0.45",
"mapbox": "^1.0.0-beta6",
"mastarm": "^3.2.1",
"moment": "^2.13.0",
"moment-timezone": "^0.5.11",
"mongoose": "^4.5.0",
Expand Down Expand Up @@ -111,7 +112,6 @@
"leaflet.markercluster": "^1.0.3",
"mapbox.js": "^3.0.1",
"markdown-it": "^8.0.0",
"mastarm": "^3.2.1",
"mime": "^1.3.4",
"mkdirp": "^0.5.1",
"mocha": "^3.0.2",
Expand All @@ -121,7 +121,6 @@
"nock": "^9.0.9",
"nodemon": "^1.9.2",
"normalize.css": "^5.0.0",
"npm-run-all": "^4.0.1",
"once-component": "0.0.1",
"otp-profile-score": "^0.6.3",
"otp-profile-to-transitive": "0.1.1",
Expand All @@ -148,9 +147,8 @@
"deploy": "mastarm deploy",
"lint": "mastarm lint \"client/**/*.js\" \"lib/**/*.js\"",
"push-config": "bin/push-config-to-heroku",
"server": "source bin/autoenv && nodemon --watch lib lib/server.js",
"prestart": "yarn",
"start": "npm-run-all --parallel server \"build -- --watch\"",
"start": "source bin/autoenv && nodemon --watch lib lib/server.js",
"test": "yarn run lint && mastarm test",
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
},
Expand Down

0 comments on commit 6afc856

Please sign in to comment.