Watching and moving shared resources automagically, monoinfuse is a helpful CLI tool to handle monorepo workflows
# install with npm npm i monoinfuse # install with yarn yarn add monoinfuse # install globally with npm npm i -g monoinfuse # install globally with yarn yarn global add monoinfuse
To use monoinfuse, first create a configuration file. The monoinfuse configuration is split up into two core components,
services. Resources are objects that represent either single files or whole directories, which will be watched for changes and copied into
services which consume them. A small config example would look like the following
If you continue by running
monoinfuse in the same directory where you just created the config, and look into your git client/file manager of choice, you can see a directory being created inside of your service directory, named
.monoinfuse, which contains further directories, e.g
shared-interfaces and the files from your resource (except the ones you've specified in the
exclude option of the resource). It's strongly advised to add the
.monoinfuse directory to your gitignore file to prevent these temporary files from being pushed to version control.
Every time you start developing your project, you can just launch monoinfuse and let it sit in the background, managing watching your shared files for changes and copying them to the specified target locations. Example use cases would be local npm modules which could then be installed using a relative file path.
The config option allows you to change the configuration file path, which is a
monoinfuse.json file in your current working directory by default.
- command-line argument:
--config [config path]
The prefix option allows you to customize the name under which all resources will be infused into your services. The default option is a
.monoinfuse directory inside of your service.
- command-line argument:
To create an interactive setup integrating with external tools like build utilities, you can use monoinfuse hooks!
An example project configuration could look like the following:
The configuration above will run a background job, in this case a TypeScript compiler in watch mode, once all resources are being watched, as well as a yarn install script every time a resource is infused. The latter command is run inside of the service directory the resource got infused to.
The process environment (
env) and current working directory (
cwd) can be configured inside of the command object of a hook.