mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-09-24 13:40:11 +01:00
Website: exclude files that would cause problems for prebuild or jekyll (#4810)
Exclude some files from the website and prebuild steps that aren't part of the git repository, but may exist in a checkout, and if present will cause the website prebuild or build to misbehave or break. --------- Co-authored-by: Carbon Infra Bot <carbon-external-infra@google.com>
This commit is contained in:
co-authored by
Carbon Infra Bot
parent
13434f0e8a
commit
ef6e035e7d
@@ -10,6 +10,13 @@ theme: just-the-docs
|
||||
|
||||
favicon_ico: '/favicon.png'
|
||||
|
||||
exclude:
|
||||
- '.*'
|
||||
- '**/node_modules'
|
||||
- '**/dist'
|
||||
- 'bazel-*'
|
||||
- 'utils/vscode/images/icon.png'
|
||||
|
||||
aux_links:
|
||||
Discord: https://discord.gg/ZjVdShJDAs
|
||||
GitHub: https://github.com/carbon-language/carbon-lang
|
||||
|
||||
+14
-8
@@ -84,11 +84,23 @@ def label_subdir(
|
||||
readme = subdir / "README.md"
|
||||
readme_content = readme.read_text()
|
||||
|
||||
def include_child(md_file: Path) -> bool:
|
||||
"""Returns whether md_file is a child of this label."""
|
||||
# The top-level README.md isn't a child.
|
||||
if md_file == readme:
|
||||
return False
|
||||
# Skip directories that aren't part of the repository.
|
||||
if "/node_modules/" in str(md_file):
|
||||
return False
|
||||
if "/dist/" in str(md_file):
|
||||
return False
|
||||
return True
|
||||
|
||||
readme_title = get_title(readme, readme_content)
|
||||
readme_titles = [readme_title]
|
||||
if parent_title:
|
||||
readme_titles.insert(0, parent_title)
|
||||
children = [x for x in subdir.glob("**/*.md") if x != readme]
|
||||
children = [x for x in subdir.glob("**/*.md") if include_child(x)]
|
||||
add_frontmatter(
|
||||
readme, readme_content, readme_titles, top_nav_order, bool(children)
|
||||
)
|
||||
@@ -146,12 +158,6 @@ def main() -> None:
|
||||
# Ensure this runs from the repo root.
|
||||
os.chdir(Path(__file__).parents[1])
|
||||
|
||||
# bazel-execroot interferes with jekyll because it's a broken symlink.
|
||||
Path("bazel-execroot").unlink()
|
||||
# This is a symlink to website/favicon.png, which is moved below.
|
||||
# TODO: Consider moving the icon to a location which won't break.
|
||||
Path("utils/vscode/images/icon.png").unlink()
|
||||
|
||||
# The external symlink is created by scripts/create_compdb.py, and can
|
||||
# interfere with local execution.
|
||||
external = Path("external")
|
||||
@@ -160,7 +166,7 @@ def main() -> None:
|
||||
|
||||
# Move files to the repo root.
|
||||
for f in Path("website").iterdir():
|
||||
if f.name == "README.md":
|
||||
if f.name in ["README.md", ".jekyll-cache", "_site"]:
|
||||
continue
|
||||
f.rename(f.name)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user