watchwoman

2.0.1 • Public • Published

NOTICE: Actual create is wix/wml, due to apparant lack of updates. It contains fixes and enhancements. I will continue to pull updates from upstream.

Tangible symlinks

watchwoman listens to changes in some folder (using Watchman) and copies changed files into another folder.

Why?

Let's face it, sometimes symbolic links just aren't enough. Github has more than 10K issues with the words "support for symlinks" in them.

Two examples I've encountered so far were: React Native's packager lack of support for them and Webpack's inability to find linked modules dependencies (working around this has issues of its own). A lot of people resolve to working directly from the nodemodules folder in these cases, but _a. if your package is required by two projects on which you are working simultaneously, you're screwed, and b. it just feels wrong.

watchwoman makes use of Facebook's ultra-fast Watchman to watch for changes in your source folder and copy them (and only them) into your destination folder.

watchwoman is a CLI tool that works pretty much like ln -s. You first set up your links by using the watchwoman add command and then run the watchwoman service (watchwoman start) to start listening. That's it!

Note that since watchwoman is based on Watchman it does not support symlinks. lol.

Install

npm install -g watchwoman

Usage

# add the link to watchwoman using `watchwoman add <src> <dest>` 
watchwoman add ~/my-package ~/main-project/node_modules/my-package
 
# start watching all links added 
watchwoman start

Commands

add

watchwoman add <src> <dest> (or watchwoman a)

skip ignor prompt

watchwoman add <src> <dest> --skip-prompt

Adds a link.

watchwoman will not start listening to changes until you start it by running watchwoman start.

Each link is given an unique id, you can see all links and their ids by running watchwoman list. Links are saved to src/links.json in your watchwoman install directory, meaning that your configuration is specific to that watchwoman install.

autoAdd

watchwoman autoAdd <repo_root> (or watchwoman aa)

Automatically links packages used in this project with packages in a given repos folder.

This is the power command: when you have many packages that you develop locally across your projects, you normally keep them in one root folder. When you start a new project and npm install one of your packages, use watchwoman aa and watchwoman will see match your local package to the package in your repo root.

rm

watchwoman rm <linkId> [<linkId>...]

Removes one or more links. Passing all as linkId removes all links.

start

watchwoman start (or watchwoman s)

Starts watchwoman.

It first copies all watched files from source to destination folder and then waits for new changes to happen.

list

watchwoman list [--src|--dst (or watchwoman ls)

Lists all links, optionally sorting by source or destination paths.

Shows each link's id, state and source/destination folders.

enable

watchwoman enable [linkId] (or watchwoman en)

Enables a link. Passing all as linkId enables all links.

If you don't specify a linkId watchwoman will open in interactive mode.

disable

watchwoman disable [linkId] (or watchwoman d)

Disables a link. Passing all as linkId disabled all links.

If you don't specify a linkId watchwoman will open in interactive mode.

Great for re-using old links without having to type them over and over again.

Miscellaneous

Ignored folders

When adding a new link watchwoman will try to detect if your source folder is a git repository or an npm package, it will then offer to ignore the ".git" and "node_modules" folders for you.

If you want to add more folders to your ignored folders first create a file named .watchmanconfig in your source folder, this file should contain Watchman's configuration for this folder. See example below to learn how populate it or check out the Watchman docs to learn more about Watchman configurations.

In the following example we are ignoring the ".git" and "node_modules" folders:

{
  "ignore_dirs": [".git", "node_modules"]
}

Contributing

See the Contributing page.

License

Copyright (c) 2016 Wix. Licensed under the MIT license.

Readme

Keywords

none

Package Sidebar

Install

npm i watchwoman

Weekly Downloads

0

Version

2.0.1

License

MIT

Unpacked Size

64.5 kB

Total Files

29

Last publish

Collaborators

  • nomi9995