npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gulp-dependency-install

v0.0.8

Published

This gulp plugin provides a simple API to install dependencies in multiple nested package.json files. It also allows to define custom local dependencies inside package.json

Downloads

1,093

Readme

gulp-dependency-install

Join the chat at https://gitter.im/99xt/gulp-dependency-install npm version license

This gulp plugin provides a simple API to install dependencies in multiple nested package.json files. It also allows to define custom local dependencies inside package.json.

Installation

To include gulp-dependency-install in your project use npm install gulp-dependency-install --save

Usage

With directory path argument

Edit your gulpfile.js and include the following (If gulpfile.js not exits, create a new gulpfile.js in the project root).

var gulp = require('gulp');
var gulpDi = require('gulp-dependency-install');

gulp.task('npm-install', function () {
	return gulpDi.install();
});

Open a shell/commandline and run the followig command gulp npm-install --dir <your-directory> Note: This executes npm install for all the nested package.json files inside '' path.

With directory path variables

var gulp = require('gulp');
var gulpDi = require('gulp-dependency-install');

gulp.task('npm-install', function () {
	return gulpDi.install(['<your-directory>']);
});

Open a shell/commandline and run the followig command gulp npm-install Note: You can also include multiple directories inside the array.

Custom dependencies

What if you need to share code, but don't wish to publish packages in NPM Registry? You can use the Custom Dependencies feature.

  1. Create a directory(e.g 'your_local_dependencies') in your codebase to store each local dependency(library) code. Create directories for each of the dependencies with a index.js inside, as shown below.

    __/your_local_dependencies
        |__dependency-a
            |__index.js
        |__dependency-b
            |__index.js   
            |__package.json // Optional if you have other npm dependencies

    e.g of index.js inside dependency-a

    var sayHello = function() {
        console.log("hello");
    };
    module.exports.sayHello = sayHello;
  2. Open a package.json file in your code base which depends on a local dependency (lets say 'dependency-a' and 'dependency-b') and include the section 'customDependencies', as shown below.

    {
        "dependencies": {},
        "customDependencies": {
            "dependency-a" : "local",
            "dependency-b" : "local"
        }
    }
  3. Initialize the custom dependency path for the library, as shown below.

    var gulp = require('gulp');
    var gulpDi = require('gulp-dependency-install');
    
    gulp.task('npm-install', function () {
        gulpDi.init('<your_local_dependencies-directory>'); // Optionally initialize the directory where custom dependencies resides
        return gulpDi.install(['<your-directory>']);
    });

    Open a shell/commandline and run the followig command gulp npm-install

    Note: This executes 'npm install' for all the package.json files, installing NPM dependencies from NPM Registry and copying the custom dependencies from 'your_local_dependencies' directory to the respective 'node_modules' directory..

  4. Finally in your code requrie the dependency similar in using a module from NPM Registry, as shown below.

    var dependencyA = require('dependency-a');
    dependencyA.sayHello(); // Prints "Hello"

License

MIT