Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Good article. I think one area where it could be improved slightly is to specify which type of use case the recommendation is appropriate for:

1. Node as a scripting language

2. Node + Express or Hapi or whatever as a web development framework

The recommendations in this article work well if you're targeting Node as a scripting language.

However, if you are developing using a web framework, then some of the recommendations are too lean (IMO).

1. npm init

When I'm developing for the web, I use a more robust application skeleton. There are a ton to choose from. However, I do use npm init when developing scripts. My guess is the author's point is something like, "good Node devs include a package.json".

2. Declare all dependencies

Absolutely. Works for both web and scripts.

3. Specify a start script

Yes, for scripts.

However for the web task runners such as Grunt / Gulp / etc. work better. For web dev starting the server is just one task of many. For example, if you need to start the server after checking the environment, watch for file changes, run jslint/jshint, and so on then a task runner makes web development easier.

4. Specify a test script

Yes!

5. Keep dependencies out of source control

Yes, but use npm-shrinkwrap because the code you deploy (your code + deps) should be the exact same code that you ran during testing.

6. Use environment variables to configure npm

Absolutely. Config files are another option, but this is a matter of personal preference. The authors point is totally valid.

7. Bring your own npm registry

This is an interesting one and one where there is no clear "best choice" yet. It'll be interesting to see how npm (public and private) evolve.

8. Keep track of outdated dependencies

Yup

9. Use npm scripts to run custom build steps

This is now being debated. There are some in the community who specifically prevent pre/post scripts from running automatically when installing via npm.

10. Try new things

Debatable (at this time). These new features can also go onto the todo list in the near future. If someone is new to node, they may be better served by focusing on what node / JS does now.

11. Browserify

Depends. If you're using Angular, then it has its own module system. I think Ember has its own module system as well.

require.js is another option. But the author's point about having client-side modules is totally valid.

Again, nice article.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: