Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/davibe/package-deps-cli

A cli tool to list package.json dependencies in <package>@<version> form
https://github.com/davibe/package-deps-cli

Last synced: about 2 months ago
JSON representation

A cli tool to list package.json dependencies in <package>@<version> form

Awesome Lists containing this project

README

        

README
------

A cli tool to list package.json dependencies in [package]@[version] form

Install
-------

npm install -g package-deps-cli

Usage example
-------------

$ package-deps-cli
yargs@^3.23.0

$ package-deps-cli --dev
yargs@^3.23.0
coffee-script@^1.9.3

Why
---

I deploy my node.js based applications using docker. This tool allows me to install
dependencies globally which would not be possible using npm. The result looks
like this

RUN npm install -g package-deps
ADD ./package.json /app/package.json
RUN cd /app; npm install -g $(package-deps-cli); npm link $(package-deps-cli)
ADD ./ /app
RUN cd /app; npm install

The benefit is that when you change your app/ source code (but not package.json)
docker will repeat the steps starting from "ADD ./ /app" but it will be very fast
as it will just link global packages.

Notes
-----

- Something similar can be achieved using 'npm-cache', but it's slower
- npm will never install dependencies globally afaik (see )