npm-link-extra

4.0.3 • Public • Published

npm-link-extra


Some useful things we wish npm/yarn link had. Inspired by fs-extra...

One issue currently is the inconsistency between npm's link behavior between the major versions. We have found link to be most stable with version 3.10.10 so that is our recommended npm version.

Install

$ npm install npm-link-extra --save-dev

CLI Docs

Usage
  $ nlx <path> -<cmd> --<options>
  $ npx nlx <path> -<cmd> --<options>
Commands
  -h, --help        show help menu
  -l, --link        link all dirs if present in dependencies
  -u, --unlink      unlink all linked dependencies
  -s, --show        show all shared and/or linked dependencies
  -v, --version     get npm-link-extra package version
Options
  -d, --dir         relative path to mononrepo/dir with many modules
  --linked-only     only select currently linked packages
  --shared-only     only select shared dependencies between project and target dir

Documentation

Table of Contents

getDirectories

getDirectories returns all directories in a given path

Parameters
  • pathTo String relative path to monorepo or directory with node modules
  • opts Object options to call the function with

Returns Array array of directories

getPackages

getPackages returs all packages

Parameters
  • dirs Array array of directories

Returns Array array of packages & the relative path to them

getSharedDepDirs

getSharedDepDirs selects an array of shared and linked packages

Parameters
  • pkgs Array An array of dependencies
  • hash Object A hash map of our deps

Returns Array A filtered list of shared pkg dirs

getSharedLinked

getSharedLinked selects an array of shared and linked packages

Parameters
  • pkgs Array An array of dependencies
  • hash Object A hash map of our deps

Returns Array A filtered list of packages

getSharedDeps

getSharedDeps will show any shared dependencies between project & target dir

Parameters
  • pkgs Array An array of dependencies
  • hash Object A hash map of our deps

Returns Array Array of shared dep names

getLinkedDeps

getLinkedDeps returns a list of linked dependencies

Parameters
  • pkgs Array An array of dependencies

Returns Array Array of linked dep names

Package Sidebar

Install

npm i npm-link-extra

Weekly Downloads

61

Version

4.0.3

License

MIT

Unpacked Size

23.2 kB

Total Files

8

Last publish

Collaborators

  • davidedaniel