emusym v0.1.2
emusym: Emulate symlinks
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.
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
## 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]
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
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
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