Skip to content

Commit ed193d3

Browse files
committed
🐛 Include hidden files in app archive
1 parent 38c8049 commit ed193d3

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

src/fastapi_cloud_cli/commands/deploy.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,15 @@ def _get_app_name(path: Path) -> str:
3434

3535

3636
def _should_exclude_entry(path: Path) -> bool:
37-
parts_to_exclude = [".venv", "__pycache__", ".mypy_cache", ".pytest_cache"]
37+
parts_to_exclude = [
38+
".venv",
39+
"__pycache__",
40+
".mypy_cache",
41+
".pytest_cache",
42+
".git",
43+
".gitignore",
44+
".fastapicloudignore",
45+
]
3846

3947
if any(part in path.parts for part in parts_to_exclude):
4048
return True
@@ -51,6 +59,7 @@ def archive(path: Path, tar_path: Path) -> Path:
5159
path,
5260
should_exclude_entry=_should_exclude_entry,
5361
additional_ignore_paths=[".fastapicloudignore"],
62+
ignore_hidden=False,
5463
)
5564

5665
logger.debug("Archive will be created at: %s", tar_path)

tests/test_archive.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,3 +116,24 @@ def test_archive_respects_fastapicloudignore_unignore(
116116
with tarfile.open(tar_path, "r") as tar:
117117
names = tar.getnames()
118118
assert set(names) == {"main.py", "static/build/style.css"}
119+
120+
121+
def test_archive_includes_hidden_files(src_path: Path, tar_path: Path) -> None:
122+
"""Should include hidden files in the archive by default."""
123+
# Create test files
124+
(src_path / "main.py").write_text("print('hello')")
125+
(src_path / ".env").write_text("SECRET_KEY=xyz")
126+
(src_path / ".config").mkdir()
127+
(src_path / ".config" / "settings.json").write_text('{"setting": "value"}')
128+
129+
# Create archive
130+
archive(src_path, tar_path)
131+
132+
# Verify hidden files are included
133+
with tarfile.open(tar_path, "r") as tar:
134+
names = tar.getnames()
135+
assert set(names) == {
136+
"main.py",
137+
".env",
138+
".config/settings.json",
139+
}

0 commit comments

Comments
 (0)