4 ms·
I've been building projects with Node.js (+ using npm), and here are my two cents: - One of the best changes to npm was to install modules locally instead of g
by jeromegn 14y ago
I've been building projects with Node.js (+ using npm), and here are my two cents:
- One of the best changes to npm was to install modules locally instead of globally by default. I wish jam also did that, global installs are troublesome.
- Isn't package.json going to conflict with my npm's package.json? I definitely don't want to polute my back-end's packages with front-end only stuff.
Basically, I'd like more sensible defaults. Change the package.json to some other filename and install packages locally by default. I'm also unsure why it would put files inside /jam, I don't want to change my configuration to use some obscur and badly named "jam" folder. I believe people like the vendor/javascript or public/javascripts conventions, that would be a better default in my opinion.
Otherwise, I like the initiative. In the past we've been using Jim (https://github.com/quirkey/jim https://github.com/quirkey/jim) which works more like bundler. Now we just do it manually for lack of a better solution. I don't think this is it yet, but it's close.
- caolanm 14y agoDependencies are installed locally to your project, but not for each package individually, if that makes sense. On the client-side you really don't want to be shipping 5 versions of jQuery! - I agree that it's an awesome way to do things for Node.js, but it just doesn't translate well to the browser. As for package.json, yes there may occasionally be conflicts with NPM, but in many cases they should be compatible since they are based on the same spec. Perhaps allowing you to override with "jam.json" would be a good idea for times when they would conflict?
- MatthewPhillips 14y agoWhy does your server code and your UI code share the same base directory?
- deleted 14y ago[deleted]
- lipponlabang 14y agoWell surely any two files in any file system shared a common base directory don't they? Either the root directory, or one further down the tree.
- prezjordan 14y agoWhat exactly is wrong with that? In Rails, you have app/controllers and app/views. UI code and server code sharing the same base directory.
- bendemott 14y agoDoes seem potentially problematic if you don't want to be exposing server-logic. Especially when the developer may not know what software will be ultimately serving the static files over http.
- prezjordan 14y agoAs a newbie webdev, what would you suggest? Making an API-based web application? (the backend would serve and receive JSON and the front-end would simply play around with it) Or am I completely misunderstanding this.
- MatthewPhillips 14y agoThat's a reasonable way to build an application, and one that I personally prefer, but there isn't a silver bullet. But if you're building a Node app your server js and your client js don't need to commingle. Make a src/js/client directory, and stick your package.json in there (if you want to use this tool).
- NinetyNine 14y agoSocketstream is a framework in active development based on exactly that idea.
- MatthewPhillips 14y agoThe grandparent was talking about Node, which doesn't tell you how to organize directories like Rails.