3.5.63 • Published 2 years ago

label-sync v3.5.63

Weekly downloads
124
License
MIT
Repository
github
Last release
2 years ago

label-sync

CircleCI codecov npm version

A delightful companion to manage Github Labels across multiple repositories.

Overview

Label Sync helps you sync Github labels across multiple repositories. Using an intuitive API you'll be able to customize repository configuration across all your projects in no time. Besides that, it also features a core package module which can be used to build highly customized workflows.

Features

  • ✂️ Flexible: Compatible with JS, TS and JSON configuration.
  • 🌈 Easy to use: Simply use one of the templates to start!
  • 🐶 Friendly error messages: Guides you through installation and sync, no magic involved!
  • 🌳 Perfect test coverage: Maintaining 100% test coverage.
  • 💪 Used by giants: Used in production by companies like @prisma or @graphcms

Installation

npm init label-sync

label-sync-core creates multiple requests at once which might trigger Github's abuse detection systems. I encourage you to use https://github.com/octokit/plugin-throttling.js when setting up your client to prevent hiting abuse limits.

I suggest you use one of the prebuilt configurations as a starting point of your project. You can find more about the templates in the /examples folder.

Configuration

Besides using the core package and building the workflow on your own, you can use a set of perused builders which support JS, JSON and TS configuration options.

NOTE: Colors should be represented as hexadecimal color value without "#".

JSON

json template

JSON is the most opinionated option and the quickest option to setup Label Sync. Every value can be configured globaly or later changed in each repository scope.

{
  "strict": true,
  "labels": {
    "FAQ": {
      "color": "purple",
      "description": "Frequently asked questions"
    }
  },
  "repositories": [
    "maticzav/*",
    {
      "paths": "maticzav/graphql-*",
      "labels": {
        "extra": "red"
      },
      "strict": false
    }
  ],
  "publish": {
    "branch": "master"
  }
}
labels.config.json
ParameterTypeDefaultRequired
strictbooleanfalsefalse
labelsMap<name, color/label>/true
repositoriesArray<glob/repository>/true
publish{ branch: string}/false
repository
ParameterTypeDefaultRequired
pathsglob string/true
strictbooleanglobalfalse
labelsMap<name, color/label>/true
label
ParameterTypeDefaultRequired
colorstring/true
descriptionstring""false

NOTE: Globs should always include organization name before repository definition, and global definitions can always be overwritten using repository specific configuration.

NOTE: Colors should be represented as hexadecimal value without "#".


JavaScript

javascript template

JavaScript configuration allows you to employ more complex file structure and perform calculations during setup.

Compared to JSON, JavaScript doesn't feature globs. Instead, each repository has to be explicitly added to the sync.

NOTE: Colors should be configured as hexadecimal color values without "#".

const shield = require('./config/graphql-shield.js')

module.exports = {
  'maticzav/graphql-shield': shield,
  'maticzav/label-sync': {
    labels: {
      bug: '123abc',
      'kind/kudos': {
        description: 'Issues which simply thank for the project.',
        color: '456def',
      },
    },
    strict: true,
  },
}

Types

type LabelConfiguration =
  | {
      description?: string
      color: string
    }
  | string

export interface RepositoryConfig {
  labels: { [name: string]: LabelConfiguration }
  strict?: boolean
}

export interface Config {
  [repository: string]: RepositoryConfig
}

TypeScript

typescript template

TypeScript configuration is very similar to JavaScript one. Atop of gaining complete control over repositories, you also gain type annotations and smart suggestions.

NOTE: TypeScript configuration relies on tsconfig.json and requires a full-blown configuration or repository to run correctly.

NOTE: Colors should be configured as hexadecimal color values without "#".

import { Config } from 'label-sync-core'
import { prismaBinding } from './repositories/prisma-binding'
import { graphqlYoga } from './repositories/graphql-yoga'

const config: Config = {
  'prisma/prisma-binding': prismaBinding,
  'prisma/graphql-yoga': {
    labels: {
      bug: '2f6923',
      'kind/kudos': {
        description: 'Issues which simply thank for the project.',
        color: '123fff',
      },
    },
    strict: false,
  },
}

export default config

Types

type LabelConfiguration =
  | {
      description?: string
      color: string
    }
  | string

export interface RepositoryConfig {
  labels: { [name: string]: LabelConfiguration }
  strict?: boolean
}

export interface Config {
  [repository: string]: RepositoryConfig
}

Advanced

Besides providing a delightful syncing tool, Label Sync also features a core package named label-sync-core. label-sync-core module is extensively used in typescript. It exposes two functions, handleSync and generateSyncReport which can help you build amazing syncing utilities from ground up.

You can read more about them in the label-sync-core package README.

License

MIT @ Matic Zavadlal

3.5.63

2 years ago

3.5.62

2 years ago

3.5.61

3 years ago

3.5.60

3 years ago

3.5.59

3 years ago

3.5.58

3 years ago

3.5.57

3 years ago

3.5.56

3 years ago

3.5.55

3 years ago

3.5.54

3 years ago

3.5.53

3 years ago

3.5.52

3 years ago

3.5.51

4 years ago

3.5.50

4 years ago

3.5.49

4 years ago

3.5.48

4 years ago

3.5.47

4 years ago

3.5.46

4 years ago

3.5.45

4 years ago

3.5.44

4 years ago

3.5.43

4 years ago

3.5.42

4 years ago

3.5.41

4 years ago

3.5.40

4 years ago

3.5.39

4 years ago

3.5.38

4 years ago

3.5.37

4 years ago

3.5.36

4 years ago

3.5.35

4 years ago

3.5.34

4 years ago

3.5.33

4 years ago

3.5.32

4 years ago

3.5.31

4 years ago

3.5.30

4 years ago

3.5.29

4 years ago

3.5.28

4 years ago

3.5.27

4 years ago

3.5.26

4 years ago

3.5.25

4 years ago

3.5.24

4 years ago

3.5.23

4 years ago

3.5.22

4 years ago

3.5.21

4 years ago

3.5.20

4 years ago

3.5.19

4 years ago

3.5.18

4 years ago

3.5.17

4 years ago

3.5.16

4 years ago

3.5.15

4 years ago

3.5.14

4 years ago

3.5.13

4 years ago

3.5.12

4 years ago

3.5.11

4 years ago

3.5.10

4 years ago

3.5.9

4 years ago

3.5.8

4 years ago

3.5.7

4 years ago

3.5.5

4 years ago

3.5.4

4 years ago

3.5.3

4 years ago

3.5.2

4 years ago

3.5.1

4 years ago

3.5.0

4 years ago

3.4.1

4 years ago

3.4.0

4 years ago

3.3.0

4 years ago

3.2.1

4 years ago

3.2.0

4 years ago

3.1.24

4 years ago

3.1.23

4 years ago

3.1.22

4 years ago

3.1.21

4 years ago

3.1.20

4 years ago

3.1.19

4 years ago

3.1.18

4 years ago

3.1.17

4 years ago

3.1.16

4 years ago

3.1.15

4 years ago

3.1.14

4 years ago

3.1.13

4 years ago

3.1.12

4 years ago

3.1.11

4 years ago

3.1.10

4 years ago

3.1.9

4 years ago

3.1.8

4 years ago

3.1.7

4 years ago

3.1.6

4 years ago

3.1.5

4 years ago

3.1.3

4 years ago

3.1.4

4 years ago

3.1.2

4 years ago

3.1.1

4 years ago

3.1.0

4 years ago

3.0.0

4 years ago

1.1.0

4 years ago

2.0.0-rc1

4 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.1.0

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.0

5 years ago