Skip to content

Commit

Permalink
Write empty Deps.toml and Compat.toml files, but don't write empt…
Browse files Browse the repository at this point in the history
…y `WeakDeps.toml` or `WeakCompat.toml` files (#82)

Fixes #81
  • Loading branch information
DilumAluthge authored Jan 16, 2023
1 parent cda894b commit 05fd1ff
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/register.jl
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,14 @@ function update_deps_file(pkg::Project,
end

deps_data[pkg.version] = deps
if !isempty(deps_data) && !all(isempty, values(deps_data))
if file == "Deps.toml"
# We always write the `Deps.toml` file, even if it is empty
write_this_file = true
else
# We only write the `WeakDeps.toml` file if it is not empty
write_this_file = !isempty(deps_data) && !all(isempty, values(deps_data))
end
if write_this_file
Compress.save(deps_file, deps_data)
end
end
Expand Down Expand Up @@ -491,7 +498,14 @@ function update_compat_file(pkg::Project,
end

compat_data[pkg.version] = d
if !isempty(compat_data) && !all(isempty, values(compat_data))
if file == "Compat.toml"
# We always write the `Compat.toml` file, even if it is empty
write_this_file = true
else
# We only write the `WeakCompat.toml` file if it is not empty
write_this_file = !isempty(compat_data) && !all(isempty, values(compat_data))
end
if write_this_file
Compress.save(compat_file, compat_data)
end
end
Expand Down

0 comments on commit 05fd1ff

Please sign in to comment.