AmpersandJS / ampersand

Quickest way to get started with ampersand.
MIT License
812 stars 41 forks source link

"No config file found for development" in generated app #78

Closed A closed 9 years ago

A commented 9 years ago
$ npm start
# ...
No config file found for development
We couldnt find anything at: /Users/a8h333/Desktop/test/ampressand-test/development_config.json
development environment detected
# ...
$ echo $NODE_ENV
development

It's happens because of getconfig. dev_config.json is just file that named independently of NODE_ENV. But getconfig package triyng to load config for my NODE_ENV and of course it not exists.

wraithgar commented 9 years ago

it would appear that you have something locally setting NODE_ENV to development, that would mean a development_config.json file would need to exist.

By default getconfig will assume a NODE_ENV of 'dev' and that is why the generated app usually works out of the box. If you override NODE_ENV you will need to rename your config file accordingly. It is very literal, the names must match exactly.

A commented 9 years ago

But it's your error. Not my. Define NODE_ENV somewhere in .bashrc is ordinary practice for many nodejs developers. I think your cli should respect with it without errors.

A commented 9 years ago

I have tried to fix it, but the issue is not only related to ampersand. It's related to getconfig, too. I have no idea about right way to fix it to pull request. But also, I think, that generated app shouldn't throw errors with any NODE_ENV :(

HenrikJoreteg commented 9 years ago

Hi @shuvalov-anton.

I agree, this is a silly issue. You should be able to have NODE_ENV=development locally without it causing problems.

If you do npm i -g ampersand@2.0.5 the problem should be gone. getconfig now looks for various aliases for dev when trying to find a config.

Also, please note that we use getconfig here purely as a sample of how you might handle configs. It's certainly not required. The point is merely to have something that lets us build a sample app with a single boolean flag in the config that can be set to change the app from production mode to dev mode.

This is just scaffolding, we're just trying to show a starting point. Most of the effort on ampersand has all been poured into the modules themselves. I'm looking forward to being able to make the CLI more robust. It's on the roadmap: https://trello.com/c/Byj1dk6u/3-beef-up-the-ampersand-cli

Thanks for filing this, sorry for the frustration (saw this too: https://twitter.com/shuvalov_anton/status/537751721981014017 and https://twitter.com/shuvalov_anton/status/537749083654733824).

If you have further questions, we've got a pretty active chat channel here: https://gitter.im/AmpersandJS/AmpersandJS

A commented 9 years ago

What do you think about simple and robust backend app without any unnecessary dependencies (like express or koa scaffolds)? I can help you with it. I disagree with some code conventions, but it doesn't matter, because I have written many backbone elements like in your ampersand. And if you would make code more simple to start using, that will be very helpful, and not only to me. Currently, I'm confused with many unrelated deps in the generated app, because I just want to explore the AmpersandJS and start working with it in my application. It will be cool if Ampersand being more friendly to use.

HenrikJoreteg commented 9 years ago

Completely agree. The more complete examples are useful for people who haven't built apps like these before but is too much cruft for more seasoned front end devs. You might also want to checkout the TodoMVC implementation: http://todomvc.com/examples/ampersand/

Anyway, yes, I've wanted to do a really simple app for a while.

Also, https://github.com/ampersandjs/examples is where I wany to start gathering a bunch of patterns, recipes, and examples.