New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

nodemon-remote

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

nodemon-remote

Simple remote control for node.js apps.

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

Nodemon-Remote

Nodemon-Remote Logo

Drop-in replacement for nodemon with HTTP remote control and support for custom commands.

How to use it

Installation

npm install --save nodemon-remote
# or
npx nodemon-remote <nodemon cli arguments>

Create a config: .remoterc.js

module.exports = {
  port: 2020,
  access_key: "MY_SECRET_ACCESS_KEY",
  commands: {
    // Custom commands (arguments are always escaped)
    checkout: { cmd: "git checkout '${branch}'" },
    fetch: { cmd: "git fetch --all" },
    // Define multiple commands
    pullAndInstall: {
      cmd: [
        "git pull origin '${branch}'"
        "npm ci"
      ]
    },
  },
};

Send custom remote command

curl -X POST \
  http://<endpoint>:2020/
  --header "Authorization: BEARER <MY_SECRET_ACCESS_KEY>" \
  --data '{ "cmd": "checkout", "branch": "main" }'

Send nodemon restart command

curl -X POST \
  http://<endpoint>:2020/
  --header "Authorization: BEARER <MY_SECRET_ACCESS_KEY>" \
  --data '{ "cmd": "nodemon:restart" }'

Available build-in commands:

  • nodemon:restart: Restart nodemon
  • nodemon:reset: Resets all settings

Github Webhook Integration

Trigger commands based on a configurable label.

Example: Any PR that has the "preview" label assigned and that code is pushed to will get checked out in the remote container.

module.exports = {
  // ...
  webhook: {
    label: "preview",
    // Commands will run, if a PR with the label above is modified
    cmd: [
      "git fetch --all",
      "git checkout '${ref}'",
      "npm ci",
      "nodemon:restart",
    ],
  },
};
  • Got to webhook settings (https://github.com/<org>/<project>/settings/hooks/new)

  • Enter payload URL:

http://<endpoint>:2020/webhook
  • Select application/json and enter secret

  • Select Let me select individual events.

  • Enable Pull requests only

  • Hit Add Webhook

  • Assign label configured in config.webhook.label (e.g. "preview") to PR

Keywords

cli

FAQs

Package last updated on 15 Dec 2021

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