# label-sync-core

> The core module of Label Sync manager.

Latest version **2.3.64** (published 2019-12-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install label-sync-core
pnpm add label-sync-core
yarn add label-sync-core
bun add label-sync-core
```

## 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.3.64 |
| Published | 2019-12-20 |
| First published | 2018-12-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 106.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 60 |
| Author | Matic Zavadlal |
| Maintainers | maticzav |

## Links

- npm: https://www.npmjs.com/package/label-sync-core
- Repository: https://github.com/maticzav/label-sync
- Homepage: https://github.com/maticzav/label-sync#readme
- Issues: https://github.com/maticzav/label-sync/issues
- npm.io page: https://npm.io/package/label-sync-core

## Dependencies (3)

- [chalk](https://npm.io/package/chalk.md) ^2.4.1
- [multilines](https://npm.io/package/multilines.md) ^1.0.2
- [@octokit/rest](https://npm.io/package/@octokit/rest.md) ^16.28.2

## Recent versions

- 2.3.64 (latest) — 2019-12-20
- 2.3.63 — 2019-12-20
- 2.3.62 — 2019-12-18
- 2.3.61 — 2019-12-17
- 2.3.60 — 2019-12-16
- 2.3.59 — 2019-12-10
- 2.3.58 — 2019-12-09
- 2.3.57 — 2019-12-09
- 2.3.56 — 2019-12-04
- 2.3.55 — 2019-11-28
- 2.3.54 — 2019-11-28
- 2.3.53 — 2019-11-26
- 2.3.52 — 2019-11-23
- 2.3.50 — 2019-11-19
- 2.3.49 — 2019-11-18
- … 69 more at https://npm.io/package/label-sync-core/versions

## README

# label-sync-core

> The core module of Label Sync assistant.

`label-sync-core` equips you with all the functionallity needed to customise
Label Syncing from the ground up. It exposes two functions `handleSync` and
`generateSyncReport` which help you build delightful workflows for your application.

## Example

```ts
import { handleSync, generateSyncReport } from 'label-sync-core'
import labels from './labels'

async function main(cli: meow.Result): Promise<void> {
  const report = await handleSync(labels, {
    githubToken: process.env.GITHUB_TOKEN,
    dryRun: process.env.DRYRUN,
  })

  const humanReadableReport = generateSyncReport(report)

  console.log(humanReadableReport)
}

main(cli)
```

## Types

```ts
/**
 * Handle sync
 */

interface SyncOptions {
  dryRun: boolean
  githubToken: string
}

interface SyncReport {
  config: Config
  options: SyncOptions
  successes: RepositorySyncSuccessReport[]
  errors: RepositorySyncErrorReport[]
}

interface RepositorySyncSuccessReport {
  name: string
  config: RepositoryConfig
  additions: GithubLabel[]
  updates: GithubLabel[]
  removals: GithubLabel[]
}

interface RepositorySyncErrorReport {
  name: string
  config: RepositoryConfig
  message: string
}

declare function handleSync(
  config: Config,
  options: SyncOptions,
): Promise<SyncReport>

/**
 * Generate Sync report
 */

export declare function generateSyncReport(report: SyncReport): string
```

## License

MIT @ Matic Zavadlal

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