Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions scripts/autogenerate_files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,23 @@ set -eu
script_root="$(realpath "$(dirname "$0")")"
project_root="$(dirname "$script_root")"
cd "$project_root"
ruff_commit="$(git -C ruff rev-parse HEAD)"

echo "Updating lockfile..."
uv lock

echo "Copying reference documentation from Ruff..."
cp ./ruff/crates/ty/docs/cli.md ./docs/reference/
cp ./ruff/crates/ty/docs/configuration.md ./docs/reference/
cp ./ruff/crates/ty/docs/rules.md ./docs/reference/
cp ./ruff/crates/ty/docs/environment.md ./docs/reference/
copy_docs() {
src="$1"
dest="$2"
[ -d "$dest" ] && dest="$dest/$(basename "$src")"
old_url="/github.com/astral-sh/ruff/blob/main/"
new_url="/github.com/astral-sh/ruff/blob/$ruff_commit/"
sed "s|$old_url|$new_url|g" "$src" > "$dest"
}
copy_docs ./ruff/crates/ty/docs/cli.md ./docs/reference/
copy_docs ./ruff/crates/ty/docs/configuration.md ./docs/reference/
copy_docs ./ruff/crates/ty/docs/rules.md ./docs/reference/
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we only need this for rules.md, no other markdown file contains line-references

copy_docs ./ruff/crates/ty/docs/environment.md ./docs/reference/

echo "Documentation has been copied from Ruff submodule"
Loading