# source-checker

> Simple polling tool that will poll a configured endpoint and detect/notify when a change is detected

Latest version **1.0.4** (published 2021-04-20) · ISC license · 0 weekly downloads

## Install

```sh
npm install source-checker
pnpm add source-checker
yarn add source-checker
bun add source-checker
```

## 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.4 |
| Published | 2021-04-20 |
| First published | 2020-05-26 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 8.2 KB |
| Known vulnerabilities | 0 (+23 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Robert B Hanes |
| Maintainers | rhanes |

## Links

- npm: https://www.npmjs.com/package/source-checker
- Repository: https://github.com/rhanes/source-checker
- Homepage: https://github.com/rhanes/source-checker#readme
- Issues: https://github.com/rhanes/source-checker/issues
- npm.io page: https://npm.io/package/source-checker

## Dependencies (3)

- [axios](https://npm.io/package/axios.md) ^0.21.1
- [git-diff](https://npm.io/package/git-diff.md) ^2.0.6
- [@slack/webhook](https://npm.io/package/@slack/webhook.md) ^5.0.3

## Recent versions

- 1.0.4 (latest) — 2021-04-20
- 1.0.3 — 2020-05-26
- 1.0.2 — 2020-05-26
- 1.0.1 — 2020-05-26
- 1.0.0 — 2020-05-26

## README

# Source Checker

Source Checker is a simple polling tool that will poll a configured endpoint and detect/notify when a change is detected. Slack notifications can be configured by providing a webhook. Assets with diffs are saved to disk.

This tool is intended to be used to detect changes in assets supplied by 3rd party sources to your project and provide the source code to be able to diff check the differences.

## Configuration Properties

| Property  | Description |
| ------------- | ------------- |
| interval    | A number in milliseconds to poll the monitored url |
| timeout     | A number in milliseconds to stop polling
| slack  | Object containing slack configuration parameters |


Providing configuration is optional. If a config is not provided, polling will default to once every minute and poll until the application is terminated.

## Example Usage

```javascript
const sourceChecker = require('source-checker');

// poll every 30 seconds
// stop polling after 1 hour
// notify slack whenever a change is detected
const config = {
  interval: 30000,
  timeout: 3600000,
  slack: {
    webhook: 'https://hooks.slack.com/services/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',
    username: 'My Notifier Bot',
    icon_emoji: ':police_car:',
    text: 'A new version of ****** has been detected',
    attachmentColor: '#FF0000'
  }
}

// Starts the poller
sourceChecker('myendpoint/path/to/asset?any=params', config);
```

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