Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Managing third party libraries (not node modules) with nodejs?

I'm using package.json file to define nodejs requirements, along with npm update, and of course is working fine.

How can I manage (update the easy way) other third party libraries with node? For example:

https://github.com/documentcloud/backbone.git
https://github.com/twitter/bootstrap.git

In vendor folder.

like image 756
gremo Avatar asked Sep 07 '12 19:09

gremo


People also ask

What are the third party libraries in Nodejs?

Some of the best third party module examples are listed as follows: express, gulp, lodash, async, socket.io, mongoose, underscore, pm2, bower, q, debug, react, mocha etc. Third party modules can be install inside the project folder or globally.

When node JS is not recommended?

js receives a CPU bound task: Whenever a heavy request comes to the event loop, Node. js would set all the CPU available to process it first, and then answer other requests queued. That results in slow processing and overall delay in the event loop, which is why Node. js is not recommended for heavy computation.

What is the difference between core modules and third party modules?

Core module: Modules that come shipped with Node. js , e.g. https , os , fs , net , etc. Third-party module: Modules that you install from any package manager.

Is node js a third party module?

Nodejs Third Party Modules:Modules that are available online and are installed using the npm are called third party modules. Examples of third party modules are express, mongoose, etc. To install third party modules refer to the previous blog where we have discussed how to install modules using npm.


2 Answers

Summary: I think you want to use http://twitter.github.com/bower/

Details: There are two ways to understand your question:

  • how to manage/update non-npm code?
  • how to manage/update client-side javascript assets?

The question is worded as the former, but from your included examples I think what you want to ask the latter.

In case of server-side code, just insist all code gets shipped with npm-style package.json manifest. If the author of the code is unresponsive, fork it and add the manifest. There is no excuse.

For client-side code, the situation is different. There is no established standard for package management, however it's a widely recognized problem and very active field of development. Several challengers have risen recently, trying to grab the dominant position: BPM, Jam or Ender. It's your call which to pick, they are well summarized here: A package manager for web assets

However, all of the above address a slightly too ambitious problem - they try to sort out the transport of those modules to the browser (via lazy loading, require-js style, dependency resolution, concatenation/minification etc.) This also makes them more difficult to use.

A new entrant to the field is Bower from Twitter. It focuses just on download/update lifecycle in your vendor folder and ignores the browser delivery. I like that approach. You should check it out.

like image 194
zzen Avatar answered Oct 04 '22 10:10

zzen


You could go for git submodules:

http://git-scm.com/book/en/Git-Tools-Submodules

Using someone else's repo as a Git Submodule on GitHub

[UPDATE 1] Do this at the root of your repository:

git submodule add git://github.com/documentcloud/backbone.git vendors/backbone
git submodule add git://github.com/twitter/bootstrap.git vendors/bootstrap

Check this for more: http://skyl.org/log/post/skyl/2009/11/nested-git-repositories-with-github-using-submodule-in-three-minutes/

like image 30
2 revs Avatar answered Oct 04 '22 09:10

2 revs