Socket
Book a DemoInstallSign in
Socket

grunt-swatch

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grunt-swatch

Run tasks whenever watched sockets change.

latest
Source
npmnpm
Version
0.1.2
Version published
Maintainers
1
Created
Source

grunt-swatch

Run tasks whenever watched sockets change.

Getting Started

This plugin requires Grunt ~0.4.5

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-swatch --save-dev

Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:

grunt.loadNpmTasks('grunt-swatch');

The "swatch" task

Run this task with the grunt swatch command.

Overview

In your project's Gruntfile, add a section named swatch to the data object passed into grunt.initConfig().

grunt.initConfig({
  swatch: {
    targets: [
        { port: 'tcp/1234', actions: [ { name: 'action1', args: { arg1: 'value1', arg2: 'value2', ... }, {}, ... } ] },
        { port: 'tcp/9876', actions: [ { name: 'action2', args: { arg1: 'a2-value1', arg2: 'a2-value2', ... }, {}, ... } ] },
        ...
    ],
  },
});

targets

targets.port

Type: String Default value: none The ports key is used to tell Grunt which application port to probe.

targets.actions

Type: Array Default value: none The actions key is an array of action objects which are action configuration objects. The current availble action is the nim action which starts the Node.js debugger via the inspector protocol and signal handlers.

From https://nodejs.org/api/process.html#process_signal_events:

'SIGUSR1' is reserved by Node.js to start the debugger. It's possible to install a listener but doing so might interfere with the debugger. Note that currently the only port that can be used is the default 9229 due to a limitation of Node.js.

Usage Examples

grunt.initConfig({
  swatch: {
    default: {
      targets: {
        port: 'tcp/45670',
        actions: [{
          name: 'nim',
          args: {
            port: 9229
          }
        }]
      },
    }
  }
});

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.

Release History

(Nothing yet)

Keywords

gruntplugin

FAQs

Package last updated on 21 Aug 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts