# nodemon-remote

> Simple remote control for node.js apps.

Latest version **1.0.1** (published 2021-12-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install nodemon-remote
pnpm add nodemon-remote
yarn add nodemon-remote
bun add nodemon-remote
```

Provides the command `nodemon-remote`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2021-12-15 |
| First published | 2021-12-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=8.10.0 |
| Dependencies | 3 |
| Unpacked size | 383.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | tw00 |
| Keywords | cli, monitor, remote, github, webhook, http, development, restart, autoload, terminal |

## Links

- npm: https://www.npmjs.com/package/nodemon-remote
- Repository: https://github.com/tw00/nodemon-remote
- Homepage: https://github.com/tw00/nodemon-remote#readme
- Issues: https://github.com/tw00/nodemon-remote/issues
- npm.io page: https://npm.io/package/nodemon-remote

## Dependencies (3)

- [debug](https://npm.io/package/debug.md) ^4.3.3
- [rcfile](https://npm.io/package/rcfile.md) ^1.0.3
- [update-notifier](https://npm.io/package/update-notifier.md) ^5.1.0

## Recent versions

- 1.0.1 (latest) — 2021-12-15
- 1.0.0 — 2021-12-15
- 0.0.0-development — 2021-12-14

## README

# Nodemon-Remote

<p align="center">
  <img src="./img/logo.svg" alt="Nodemon-Remote Logo">
</p>

Drop-in replacement for [nodemon](https://nodemon.io/) with HTTP remote control and support for custom commands.

## How to use it

### Installation

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

### Create a config: `.remoterc.js`

```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

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

### Send nodemon restart command

```bash
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.

```js
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",
    ],
  },
};
```

1. Got to webhook settings (`https://github.com/<org>/<project>/settings/hooks/new`)

2. Enter payload URL:

```
http://<endpoint>:2020/webhook
```

3. Select `application/json` and enter secret

![](./img/webhook-config.png)

4. Select `Let me select individual events.`

5. Enable `Pull requests` only

![](./img/webhook-options.png)

6. Hit `Add Webhook`

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

---
_Source: https://npm.io/package/nodemon-remote · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
