# primer-changesets-cli

> The Primer flavored changesets CLI

Latest version **2.2.1** (published 2023-07-12) · ISC license · 0 weekly downloads

## Install

```sh
npm install primer-changesets-cli
pnpm add primer-changesets-cli
yarn add primer-changesets-cli
bun add primer-changesets-cli
```

Provides the command `changeset`.

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 2.2.1 |
| Published | 2023-07-12 |
| First published | 2023-05-31 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 33 |
| Unpacked size | 70.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Gregor Martynus |
| Maintainers | gr2m |

## Links

- npm: https://www.npmjs.com/package/primer-changesets-cli
- Repository: https://github.com/gr2m/primer-changesets-cli
- Homepage: https://github.com/gr2m/primer-changesets-cli#readme
- Issues: https://github.com/gr2m/primer-changesets-cli/issues
- npm.io page: https://npm.io/package/primer-changesets-cli

## Dependencies (33)

- [meow](https://npm.io/package/meow.md) ^6.0.0
- [chalk](https://npm.io/package/chalk.md) ^2.1.0
- [is-ci](https://npm.io/package/is-ci.md) ^3.0.1
- [semver](https://npm.io/package/semver.md) ^5.4.1
- [outdent](https://npm.io/package/outdent.md) ^0.5.0
- [p-limit](https://npm.io/package/p-limit.md) ^2.2.0
- [enquirer](https://npm.io/package/enquirer.md) ^2.3.0
- [fs-extra](https://npm.io/package/fs-extra.md) ^7.0.1
- [human-id](https://npm.io/package/human-id.md) ^1.0.2
- [term-size](https://npm.io/package/term-size.md) ^2.1.0
- [tty-table](https://npm.io/package/tty-table.md) ^4.1.5
- [ansi-colors](https://npm.io/package/ansi-colors.md) ^4.1.3
- [spawndamnit](https://npm.io/package/spawndamnit.md) ^2.0.0
- [@types/is-ci](https://npm.io/package/@types/is-ci.md) ^3.0.0
- [preferred-pm](https://npm.io/package/preferred-pm.md) ^3.0.0
- [resolve-from](https://npm.io/package/resolve-from.md) ^5.0.0
- [@types/semver](https://npm.io/package/@types/semver.md) ^6.0.0
- [@babel/runtime](https://npm.io/package/@babel/runtime.md) ^7.20.1
- [@changesets/git](https://npm.io/package/@changesets/git.md) ^2.0.0
- [@changesets/pre](https://npm.io/package/@changesets/pre.md) ^1.0.14
- [external-editor](https://npm.io/package/external-editor.md) ^3.1.0
- [@changesets/read](https://npm.io/package/@changesets/read.md) ^0.5.9
- [@changesets/types](https://npm.io/package/@changesets/types.md) ^5.2.1
- [@changesets/write](https://npm.io/package/@changesets/write.md) ^0.2.3
- [@changesets/config](https://npm.io/package/@changesets/config.md) ^2.3.0
- [@changesets/errors](https://npm.io/package/@changesets/errors.md) ^0.1.4
- [@changesets/logger](https://npm.io/package/@changesets/logger.md) ^0.0.5
- [@manypkg/get-packages](https://npm.io/package/@manypkg/get-packages.md) ^1.1.3
- [@changesets/changelog-git](https://npm.io/package/@changesets/changelog-git.md) ^0.1.14
- [@changesets/get-release-plan](https://npm.io/package/@changesets/get-release-plan.md) ^3.0.16
- [@changesets/apply-release-plan](https://npm.io/package/@changesets/apply-release-plan.md) ^6.1.3
- [@changesets/get-dependents-graph](https://npm.io/package/@changesets/get-dependents-graph.md) ^1.3.5
- [@changesets/assemble-release-plan](https://npm.io/package/@changesets/assemble-release-plan.md) ^5.2.3

## Recent versions

- 2.2.1 (latest) — 2023-07-12
- 2.2.0 — 2023-07-10
- 2.1.0 — 2023-06-21
- 2.0.9 — 2023-06-02
- 2.0.8 — 2023-05-31
- 2.0.7 — 2023-05-31
- 2.0.6 — 2023-05-31
- 2.0.5 — 2023-05-31
- 2.0.4 — 2023-05-31
- 2.0.3 — 2023-05-31
- 2.0.2 — 2023-05-31
- 2.0.1 — 2023-05-31
- 2.0.0 — 2023-05-31
- 1.0.5 — 2023-05-31
- 1.0.4 — 2023-05-31
- … 4 more at https://npm.io/package/primer-changesets-cli/versions

## README

# primer-changesets-cli

> The Primer flavored changesets CLI

This CLI is a think wrapper around [the `changesets` CLI](https://github.com/changesets/changesets/tree/main/packages/cli) which adds one additional question:

> Which modules have been changed?

Depending on in which repository the CLI is run, it will either suggest a module from [primer/react](https://github.com/primer/react) or [primer/view_components](https://github.com/primer/view_components).

As a result the generated changeset will include a footer. An example changeset file might look like this:

```md
---
"@primer/react": patch
---

SSR-compatibibility fixes.

Changed components: MarkdownEditor, ActionList
```

## Setup for `primer/*` repository

Install `primer-changesets-cli` as a dev dependency in your project. Remove `@changesets/cli` if it is already installed.

```
npm uninstall @changesets/cli
npm install primer-changesets-cli --save-dev
```

## Usage

The usage remains the same as with `@changesets/cli`, the binary name is the same:

```
npx changeset
```

## Updating the patch

For the initial setup, run

```
npm install
npm run apply-patch
```

Then

1. Make your changes directly in `node_modules/@changesets/cli/dist/cli.cjs.dev.js`
2. Run `npm run update-patch`

In order to test the change locally, replace the version of `primer-changesets-cli` in the `primer/*` folder's `package.json` file
with a local path

```diff
-    "primer-changesets-cli": "2.0.0",
+    "primer-changesets-cli": "file:../../gr2m/primer-changesets-cli",
```

Then run `npx changeset` as usual.

Important: if you updated `@changesets/cli` to a new version, remove the old patch file and update the dependencies in `package.json`. Replace `"dependencies"` with all of `@changesets/cli`'s dependencies plus `"patch-package": "^7.0.0"`.

## How it works

Unfortunately the the `@changeset/cli` package is not decomposable, we cannot easily import selected modules from it, inject our additional question, and then compose it together again before running it.

So instead we use [`patch-package`](https://github.com/ds300/patch-package) to patch the `@changeset/cli` package directly in a maintainable way. The changed lines can be seen in the [`patch/` folder](patch/). They get applied using the `postinstall` script in this package when installing locally.

In order for it to work when running the command with `npx primer-changesets-cli` later, we copy the patched file from `node_modules/@changesets/cli/dist/cli.cjs.dev.js` into the local `bin.js` directly, using the `prepublishOnly` script.

## License

[MIT](LICENSE)

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