Skip to content

Commit

Permalink
fix dependecies levels, fix gitingore, fix production build
Browse files Browse the repository at this point in the history
  • Loading branch information
gridsane committed Mar 14, 2016
1 parent 7f9d295 commit e13577f
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 31 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
node_modules/
assets/
build/
/assets/
/build/
.env
29 changes: 15 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,22 @@
"lint": "eslint src test"
},
"engines": {
"node": "4.2.1"
"node": "4.2.1",
"npm": "2.14.17"
},
"dependencies": {
"babel": "^6.3.26",
"babel-cli": "^6.4.0",
"babel-core": "^6.4.0",
"babel-loader": "^6.2.1",
"babel-plugin-add-module-exports": "^0.1.2",
"babel-plugin-react-transform": "^2.0.0",
"babel-polyfill": "^6.2.0",
"babel-preset-es2015": "^6.3.13",
"babel-preset-react": "^6.3.13",
"babel-preset-stage-0": "^6.3.13",
"body-parser": "^1.14.1",
"brfs": "^1.4.3",
"express": "^4.13.3",
"mongodb": "^2.0.49",
"react": "^0.14.0",
Expand All @@ -36,20 +47,12 @@
"redux-persist": "^1.5.0",
"redux-thunk": "^1.0.0",
"superagent": "^1.4.0",
"superagent-jsonp": "0.0.6"
"superagent-jsonp": "0.0.6",
"transform-loader": "^0.2.3",
"webpack": "^1.12.2"
},
"devDependencies": {
"babel": "^6.3.26",
"babel-cli": "^6.4.0",
"babel-core": "^6.4.0",
"babel-eslint": "^5.0.0-beta6",
"babel-loader": "^6.2.1",
"babel-plugin-add-module-exports": "^0.1.2",
"babel-plugin-react-transform": "^2.0.0",
"babel-preset-es2015": "^6.3.13",
"babel-preset-react": "^6.3.13",
"babel-preset-stage-0": "^6.3.13",
"brfs": "^1.4.3",
"eslint": "^1.9.0",
"eslint-plugin-react": "^3.8.0",
"expect": "^1.13.0",
Expand All @@ -62,8 +65,6 @@
"react-transform-catch-errors": "^1.0.0",
"react-transform-hmr": "^1.0.1",
"redbox-react": "^1.1.1",
"transform-loader": "^0.2.3",
"webpack": "^1.12.2",
"webpack-dev-middleware": "^1.2.0",
"webpack-dev-server": "^1.12.1",
"webpack-hot-middleware": "^2.4.1"
Expand Down
3 changes: 3 additions & 0 deletions src/assets/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 23 additions & 11 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,32 @@ import fs from 'fs';

// @todo its a shameless plug. Find another way to store YOUTUBE_API when
// running locally
const dotEnvVars = fs.readFileSync('.env')
.toString()
.split("\n")
.reduce((p, str) => {
const [key, val] = str.split('=');
if (key) {
p[key] = val;
}
let dotEnvVars = null;

return p;
}, {});
function getVars() {
return fs.readFileSync('.env')
.toString()
.split("\n")
.reduce((p, str) => {
const [key, val] = str.split('=');
if (key) {
p[key] = val;
}

return p;
}, {});
}

function resolveVar(varName) {
return process.env[varName] || dotEnvVars[varName];
if (process.env[varName]) {
return process.env[varName];
}

if (!dotEnvVars) {
dotEnvVars = getVars();
}

return dotEnvVars[varName];
}

export const MONGO_URI = resolveVar('MONGO_URI');
Expand Down
8 changes: 4 additions & 4 deletions webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@ module.exports = {
loaders: [
{
test: /\.js$/,
loaders: ['babel-loader'],
include: path.join(__dirname, 'src'),
loader: 'transform?brfs',
},
{
test: /\.svg$/,
loader: 'svg-inline-loader',
test: /\.js$/,
loaders: ['babel-loader'],
include: path.join(__dirname, 'src'),
},
],
},
Expand Down

0 comments on commit e13577f

Please sign in to comment.