npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

monoinfuse

v1.4.8

Published

CLI tool to handle monorepo workflows and shared libraries

Downloads

3

Readme

monoinfuse

Watching and moving shared resources automagically, monoinfuse is a helpful CLI tool to handle monorepo workflows

installation

# 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

usage

To use monoinfuse, first create a configuration file. The monoinfuse configuration is split up into two core components, resources and 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

monoinfuse.json

{
  "resources": [
    {
      "name": "shared-interfaces",
      "path": "./shared/interfaces",
      "exclude": ["node_modules"]
    }
  ],
  "services": [
    {
      "name": "gateway",
      "path": "./services/gateway",
      "infuse": ["shared-interfaces"]
    }
  ]
}

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.

options

config

The config option allows you to change the configuration file path, which is a monoinfuse.json file in your current working directory by default.

Supplied by:

  • environment: MONOINFUSE_CONFIG
  • command-line argument: --config [config path]

prefix

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.

Supplied by:

  • environment: MONOINFUSE_TEMP_DIR_PREFIX
  • command-line argument: --prefix [prefix]
  • configuration: "prefix": "some_prefix/"

hooks

To create an interactive setup integrating with external tools like build utilities, you can use monoinfuse hooks!

Available events: preStart, postStart, preInfuse, postInfuse, preServiceInfuse, postServiceInfuse

An example project configuration could look like the following:

monoinfuse.json

{
  "services": [
    {
      "name": "example-service",
      "path": "./services/example",
      "infuse": ["shared-library"]
    }
  ],
  "resources": [
    {
      "name": "shared-library",
      "path": "./shared",
      "exclude": ["node_modules/**", "src/**"],
      "ignore": ["build/**"],
      "hooks": {
        "postServiceInfuse": [
          {
            "name": "shared yarn install",
            "background": "false",
            "command": {
              "name": "yarn",
              "args": ["install"],
              "env": {
                "NODE_ENV": "production"
              }
            },
            "runInServiceDir": true
          }
        ],
        "postStart": [
          {
            "name": "typescript watcher",
            "background": "true",
            "command": {
              "name": "tsc",
              "args": ["--watch"]
            }
          }
        ]
      }
    }
  ]
}

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.