Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dylan-conway committed Dec 18, 2024
1 parent eea274c commit 34c6925
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/cli/bun-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ registry = "https://registry.yarnpkg.com/"
# Install for production? This is the equivalent to the "--production" CLI argument
production = false

# Save a text-based lockfile? This is equivalent to "--save-text-lockfile" CLI argument
saveTextLockfile = false

# Disallow changes to lockfile? This is the equivalent to the "--frozen-lockfile" CLI argument
frozenLockfile = false

Expand Down Expand Up @@ -108,6 +111,7 @@ export interface Install {
scopes: Scopes;
registry: Registry;
production: boolean;
saveTextLockfile: boolean;
frozenLockfile: boolean;
dryRun: boolean;
optional: boolean;
Expand Down
3 changes: 3 additions & 0 deletions docs/cli/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,9 @@ peer = true
# equivalent to `--production` flag
production = false

# equivalent to `--save-text-lockfile` flag
saveTextLockfile = false

# equivalent to `--frozen-lockfile` flag
frozenLockfile = false

Expand Down
3 changes: 3 additions & 0 deletions docs/install/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ peer = true
# equivalent to `--production` flag
production = false

# equivalent to `--save-text-lockfile` flag
saveTextLockfile = false

# equivalent to `--frozen-lockfile` flag
frozenLockfile = false

Expand Down
18 changes: 18 additions & 0 deletions docs/install/lockfile.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,24 @@ $ bun install --yarn
print = "yarn"
```

### Text-based lockfile

Bun v1.1.39 introduced `bun.lock`, a JSONC formatted lockfile. `bun.lock` is human-readable and git-diffable without configuration, at [no cost to performance](https://bun.sh/blog/bun-lock-text-lockfile#cached-bun-install-gets-30-faster).

To generate the lockfile, use `--save-text-lockfile` with `bun install`. You can do this for new projects and existing projects already using `bun.lockb` (resolutions will be preserved).

```bash
$ bun install --save-text-lockfile
$ head -n3 bun.lock
{
"lockfileVersion": 0,
"workspaces": {
```
Once `bun.lock` is generated, Bun will use it for all subsequent installs and updates through commands that read and modify the lockfile. If both lockfiles exist, `bun.lock` will be choosen over `bun.lockb`.
Bun v1.2.0 will switch the default lockfile format to `bun.lock`.
{% /codetabs %}
{% details summary="Configuring lockfile" %}
Expand Down
11 changes: 11 additions & 0 deletions docs/runtime/bunfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,17 @@ By default Bun uses caret ranges; if the `latest` version of a package is `2.4.1
exact = false
```

### `install.saveTextLockfile`

Generate `bun.lock`, a human-readable text-based lockfile. Once generated, Bun will use this file instead of `bun.lockb`, choosing it over the binary lockfile if both are present.

Default `false`. In Bun v1.2.0 the default lockfile format will change to `bun.lock`.

```toml
[install]
saveTextLockfile = true
```

<!--
### `install.prefer`
Expand Down

0 comments on commit 34c6925

Please sign in to comment.