Skip to content

Commit 09f1a99

Browse files
shaanmajidj178
andauthored
docs(installation): miscellaneous cleanup (#1502)
Co-authored-by: Jo <[email protected]>
1 parent d342579 commit 09f1a99

2 files changed

Lines changed: 79 additions & 38 deletions

File tree

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -171,23 +171,23 @@ cargo install --locked prek
171171

172172
<!-- --8<-- [start: npmjs-install] -->
173173

174-
prek is published as a Node.js package, you can install it using `npm`, `pnpm`, or `npx`:
174+
prek is published as a [Node.js package](https://www.npmjs.com/package/@j178/prek)
175+
and can be installed with any npm-compatible package manager:
175176

176177
```bash
177-
# Using npm
178+
# As a dev dependency
178179
npm add -D @j178/prek
179-
180-
# Using pnpm
181180
pnpm add -D @j178/prek
181+
bun add -D @j178/prek
182182

183-
# Using npx
184-
npx @j178/prek --version
185-
186-
# or install globally
183+
# Or install globally
187184
npm install -g @j178/prek
185+
pnpm add -g @j178/prek
186+
bun install -g @j178/prek
188187

189-
# then use `prek` command
190-
prek --version
188+
# Or run directly without installing
189+
npx @j178/prek --version
190+
bunx @j178/prek --version
191191
```
192192

193193
<!-- --8<-- [end: npmjs-install] -->

docs/installation.md

Lines changed: 69 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,23 @@ prek provides multiple installation methods to suit different needs and environm
66

77
The standalone installer automatically downloads and installs the correct binary for your platform:
88

9-
### Linux and macOS
9+
=== "macOS and Linux"
1010

11-
--8<-- "README.md:linux-standalone-install"
11+
Use `curl` to download the script and execute it with `sh`:
1212

13-
### Windows
13+
--8<-- "README.md:linux-standalone-install"
1414

15-
--8<-- "README.md:windows-standalone-install"
15+
=== "Windows"
16+
17+
Use `irm` to download the script and execute it with `iex`:
18+
19+
--8<-- "README.md:windows-standalone-install"
20+
21+
Changing the [execution policy](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_execution_policies) allows running a script from the internet.
22+
23+
!!! tip
24+
25+
The installation script may be inspected before use. Alternatively, binaries can be downloaded directly from [GitHub Releases](#github-releases).
1626

1727
## Package Managers
1828

@@ -28,9 +38,27 @@ The standalone installer automatically downloads and installs the correct binary
2838

2939
--8<-- "README.md:mise-install"
3040

31-
### npmjs
41+
### npm
42+
43+
prek is published as a [Node.js package](https://www.npmjs.com/package/@j178/prek)
44+
and can be installed with any npm-compatible package manager:
45+
46+
```bash
47+
# npm
48+
npm install -g @j178/prek
49+
50+
# pnpm
51+
pnpm add -g @j178/prek
52+
53+
# bun
54+
bun install -g @j178/prek
55+
```
56+
57+
Or as a project dependency:
3258

33-
--8<-- "README.md:npmjs-install"
59+
```bash
60+
npm add -D @j178/prek
61+
```
3462

3563
### Nix
3664

@@ -44,22 +72,29 @@ The standalone installer automatically downloads and installs the correct binary
4472

4573
--8<-- "README.md:scoop-install"
4674

47-
### MacPorts (macOS)
75+
### MacPorts
4876

4977
--8<-- "README.md:macports-install"
5078

51-
### Install from Pre-Built Binaries
79+
### cargo-binstall
5280

5381
--8<-- "README.md:cargo-binstall"
5482

55-
## Build from Source
83+
## Docker
5684

57-
--8<-- "README.md:cargo-install"
85+
prek provides a Docker image at
86+
[`ghcr.io/j178/prek`](https://github.com/j178/prek/pkgs/container/prek).
5887

59-
## Download from GitHub Releases
88+
See the guide on [using prek in Docker](integrations.md#docker) for more details.
89+
90+
## GitHub Releases
6091

6192
--8<-- "README.md:pre-built-binaries"
6293

94+
## Build from Source
95+
96+
--8<-- "README.md:cargo-install"
97+
6398
## Updating
6499

65100
--8<-- "README.md:self-update"
@@ -68,31 +103,37 @@ For other installation methods, follow the same installation steps again.
68103

69104
## Shell Completion
70105

71-
prek supports shell completion for Bash, Zsh, Fish, and PowerShell. To install completions:
106+
!!! tip
72107

73-
### Bash
108+
Run `echo $SHELL` to determine your shell.
74109

75-
```bash
76-
COMPLETE=bash prek > /etc/bash_completion.d/prek
77-
```
110+
To enable shell autocompletion for prek commands, run one of the following:
78111

79-
### Zsh
112+
=== "Bash"
80113

81-
```bash
82-
COMPLETE=zsh prek > "${fpath[1]}/_prek"
83-
```
114+
```bash
115+
echo 'eval "$(COMPLETE=bash prek)"' >> ~/.bashrc
116+
```
84117

85-
### Fish
118+
=== "Zsh"
86119

87-
```bash
88-
COMPLETE=fish prek > ~/.config/fish/completions/prek.fish
89-
```
120+
```bash
121+
echo 'eval "$(COMPLETE=zsh prek)"' >> ~/.zshrc
122+
```
90123

91-
### PowerShell
124+
=== "Fish"
92125

93-
```powershell
94-
COMPLETE=powershell prek >> $PROFILE
95-
```
126+
```bash
127+
echo 'COMPLETE=fish prek | source' >> ~/.config/fish/config.fish
128+
```
129+
130+
=== "PowerShell"
131+
132+
```powershell
133+
Add-Content -Path $PROFILE -Value '(COMPLETE=powershell prek) | Out-String | Invoke-Expression'
134+
```
135+
136+
Then restart your shell or source the config file.
96137

97138
## Artifact Verification
98139

0 commit comments

Comments
 (0)