Skip to content

Commit 05fd1ff

Browse files
authored
Write empty Deps.toml and Compat.toml files, but don't write empty WeakDeps.toml or WeakCompat.toml files (#82)
Fixes #81
1 parent cda894b commit 05fd1ff

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

src/register.jl

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,14 @@ function update_deps_file(pkg::Project,
387387
end
388388

389389
deps_data[pkg.version] = deps
390-
if !isempty(deps_data) && !all(isempty, values(deps_data))
390+
if file == "Deps.toml"
391+
# We always write the `Deps.toml` file, even if it is empty
392+
write_this_file = true
393+
else
394+
# We only write the `WeakDeps.toml` file if it is not empty
395+
write_this_file = !isempty(deps_data) && !all(isempty, values(deps_data))
396+
end
397+
if write_this_file
391398
Compress.save(deps_file, deps_data)
392399
end
393400
end
@@ -491,7 +498,14 @@ function update_compat_file(pkg::Project,
491498
end
492499

493500
compat_data[pkg.version] = d
494-
if !isempty(compat_data) && !all(isempty, values(compat_data))
501+
if file == "Compat.toml"
502+
# We always write the `Compat.toml` file, even if it is empty
503+
write_this_file = true
504+
else
505+
# We only write the `WeakCompat.toml` file if it is not empty
506+
write_this_file = !isempty(compat_data) && !all(isempty, values(compat_data))
507+
end
508+
if write_this_file
495509
Compress.save(compat_file, compat_data)
496510
end
497511
end

0 commit comments

Comments
 (0)