Add gitignore to dist directory

The build artifacts in `dist` are not meant to be checked in, so we're adding a gitignore to this directory, like `.venv`.
This commit is contained in:
konstin
2024-10-01 14:18:26 +02:00
parent 1602b5c8d7
commit f68e3dfd9d
+14 -1
View File
@@ -1,5 +1,7 @@
use std::borrow::Cow;
use std::fmt::Write;
use std::fmt::Write as _;
use std::io;
use std::io::Write as _;
use std::path::{Path, PathBuf};
use anyhow::Result;
@@ -483,6 +485,17 @@ async fn build_package(
// Create the output directory.
fs_err::tokio::create_dir_all(&output_dir).await?;
// Add a .gitignore.
match fs_err::OpenOptions::new()
.write(true)
.create_new(true)
.open(output_dir.join(".gitignore"))
{
Ok(mut file) => file.write_all(b"*")?,
Err(err) if err.kind() == io::ErrorKind::AlreadyExists => (),
Err(err) => return Err(err.into()),
}
// Determine the build plan.
let plan = match &source.source {
Source::File(_) => {