Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Website: exclude files that would cause problems for prebuild or jekyll #4810

Merged
merged 6 commits into from
Jan 17, 2025

Conversation

zygoloid
Copy link
Contributor

@zygoloid zygoloid commented Jan 15, 2025

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.

Delete some files that aren't part of the git repository, but may exist
in a checkout and will cause the website build to misbehave or break.
@github-actions github-actions bot requested a review from josh11b January 15, 2025 20:42
@zygoloid zygoloid requested review from jonmeow and removed request for josh11b January 15, 2025 20:42
website/prebuild.py Outdated Show resolved Hide resolved
website/prebuild.py Outdated Show resolved Hide resolved
Copy link
Contributor

@jonmeow jonmeow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving from the response, but might still want to look at rmtree

@zygoloid
Copy link
Contributor Author

I've followed the suggestion to exclude things rather than deleting them. I think that's better; deleting the node_modules in particular is a bit rude given that they would still be wanted for (eg) ongoing development of the vscode extension. There are three different cases here:

  • .jekyll-cache and _site are not renamed from checkout/website/ to checkout/ because they might already exist in the destination and in any case wouldn't contain the right things.
  • **/node_modules/**/*.md and **/dist/**/*.md are not included when building the navigation tree because they're not part of the repository. (This only really affects utils/vscode because it has a custom gitignore for these, but I've excluded them globally for simplicity.) They formerly caused the python script to break because parsing the title failed.
  • The .bazel symlinks, as well as node_modules and dist, are now excluded from jekyll's build because they can be or contain broken symlinks as well as markdown files we don't want to include in the build. Same for .cache, but I've excluded all dot-files for safety.

@zygoloid zygoloid requested a review from jonmeow January 15, 2025 22:51
@zygoloid zygoloid changed the title Website prebuild: delete some more files. Website: exclude files that would cause problems for prebuild or jekyll Jan 15, 2025
Comment on lines 91 to 97
children = [
x
for x in subdir.glob("**/*.md")
if x != readme
and "/node_modules/" not in str(x)
and "/dist/" not in str(x)
]
Copy link
Contributor

@jonmeow jonmeow Jan 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
children = [
x
for x in subdir.glob("**/*.md")
if x != readme
and "/node_modules/" not in str(x)
and "/dist/" not in str(x)
]
children = []
for x in subdir.glob("**/*.md"):
if x != readme and not ("/node_modules/" in str(x) or "/dist/" in str(x)):
children.append(x)

This just because of the difficulty of reading multi-line comprehension conditions

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, or moving the not (this is bikeshedding at this point):

Suggested change
children = [
x
for x in subdir.glob("**/*.md")
if x != readme
and "/node_modules/" not in str(x)
and "/dist/" not in str(x)
]
children = []
for x in subdir.glob("**/*.md"):
if not (x == readme or "/node_modules/" in str(x) or "/dist/" in str(x)):
children.append(x)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Factored out the predicate as a function.

@zygoloid zygoloid requested a review from jonmeow January 16, 2025 00:20
website/prebuild.py Outdated Show resolved Hide resolved
@zygoloid zygoloid enabled auto-merge January 16, 2025 00:40
website/prebuild.py Outdated Show resolved Hide resolved
Co-authored-by: Carbon Infra Bot <[email protected]>
@zygoloid zygoloid added this pull request to the merge queue Jan 17, 2025
Merged via the queue into carbon-language:trunk with commit ef6e035 Jan 17, 2025
8 checks passed
@zygoloid zygoloid deleted the website-prebuild-fixes branch January 17, 2025 20:51
dwblaikie pushed a commit to dwblaikie/carbon-lang that referenced this pull request Jan 21, 2025
…ll (carbon-language#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 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants