Node utility to list symlinks made by npm link
, yarn link
, or fs.link
npm install symlinked
Local install as above is best practice if you are using in a shared codebase because then all developers will use the same version. CLI can be used locally via npx or via npm scripts. npm install
has a --global
flag you can add if you prefer global use. Yarn can be used via yarn add
and yarn global add
respectively if you prefer yarn.
Usage: symlinked <command> [<path>]
Finds all linked package names of an npm package.
Commands:
names Get linked package names
paths Get linked package paths
roots Get linked package roots
links Get linked package links
Options:
-h, --help Display this usage info
# Link some packages for example npm link @songkick/promise-retry npm link eol $ symlinked names @songkick/promise-retry eol $ symlinked paths /Users/doe/project/node_modules/@songkick/promise-retry /Users/doe/project/node_modules/eol $ symlinked roots /Users/doe/project/node_modules/@songkick/promise-retry/node_modules /Users/doe/project/node_modules/eol/node_modules $ symlinked links /usr/local/lib/node_modules/@songkick/promise-retry /usr/local/lib/node_modules/eol
const symlinked = require("symlinked")
symlinked.names(dir: ".")
get array of linked package namessymlinked.paths(dir: ".")
get array of linked package pathssymlinked.roots(dir: ".")
get array of linked package rootssymlinked.links(dir: ".")
get array of linked package linkssymlinked.is(path)
test if path exists and is linkedsymlinked.read(path)
read link
symlinked.names()
// [ 'said' ]
symlinked.paths()
// [ '/Users/jdoe/symlinked/node_modules/said' ]
symlinked.roots()
// [ '/Users/jdoe/symlinked/node_modules/said/node_modules' ]
symlinked.links()
// [ '/Users/said' ]
resolve.modules
configuration to resolve dependencies of linked dependencies
module.exports = {
resolve: {
modules: ["node_modules"].concat(symlinked.roots())
}
}