# express-git-self-update

> Express middleware for program to upgrade itself from git remote.

Latest version **2.2.4** (published 2021-10-02) · idc license · 0 weekly downloads

## Install

```sh
npm install express-git-self-update
pnpm add express-git-self-update
yarn add express-git-self-update
bun add express-git-self-update
```

## 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 | 2.2.4 |
| Published | 2021-10-02 |
| First published | 2021-09-07 |
| Weekly downloads | 0 |
| License | idc |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 24 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Josef Andersson |
| Maintainers | josefandersson |
| Keywords | express, git |

## Links

- npm: https://www.npmjs.com/package/express-git-self-update
- Repository: https://git.josf.dev/josefandersson/express-git-self-update
- npm.io page: https://npm.io/package/express-git-self-update

## Recent versions

- 2.2.4 (latest) — 2021-10-02
- 2.2.3 — 2021-10-01
- 2.2.2 — 2021-09-19
- 2.2.1 — 2021-09-19
- 2.2.0 — 2021-09-17
- 2.0.0 — 2021-09-07

## README

# express-git-self-update

Express route to upgrade self from git remote when endpoint is called.

## Usage

```typescript
const Express = require('express');
const SelfUpdate = require('express-git-self-update');

const app = Express();

app.use(Express.json());

const options = {
  compareBody: body => body.key === 'SuperSecretExampleKey',
  onUpdatedCommand: 'systemctl restart example-program.service'
};

app.post('/webhook/selfupdate', SelfUpdate(options));
```

## Options

Pass options when initializing the middleware to customize it's behavior. Available options:

- `compareNpmVersion` [boolean] (default: `true`) - Only update when remote package.json version is higher than the local.
- `runNpmInstall` [boolean] (default: `true`) - Automatically run `npm install` after update.
- `compareBody` [object => boolean] - Function to compare incoming body. Won't update if function returns `false`.
- `compareQuery` [object => boolean] - Function to compare incoming query parameters. Won't update if function returns `false`.
- `onUpdate` [() => void] - Function to call after program has been updated.
- `onUpdateCommand` [string] - Shell command to execute after program has been updated. (Runs after `onUpdate`.)
- `groupingTime` [number] (default: `0`) - Minimum amount of time in millis to wait after starting a self updating check before allowing a new check. Requests that are sent within this time frame will be grouped together, that is, their response will be the same and returned when the running check finishes.

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