# @farmisen/branch-name

> A cli tool to generate well formatted pr names from your favorite issue trackers. So far Jira, Clubhouse and Gitlab are supported.

Latest version **0.1.12** (published 2020-08-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install @farmisen/branch-name
pnpm add @farmisen/branch-name
yarn add @farmisen/branch-name
bun add @farmisen/branch-name
```

Provides the command `branch-name`.

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.12 |
| Published | 2020-08-10 |
| First published | 2020-08-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 220.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Fabrice Armisen |
| Maintainers | farmisen |
| Keywords | jira clubhouse issue branch git |

## Links

- npm: https://www.npmjs.com/package/@farmisen/branch-name
- Repository: https://github.com/farmisen/branch-name
- Homepage: https://github.com/farmisen/branch-name#readme
- Issues: https://github.com/farmisen/branch-name/issues
- npm.io page: https://npm.io/package/@farmisen/branch-name

## Dependencies (4)

- [arg](https://npm.io/package/arg.md) ^4.1.3
- [jira-client](https://npm.io/package/jira-client.md) ^6.18.0
- [clubhouse-lib](https://npm.io/package/clubhouse-lib.md) ^0.10.0
- [@gitbeaker/node](https://npm.io/package/@gitbeaker/node.md) ^23.4.2

## Recent versions

- 0.1.12 (latest) — 2020-08-10
- 0.1.10 — 2020-08-05
- 0.1.9 — 2020-08-04
- 0.1.8 — 2020-08-03
- 0.1.7 — 2020-08-03
- 0.1.6 — 2020-08-03
- 0.1.5 — 2020-08-03

## README

# branch-name

A cli tool to generate well formatted pr names from your favorite issue trackers. So far Jira, Clubhouse and Gitlab are supported.


## Installation ##

```shell
$ yarn global add @farmisen/branch-name

```

## Usage ##

```
branch-name [options]

  Options:

    -p, --project  project defined in the config file
    -i, --id       issue identifier
    -c, --config   Config file location (default to $HOME/.branch-name)
    -h, --help     Output usage information
    -d, --doc      Output full documentation
```

## Examples ##
```
~/P/f/branch-name > branch-name --project coffee-bot --id 17382 
farmisen/ch17382/fix-filter-cleanup-cron-table

~/P/f/branch-name > branch-name --project simu --id SIMU-1659
SIMU-1659_performance_remove_unused_filters

~/P/f/branch-name > --project clemet --id 80
clem_80-retire_the_log_drawer


~/P/f/branch-name > cat ~/.branch-name                                               
var config = {
    projects: [
        {
            slug: "coffee-bot",
            server: "clubhouse",
            serverConfig: {
                token: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
            },
            
            formatter: (id, title) => `farmisen/ch${id}/${title}`
        },
        {
            slug: "simu",
            server: "jira",
            serverConfig: {
                host: "xxxxxxxxxxxx.atlassian.net",
                username: "xxxxxxx@xxxxxxxxxx.xxx",
                token: "xxxxxxxxxxxxxxxxxxxxxxxx",
            },
            formatter: (id, title) => `${id}_${title}`,
            separator: "_"
        },
        {
            slug: "clemet",
            server: "gitlab",
            serverConfig: {
                host: "xxxxxxxxxxxx.xxxxxxxxx.xxx",
                token: "xxxxxxxxxxxxxxxxxxxxxxxx",
                projectId: 5,
            },
            formatter: (id, title) => `clem_${id}-${title}`,
            separator: "_"
        }
    ]
};
exports.default=config

```

## Documentation ##

### Config file

  The config file is a javascript file exporting a config object as default export:

  ```
  var config = {...}
  exports.default = config;
  ```

  #### Config object fields


| name     | type          | info                    |
|----------|---------------|-------------------------|
| projects | list(project) | list of project objects |


  #### Project object fields
  
| name         | type                                | info                                        |
|--------------|-------------------------------------|---------------------------------------------|
| slug         | string                              | project slug used with the --project option |
| server       | "clubhouse" \| "jira \| gitlab"     | type of issues tracking server              |
| serverConfig | object                              | server config object                        |
| formatter    | (id:string, title:string) => string | an optional branch name formatter           |
| sanitizer    | (title:string) => string            | an optional issue name sanitizer            |
| separator    | string                              | an optional word separator (default to "-") |

  #### Server config object fields

  ##### Jira:

| name     | type   | info                     |
|----------|--------|--------------------------|
| host     | url    | jira server host         |
| username | string | jira username            |
| token    | string | jira personal auth token |
  
  ##### Clubhouse:

| name  | type   | info                          |
|-------|--------|-------------------------------|
| token | string | clubhouse personal auth token |

##### Gitlab:

| name  | type   | info                       |
|-------|--------|----------------------------|
| host  | url    | gitlab server host         |
| token | string | gitlab personal auth token |


## Publishing

```
$ yarn clean
$ yarn build
$ npx webpack
$ npm publish --access public 
```

## Copyright & License

Copyright (c) 2020 Fabrice Armisen.

Distributed under the MIT License (see [LICENSE](./LICENSE)).

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