mirror of
https://github.com/oven-sh/bun
synced 2026-02-02 15:08:46 +00:00
Remove the ability to configure lockfile. (#5335)
This commit is contained in:
@@ -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 ))]}";
|
||||
|
||||
|
||||
@@ -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]' \
|
||||
@@ -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]' \
|
||||
@@ -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]' \
|
||||
@@ -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]'
|
||||
@@ -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]' \
|
||||
@@ -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]' \
|
||||
@@ -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)'"
|
||||
|
||||
@@ -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"
|
||||
@@ -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"
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -142,8 +136,6 @@ export interface Cache {
|
||||
|
||||
export interface Lockfile {
|
||||
print?: "yarn";
|
||||
path: string;
|
||||
savePath: string;
|
||||
save: boolean;
|
||||
}
|
||||
```
|
||||
@@ -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 |
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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| {
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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 = "",
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
@@ -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,
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user