Skip to content
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

Remove the ability to configure lockfile location. #5335

Merged
merged 1 commit into from
Sep 14, 2023
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
Remove the ability to configure lockfile.
  • Loading branch information
Nathan Hammond authored and Nathan Hammond committed Sep 14, 2023
commit 8978478f05cb80f9e8d1313427705f7ed29eb742
6 changes: 3 additions & 3 deletions completions/bun.bash
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ _bun_completions() {
PACKAGE_OPTIONS[REMOVE_OPTIONS_LONG]="";
PACKAGE_OPTIONS[REMOVE_OPTIONS_SHORT]="";

PACKAGE_OPTIONS[SHARED_OPTIONS_LONG]="--config --yarn --production --frozen-lockfile --no-save --dry-run --lockfile --force --cache-dir --no-cache --silent --verbose --global --cwd --backend --link-native-bins --help";
PACKAGE_OPTIONS[SHARED_OPTIONS_LONG]="--config --yarn --production --frozen-lockfile --no-save --dry-run --force --cache-dir --no-cache --silent --verbose --global --cwd --backend --link-native-bins --help";
PACKAGE_OPTIONS[SHARED_OPTIONS_SHORT]="-c -y -p -f -g";

PM_OPTIONS[LONG_OPTIONS]="--config --yarn --production --frozen-lockfile --no-save --dry-run --lockfile --force --cache-dir --no-cache --silent --verbose --no-progress --no-summary --no-verify --ignore-scripts --global --cwd --backend --link-native-bins --help"
PM_OPTIONS[LONG_OPTIONS]="--config --yarn --production --frozen-lockfile --no-save --dry-run --force --cache-dir --no-cache --silent --verbose --no-progress --no-summary --no-verify --ignore-scripts --global --cwd --backend --link-native-bins --help"
PM_OPTIONS[SHORT_OPTIONS]="-c -y -p -f -g"

local cur_word="${COMP_WORDS[${COMP_CWORD}]}";
local prev="${COMP_WORDS[$(( COMP_CWORD - 1 ))]}";

Expand Down
8 changes: 1 addition & 7 deletions completions/bun.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ _bun() {
'--no-save[]' \
'--dry-run[Don'"'"'t install anything]' \
'--force[Always request the latest versions from the registry & reinstall all dependenices]' \
'--lockfile[Store & load a lockfile at a specific filepath]:lockfile' \
'--cache-dir[Store & load cached data from a specific directory path]:cache-dir' \
'--no-cache[Ignore manifest cache entirely]' \
'--silent[Don'"'"'t output anything]' \
Expand Down Expand Up @@ -97,7 +96,6 @@ _bun() {
'--no-save[]' \
'--dry-run[Don'"'"'t install anything]' \
'--force[Always request the latest versions from the registry & reinstall all dependenices]' \
'--lockfile[Store & load a lockfile at a specific filepath]:lockfile' \
'--cache-dir[Store & load cached data from a specific directory path]:cache-dir' \
'--no-cache[Ignore manifest cache entirely]' \
'--silent[Don'"'"'t output anything]' \
Expand Down Expand Up @@ -133,7 +131,6 @@ _bun() {
'--no-save[]' \
'--dry-run[Don'"'"'t install anything]' \
'--force[Always request the latest versions from the registry & reinstall all dependenices]' \
'--lockfile[Store & load a lockfile at a specific filepath]:lockfile' \
'--cache-dir[Store & load cached data from a specific directory path]:cache-dir' \
'--no-cache[Ignore manifest cache entirely]' \
'--silent[Don'"'"'t output anything]' \
Expand Down Expand Up @@ -284,7 +281,6 @@ _bun() {
'--frozen-lockfile[Disallow changes to lockfile]' \
'--no-save[Do not save a lockfile]'
'--dry-run[Do not install anything]'
'--lockfile[Store & load a lockfile at a specific filepath]'
'-f[Always request the latest versions from the registry & reinstall all dependencies]'
'--force[Always request the latest versions from the registry & reinstall all dependencies]'
'--cache-dir[Store & load cached data from a specific directory path]'
Expand Down Expand Up @@ -540,7 +536,6 @@ _bun() {
'--no-save[]' \
'--dry-run[Don'"'"'t install anything]' \
'--force[Always request the latest versions from the registry & reinstall all dependenices]' \
'--lockfile[Store & load a lockfile at a specific filepath]:lockfile' \
'--cache-dir[Store & load cached data from a specific directory path]:cache-dir' \
'--no-cache[Ignore manifest cache entirely]' \
'--silent[Don'"'"'t output anything]' \
Expand Down Expand Up @@ -576,7 +571,6 @@ _bun() {
'-g[Remove a package globally]' \
'--global[Remove a package globally]' \
'--force[Always request the latest versions from the registry & reinstall all dependenices]' \
'--lockfile[Store & load a lockfile at a specific filepath]:lockfile' \
'--cache-dir[Store & load cached data from a specific directory path]:cache-dir' \
'--no-cache[Ignore manifest cache entirely]' \
'--silent[Don'"'"'t output anything]' \
Expand Down Expand Up @@ -642,7 +636,7 @@ _bun_run_param_script_completion() {
local -a scripts_list
IFS=$'\n' scripts_list=($(SHELL=zsh bun getcompletes s))
IFS=$'\n' bins=($(SHELL=zsh bun getcompletes b))

_alternative "scripts:scripts:(($scripts_list))"
_alternative "bin:bin:(($bins))"
_alternative "files:file:_files -g '*.(js|ts|jsx|tsx|wasm)'"
Expand Down
9 changes: 0 additions & 9 deletions completions/spec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,6 @@ subcommands:
- no-save --
- dry-run -- "Don't install anything"
- force -- "Always request the latest versions from the registry & reinstall all dependenices"
- name: lockfile
type: string
summary: "Store & load a lockfile at a specific filepath"
- name: cache-dir
type: string
summary: "Store & load cached data from a specific directory path"
Expand Down Expand Up @@ -160,9 +157,6 @@ subcommands:
- no-cache -- "Ignore manifest cache entirely"
- silent -- "Don't output anything"
- verbose -- "Excessively verbose logging"
- name: lockfile
type: string
summary: "Store & load a lockfile at a specific filepath"
- name: cache-dir
type: string
summary: "Store & load cached data from a specific directory path"
Expand Down Expand Up @@ -198,9 +192,6 @@ subcommands:
- no-save --
- dry-run -- "Don't install anything"
- force -- "Always request the latest versions from the registry & reinstall all dependenices"
- name: lockfile
type: string
summary: "Store & load a lockfile at a specific filepath"
- name: cache-dir
type: string
summary: "Store & load cached data from a specific directory path"
Expand Down
9 changes: 0 additions & 9 deletions docs/cli/bun-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,6 @@ disableManifest = false
# Note: it does not load the lockfile, it just converts bun.lockb into a yarn.lock
print = "yarn"

# Path to read bun.lockb from
path = "bun.lockb"

# Path to save bun.lockb to
savePath = "bun.lockb"

# Save the lockfile to disk
save = true

Expand Down Expand Up @@ -142,8 +136,6 @@ export interface Cache {

export interface Lockfile {
print?: "yarn";
path: string;
savePath: string;
save: boolean;
}
```
Expand All @@ -156,7 +148,6 @@ Environment variables have a higher priority than `bunfig.toml`.
| -------------------------------- | ------------------------------------------------------------- |
| BUN_CONFIG_REGISTRY | Set an npm registry (default: <https://registry.npmjs.org>) |
| BUN_CONFIG_TOKEN | Set an auth token (currently does nothing) |
| BUN_CONFIG_LOCKFILE_SAVE_PATH | File path to save the lockfile to (default: bun.lockb) |
| BUN_CONFIG_YARN_LOCKFILE | Save a Yarn v1-style yarn.lock |
| BUN_CONFIG_LINK_NATIVE_BINS | Point `bin` in package.json to a platform-specific dependency |
| BUN_CONFIG_SKIP_SAVE_LOCKFILE | Don’t save a lockfile |
Expand Down
6 changes: 0 additions & 6 deletions docs/install/lockfile.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,6 @@ print = "yarn"
```toml
[install.lockfile]

# path to read bun.lockb from
path = "bun.lockb"

# path to save bun.lockb to
savePath = "bun.lockb"

# whether to save the lockfile to disk
save = true

Expand Down
6 changes: 0 additions & 6 deletions docs/runtime/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,6 @@ To configure lockfile behavior:
# path to read bun.lockb from
path = "bun.lockb"

# path to save bun.lockb to
savePath = "bun.lockb"

# whether to save the lockfile to disk
save = true

# whether to save a non-Bun lockfile alongside bun.lockb
# only "yarn" is supported
print = "yarn"
Expand Down
12 changes: 0 additions & 12 deletions src/bunfig.zig
Original file line number Diff line number Diff line change
Expand Up @@ -392,18 +392,6 @@ pub const Bunfig = struct {
install.save_lockfile = value;
}
}

if (lockfile_expr.get("path")) |lockfile| {
if (lockfile.asString(allocator)) |value| {
install.lockfile_path = value;
}
}

if (lockfile_expr.get("savePath")) |lockfile| {
if (lockfile.asString(allocator)) |value| {
install.save_lockfile_path = value;
}
}
}

if (_bun.get("optional")) |optional| {
Expand Down
33 changes: 2 additions & 31 deletions src/install/install.zig
Original file line number Diff line number Diff line change
Expand Up @@ -4332,7 +4332,6 @@ pub const PackageManager = struct {
bin_path: stringZ = "node_modules/.bin",

lockfile_path: stringZ = Lockfile.default_filename,
save_lockfile_path: stringZ = Lockfile.default_filename,
did_override_default_scope: bool = false,
scope: Npm.Registry.Scope = undefined,

Expand Down Expand Up @@ -4481,8 +4480,6 @@ pub const PackageManager = struct {
cli_: ?CommandLineArguments,
bun_install_: ?*Api.BunInstall,
) !void {
this.save_lockfile_path = this.lockfile_path;

var base = Api.NpmRegistry{
.url = "",
.username = "",
Expand Down Expand Up @@ -4570,19 +4567,6 @@ pub const PackageManager = struct {
this.local_package_features.optional_dependencies = save;
}

if (bun_install.lockfile_path) |save| {
if (save.len > 0) {
this.lockfile_path = try allocator.dupeZ(u8, save);
this.save_lockfile_path = this.lockfile_path;
}
}

if (bun_install.save_lockfile_path) |save| {
if (save.len > 0) {
this.save_lockfile_path = try allocator.dupeZ(u8, save);
}
}

this.explicit_global_directory = bun_install.global_dir orelse this.explicit_global_directory;
}

Expand Down Expand Up @@ -4663,14 +4647,6 @@ pub const PackageManager = struct {
if (cli.token.len > 0) {
this.scope.token = cli.token;
}

if (cli.lockfile.len > 0) {
this.lockfile_path = try allocator.dupeZ(u8, cli.lockfile);
}
}

if (env.map.get("BUN_CONFIG_LOCKFILE_SAVE_PATH")) |save_lockfile_path| {
this.save_lockfile_path = try allocator.dupeZ(u8, save_lockfile_path);
}

if (env.map.get("BUN_CONFIG_YARN_LOCKFILE") != null) {
Expand Down Expand Up @@ -5765,7 +5741,6 @@ pub const PackageManager = struct {
clap.parseParam("--no-save Don't save a lockfile") catch unreachable,
clap.parseParam("--save Save to package.json") catch unreachable,
clap.parseParam("--dry-run Don't install anything") catch unreachable,
clap.parseParam("--lockfile <PATH> Store & load a lockfile at a specific filepath") catch unreachable,
clap.parseParam("--frozen-lockfile Disallow changes to lockfile") catch unreachable,
clap.parseParam("-f, --force Always request the latest versions from the registry & reinstall all dependencies") catch unreachable,
clap.parseParam("--cache-dir <PATH> Store & load cached data from a specific directory path") catch unreachable,
Expand Down Expand Up @@ -5955,10 +5930,6 @@ pub const PackageManager = struct {
// }
// }

if (args.option("--lockfile")) |lockfile| {
cli.lockfile = lockfile;
}

if (args.option("--cwd")) |cwd_| {
var buf: [bun.MAX_PATH_BYTES]u8 = undefined;
var buf2: [bun.MAX_PATH_BYTES]u8 = undefined;
Expand Down Expand Up @@ -7756,7 +7727,7 @@ pub const PackageManager = struct {
save: {
if (manager.lockfile.isEmpty()) {
if (!manager.options.dry_run) {
std.fs.cwd().deleteFileZ(manager.options.save_lockfile_path) catch |err| brk: {
std.fs.cwd().deleteFileZ(manager.options.lockfile_path) catch |err| brk: {
// we don't care
if (err == error.FileNotFound) {
if (had_any_diffs) break :save;
Expand Down Expand Up @@ -7784,7 +7755,7 @@ pub const PackageManager = struct {
manager.progress.refresh();
}

manager.lockfile.saveToDisk(manager.options.save_lockfile_path);
manager.lockfile.saveToDisk(manager.options.lockfile_path);
if (comptime log_level.showProgress()) {
node.end();
manager.progress.refresh();
Expand Down