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

@randy.tarampi/install-dependencies

v0.1.6

Published

Builds node modules to a spectified path 📦

Downloads

7

Readme

@monorepo-utilities/install-dependencies 🧱 📦

Typed with TypeScript npm version

Installs dependencies from a config to a destination with control!


Install

pnpm install @monorepo-utilities/build-node-modules

Usage

As a CLI

install-dependencies run <config> <dest>
# => installs packages (node_modules) from a config (like package.json) to a specified path

As a function

import { installDependencies } from '@monorepo-utilities/install-dependencies'

const dependencies = installDependencies({ <config>, <dest> })
// => installs dependencies from a package.json (<config>) to the specified destination (<dest>)
// => returns an object with installedDependencies, config, dest

CLI API

  Usage
    $ install-dependencies <command> [options]

  Available Commands
    run    installs a package.json's dependencies to a specificied path

  For more info, run any command with the `--help` flag
    $ install-dependencies run --help

  Options
    -v, --version    Displays current version
    -h, --help       Displays this message

Arguments

  • <config>: a string path to a config file (a package.json file)
  • <path>: a string path to the desired destination of the installed dependencies

Added Specificity Options

Within a config (package.json) an installDepedencies object can optionally be added. It can optionally include an ignore array or an include object.

"installDependencies": {
    "include": {
      "react": "17.0.1",
      "@babel/core": "7.12.10",
      "typescript": "4.1.2",
      "@foo/bar": "@latest"
    },
    "ignore": [
      "ramda"
    ]
  }

Why

When using various project managers for monorepos, like yarn workspaces and lerna, there are drawbacks in the Developer Experience (DX) versus Deployment Experience of module installation.

By manually providing a way to specifically install packages (node_modules) to a specified location, developors can enjoy module hoisting and local package referencing and not have to worry about what's in node_modules folders when deploying un-bundled node apps.

Benefits

Listed below are a few benefits to using install-dependencies.

  • Developer Experience (DX)
  • Build deploys sizes
  • Build deploys build times
  • Deployment package security
  • Deployment package debugging
  • Deployment package versions

Use Case

Consider the following paragraphs to decide whether install-dependencies can assist your project!

Deployment Node App Woos

Deploying a node app with it's corresponding node_modules produces a large build artifact! Now imagine a monorepo which has multiple node apps and uses yarn workspaces. Yarn Workspaces greatly helps with developer experience by hoisting node_modules making package install times faster and linking local packages automatically.

However, when building a build artifact for deployment, those same gains from Yarn Workspace Hoisting will product a large node_module directory! On top of that, an extra build step may be required for including local package dependencies ("@foo/bar": "file:../packages/bar/dist").

The results of the scenerio described above are build artifacts that are too big to be deployed and long cumbersome build times while waiting for a node app's local dependencies to build. Furthermore, dependencies specified in the node app's package.json's dependencies may be a different version based on hoisting.

install-dependencies to the rescue! By using install-dependencies, we can specify exactly what dependencies must be installed!

How install-dependencies helps

Here's a short list of how install-dependencies helps!

  • install-dependencies installs all dependencies specific to a config (a package.json)'s dependencies.
  • install-dependencies will optionally ignore dependencies specified in a config (a package.json)'s installDependencies.ignore array.
  • install-dependencies will optionally override dependencies or add dependencies specified in a config (a package.json)'s installDependencies.include object.

Here's an example config (package.json) with the installDependencies object included:

"dependencies": {
  "@foo/bar": "file:..packages/bar/dist",
    "ramda": "0.27.1",
    "typescript": "4.1.3",
    "ink": "^3.0.8",
  },
  "installDependencies": {
    "include": {
      "react": "17.0.1",
      "@babel/core": "7.12.10",
      "typescript": "4.1.2",
      "@foo/bar": "@latest"
    },
    "ignore": [
      "ramda"
    ]
  }

The resulting node_modules directory will include:

// note: NO ramda!
@babel/[email protected]
@foo/[email protected] // note: example which equals the latest version of @foo/bar
ink@^3.0.8
[email protected]
[email protected] // note: NOT 4.1.3

Roadmap

Here are a few features that will be added momentarily:

  • a tested config that is not a package.json
  • the option to add devDependencies
  • the option to add peerDependencies
  • potentially more flags to improve the build time/size
  • a white goat with one horn that is mistaken for a unicorn constantly 🦄

Thanks

Monorepo Utilities 🧱

Utilities for monorepo development.

Javascript utilities for better monorepo results.


View other monorepo utilities.