Project Directory Structure?

I’m out of town this week and have limited access to internet, but I can see lots of good things are happening!

Looking at the new repo for WebUI-NODE, I’m having some trouble understanding the motivation behind the file naming scheme and directory structure. Could you please explain?

Also, I think its a good idea to leave the node_modules folder out of our repo.

(and same for “bin”, I think it’s generated files, no?)

If we move the start-file (bin/www) then I think yes.

The bin/www in it’s a generated file from NodeEclipse Express plugin, I keep it because it serve as single entry point: instead of lunching every Node module you can just run nodejs bin/www and all the node module are started. Plus all the ports used and the “most” of the require are centralized there. I think this is a good thing, but if there is same good practice that I’m missing we can set up the thing.

The philosophy behind the current project foldering is to give it some structure:

  • view: is supposed to keep GUI files
  • controllers: is supposed to keep server side module
  • public/scripts: should contains script that must be imported in the view files
  • routes: is for express routes modules

that’s all. Hoping this could make the project more understandable.

Any advice will be very appreciated.

Edit:

Yup, node_modules does not need to stand in the repo.

I think we can keep the bin/www (we can rename it) in the repo 'cause it can be used as single entry point.

Edit:
@ning-yu for the naming we are still discussing in the volumio 1.6 discussion thread

Yup, node_modules does not need to stand in the repo.

I think we can keep the bin/www (we can rename it) in the repo 'cause it can be used as single entry point.
[/quote]
Yep, think we can keep bin in the repo, as for the modules. I’ll remove them and add to gitignore…

Ok, I didn’t know node-eclipse generates this file, I’m a bit surprised to see source files in a “bin” folder, that’s not common.

That’s odd, we can move it without problems, but i like the idea to have one entry point only.

The WebUi files are supposed to go in view folder. Any suggestion on that?

The “node_modules” folder has been removed from the repo. When you next do a pull, it should delete the folder from your working tree.

To reinstall the needed Node modules, just navigate to your root directory “WebUI-NODE” and run “npm install”.

I think we should keep the node_modules (at least when we have them for Armv6). From my experience having them compiled, and stable among releases, avoids lots of problems.
If a module gets updated, and receives a new bug, we may have troubles identifying where the issue is.
Plus, if a module is not released as a binary, we need to compile it each time, installing tons of junk along with gcc and make…
What do you think?

Good news BTW,
I tried the WebUi on the new System built with script:
github.com/volumio/Build

And it works like a charm… See it coming together! :wink:

That’s very cool!

I’m okay with leaving node_modules in the repo if it helps with compatibility. Do you think there’s an alternative way, though, like listing specific module versions in ‘package.json’ so they don’t change?

Yes, that could be an idea!
I’ll paste soon a working image so we can work on the pi for it! And see real world performances (very good indeed, really better than php5-fpm!)

Is npm shrinkwrap what we’re looking for?

Great idea!