Skip to content

docs: add multi JavaScript package manager and code groups to guides #4501

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion docs/guides/local-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,30 @@ Info about git hooks can be found on [Git documentation](https://git-scm.com/boo

For a first simple usage test of commitlint you can do the following:

```bash
::: code-group

```sh [npm]
npx commitlint --from HEAD~1 --to HEAD --verbose
```

```sh [yarn]
yarn commitlint --from HEAD~1 --to HEAD --verbose
```

```sh [pnpm]
pnpm dlx commitlint --from HEAD~1 --to HEAD --verbose
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe pnpm commitlint and bun commitlint also work same as yarn commitlint.

Copy link
Contributor Author

@Marukome0743 Marukome0743 Jul 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@escapedcat Oh sorry, I have updated now after merged.

May I recreate PR of update pnpm commitlint and bun commitlint ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, sorry, I thought this was already covered, my bad! Sure, please open another PR. No rush.

```

```sh [bun]
bunx commitlint --from HEAD~1 --to HEAD --verbose
```

```sh [deno]
deno task --eval commitlint --from HEAD~1 --to HEAD --verbose
```

:::

This will check your last commit and return an error if invalid or a positive output if valid.

### Test the hook
Expand Down
74 changes: 71 additions & 3 deletions docs/guides/use-prompt.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,62 @@

2. Create a package.json if needed

```sh
::: code-group

```sh [npm]
npm init
```

```sh [yarn]
yarn init
```

```sh [pnpm]
pnpm init
```

```sh [bun]
bun init
```

:::

3. Install and configure if needed

```sh
::: code-group

```sh [npm]
npm install --save-dev @commitlint/cli @commitlint/config-conventional @commitlint/prompt-cli

echo "export default { extends: ['@commitlint/config-conventional'] };" > commitlint.config.js
```

```sh [yarn]
yarn add --dev @commitlint/cli @commitlint/config-conventional @commitlint/prompt-cli

echo "export default { extends: ['@commitlint/config-conventional'] };" > commitlint.config.js
```

```sh [pnpm]
pnpm add --save-dev @commitlint/cli @commitlint/config-conventional @commitlint/prompt-cli

echo "export default { extends: ['@commitlint/config-conventional'] };" > commitlint.config.js
```

```sh [bun]
bun add --dev @commitlint/cli @commitlint/config-conventional @commitlint/prompt-cli

echo "export default { extends: ['@commitlint/config-conventional'] };" > commitlint.config.js
```

```sh [deno]
deno add --dev npm:@commitlint/cli npm:@commitlint/config-conventional npm:@commitlint/prompt-cli

echo "export default { extends: ['@commitlint/config-conventional'] };" > commitlint.config.js
```

:::

## Provide a shortcut

To make prompt-cli easy to use, add a npm run-script to your `package.json`
Expand All @@ -38,11 +82,35 @@ To make prompt-cli easy to use, add a npm run-script to your `package.json`

Test the prompt by executing

```bash
::: code-group

```sh [npm]
git add .
npm run commit
```

```sh [yarn]
git add .
yarn commit
```

```sh [pnpm]
git add .
pnpm commit
```

```sh [bun]
git add .
bun commit
```

```sh [deno]
git add .
deno task commit
```

:::

## An alternative to `@commitlint/prompt-cli`: commitizen

Another way to author commit messages that adhere to the commit convention configured in `commitlint.config.js` is to use `commitizen`.
Expand Down