Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ryanve/symlinked
Got symlinked packages?
https://github.com/ryanve/symlinked
nodejs npm-link symlinks yarn-link
Last synced: 15 days ago
JSON representation
Got symlinked packages?
- Host: GitHub
- URL: https://github.com/ryanve/symlinked
- Owner: ryanve
- License: isc
- Created: 2017-05-03T17:04:03.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-10-25T15:54:55.000Z (about 3 years ago)
- Last Synced: 2024-10-14T04:23:18.534Z (30 days ago)
- Topics: nodejs, npm-link, symlinks, yarn-link
- Language: JavaScript
- Homepage: https://ryanve.dev/symlinked/
- Size: 31.3 KB
- Stars: 8
- Watchers: 3
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# symlinked
Node utility to list symlinks made by [`npm link`](https://docs.npmjs.com/cli/link), [`yarn link`](https://yarnpkg.com/lang/en/docs/cli/link/), or [`fs.link`](https://nodejs.org/api/fs.html)## Install
```
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.
## CLI
```
Usage: symlinked []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 linksOptions:
-h, --help Display this usage info
```### CLI example
# 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## API
### `require`
```js
const symlinked = require("symlinked")
```### Methods
- `symlinked.names(dir: ".")` get array of linked package names
- `symlinked.paths(dir: ".")` get array of linked package paths
- `symlinked.roots(dir: ".")` get array of linked package roots
- `symlinked.links(dir: ".")` get array of linked package links
- `symlinked.is(path)` test if path exists and is linked
- `symlinked.read(path)` read link### Examples
#### Ran in package directory with `said` dependency linked on both ends
```js
symlinked.names()
// [ 'said' ]
``````js
symlinked.paths()
// [ '/Users/jdoe/symlinked/node_modules/said' ]
``````js
symlinked.roots()
// [ '/Users/jdoe/symlinked/node_modules/said/node_modules' ]
``````js
symlinked.links()
// [ '/Users/said' ]
```## Webpack
### [`resolve.modules`](https://webpack.js.org/configuration/resolve/#resolve-modules) configuration to resolve dependencies of linked dependencies```js
module.exports = {
resolve: {
modules: ["node_modules"].concat(symlinked.roots())
}
}
```