Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thlorenz/lnr
Recursively soft links all occurrences of a directory to another one.
https://github.com/thlorenz/lnr
Last synced: 2 months ago
JSON representation
Recursively soft links all occurrences of a directory to another one.
- Host: GitHub
- URL: https://github.com/thlorenz/lnr
- Owner: thlorenz
- License: mit
- Created: 2014-04-21T17:32:01.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-04-22T14:27:29.000Z (over 10 years ago)
- Last Synced: 2024-10-18T00:50:12.779Z (3 months ago)
- Language: JavaScript
- Homepage:
- Size: 191 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# lnr [![build status](https://secure.travis-ci.org/thlorenz/lnr.png)](http://travis-ci.org/thlorenz/lnr)
Recursively soft links all occurrences of a directory to another one.
```sh
lnr ../myapp-core core --filter package
```## When do I need this?
Let's say you have a `core` package that is used by lots of your dependencies, some nested deeply in your dependency
tree. Now you want to work on the `core` package and make sure that all of them link to the code you are working on.That's when you need this.
## Installation
npm install lnr
## Usage
```
lnr --Links all directories with name , found recursively from the current dir, to the .
If dirname is not supplied it defaults to the name of the directory being linked to.OPTIONS:
-l, --loglevel level at which to log: silly|verbose|info|warn|error|silent -- default: info
-f, --filter additional filters to apply to than just matching
currently existing filters are:
- package: matches if the directory contains an npm package, i.e. the parent
directory is node_modules
-h, --help Print this help message.EXAMPLES:
Link all directories with name mydir to the directory of the same name that is a sibling of my current working dir
lnr ../mydir mydirSame as above, but omitting the dirname since it is the same as the name of the directory being linked to
lnr ../mydir mydirLink all directories with name mydir to the directory of the same name that is a sibling of my current working dir and
an npm package and log verbose.
lnr ../mydir mydir --filter package -l verbose
```## API
lnr(root, dirname, linktoDir, opts, cb) → {Object}Starts at given
root
and recurses into all subdirectories.
Each directory found whose name matchesdirname
is linked tolinktoDir
.Parameters:
Name
Type
Description
root
string
directory at which to start searching
dirname
string
directory to link
linktoDir
string
destination directory to link to
opts
Object
options that allow customizing which directories are linked
Properties
Name
Type
Description
dirFilter
function
if provided only directories for which this
function returnstrue
are linked
cb
function
called back when all directories were linked
Returns:
event emitter that emits events about the linking progress
info|verbose|warn|error
Type
Object
lnr::package(p) → {boolean}A built in filter that returns
true
if the directory is considered an npm package.
This is determined by ensuring that the parent directory isnode_modules
Parameters:
Name
Type
Description
p
string
full path to the directory to test
- Source:
Returns:
true
if it is a package, otherwisefalse
Type
boolean*generated with [docme](https://github.com/thlorenz/docme)*
## License
MIT