https://github.com/jonathanj/emusym
Emulate symlinks (for node_modules)
https://github.com/jonathanj/emusym
Last synced: 2 months ago
JSON representation
Emulate symlinks (for node_modules)
- Host: GitHub
- URL: https://github.com/jonathanj/emusym
- Owner: jonathanj
- License: mit
- Created: 2021-06-08T12:04:12.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-09-01T15:11:43.000Z (almost 5 years ago)
- Last Synced: 2025-03-06T08:53:19.915Z (over 1 year ago)
- Language: TypeScript
- Size: 65.4 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
emusym: Emulate symlinks
========================
[](https://oclif.io)
[](https://npmjs.org/package/emusym)
[](https://npmjs.org/package/emusym)
[](https://github.com/jonathan/emusym/blob/master/package.json)
This tool emulates symlinks by watching source packages for changes, copying
changed distribution files (as seen in `npm pack`) into the destination
package's `node_modules`.
When doing local development on dependencies, `npm link` (or `yarn link`) is a
very convenient workflow tool. Unfortunately in some cases build tools do not
support symlinks in `node_modules`, most (in)famously [React Native's Metro bundler](https://github.com/facebook/metro/issues/1).
What this tool does _not_ do is create the changes to sync, that is left up to
each package to produce via the most suitable mechanism. Most build tools offer
something like a `--watch` flag that will incrementally build new output.
* [Usage](#usage)
* [Commands](#commands)
# Usage
```sh-session
## Install the tool as a dev dependency
$ yarn add -D emusym # Or `npm install --save-dev emusym` if using npm.
## Link a source package (`other-package`) to the current package.
$ yarn emusym link ../my/other-package
✔ success 📦 ../my/other-package → other-package
✔ success 🔗 other-package → .
## Start watching and syncing changes…
$ yarn emusym start
[other-package] › ℹ info ☔️ Preserving existing module
[other-package] › ℹ info Linking ../my/other-package → .
[other-package] › ▲ add:file package.json
[other-package] › ▲ add:dir src
[other-package] › ▲ add:file src/index.js
[other-package] › ● change:file src/index.js
[other-package] › ▲ add:file src/new.js
[other-package] › ● change:file src/new.js
[other-package] › ▼ del:file src/new.js
```
# Commands
* [`emusym help [COMMAND]`](#emusym-help-command)
* [`emusym link [PATH...]`](#emusym-link-path)
* [`emusym start`](#emusym-start)
## `emusym help [COMMAND]`
display help for emusym
```
USAGE
$ emusym help [COMMAND]
ARGUMENTS
COMMAND command to show help for
OPTIONS
--all see all commands in CLI
```
_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v3.2.2/src/commands/help.ts)_
## `emusym link [PATH...]`
Link a local package by path.
```
USAGE
$ emusym link [PATH...]
OPTIONS
--force Allow overwriting existing source links.
--scope=scope Add an npm scope to the destination package name.
DESCRIPTION
Multiple paths can be provided to link several packages in a single command.
EXAMPLES
$ emusym link /somewhere/else/my_thing
$ emusym link /somewhere/else/my_*
```
_See code: [src/commands/link.ts](https://github.com/jonathanj/emusym/blob/v0.1.1/src/commands/link.ts)_
## `emusym start`
Start watching and syncing linked packages.
```
USAGE
$ emusym start
DESCRIPTION
Packages previously linked with the 'link' command will be watched and changes
synced back to ./node_modules. Only pack files (npm pack) from the source
packages will be synced, meaning each package is responsible for producing its
own changes to be synced.
```
_See code: [src/commands/start.ts](https://github.com/jonathanj/emusym/blob/v0.1.1/src/commands/start.ts)_