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

@m-c2/install

v1.0.0

Published

A script to deploy and run a configuration for a project

Downloads

1

Readme

Mc2-runner

This package helps to quickly configure the behavior of cli command. For simple usage where you do not have watch & run logic, you can use this package.

Usage

If you already have a config file

npx @m-c2/runner

If you do not have a default config file, you can create it by running

npx @m-c2/runner --init

This will create the default template for you to edit, named mc2-runner.config.js

Config file

// mc2-runner.config.js

// Available colors
// red,       green,       yellow,       blue,       magenta,       cyan,
// brightRed, brightGreen, brightYellow, brightBlue, brightMagenta, brightCyan,
// black    , white      , gray
// or custom color if supported by your terminal : #XXXXXX as hex color

module.exports = [
  {
    // Name to display for this process (Ex: Typescript Compiler)
    name: '',
    // Command to run (Ex: yarn tsc)
    command: '',

    // If present, the process will restart when a file matching the pattern changes
    watch: {
      pattern: '', // Ex : Watching path like src/**/*.ts
    },

    // If true, the process will start automatically when the runner is started
    // If false, but a watch is configured, the process will start when a file change
    autoStart: false,

    // Color of the process in the console
    color: 'blue',
    // Color of the process in the console when a file change
    fileChangeColor: 'green',
    // When watch is active, define if the process restart or not on file change
    restartOnWatchChange: true,
    // When watch is active, Execute the method
    // This method can be async or not
    // can return void or an array of string representing a name of one of the process to start / restart
    triggerMethod: null,
  }
];

For exemple, if you have a small command to run when a file change, or a server to restart, you can use this package to do it. you can do it this way

// mc2-runner.config.js
module.exports = [
  {
    name    : 'TypeScript Compiler',
    command : 'yarn tsc',
    watch : {
      pattern: 'src/**/*.ts', // Watch all TypeScript files in the src directory and its subdirectories
    },
    color                : 'blue',
    fileChangeColor      : 'green',
    restartOnWatchChange : true,
    triggerMethod        : null,      // No trigger method specified for this process
  },
  {
    name    : 'Node App',
    command : 'node dist/App-Runner.js',
    watch : {
      pattern: 'out/App.js', // Watch the app.js file in the dist/js directory
    },
    restartOnWatchChange: true,
    // Function can be async or not
    triggerMethod: () => {
      // Copy new files to target directory
      // ... logic here
    },
  },
];