-
-
Notifications
You must be signed in to change notification settings - Fork 723
fix(ast_tools): enable oxc_ast_tools to be run from any directory
#13898
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
fix(ast_tools): enable oxc_ast_tools to be run from any directory
#13898
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes the oxc_ast_tools to be runnable from any directory by using the CARGO_MANIFEST_DIR environment variable to determine the repository root path instead of relying on the current working directory.
- Adds a
root_pathfield to theCodegenstruct to store the repository root path - Updates file path handling to use absolute paths based on the repository root
- Passes the root path parameter through the parsing and output writing functions
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tasks/ast_tools/src/codegen.rs | Adds root path calculation and storage to Codegen struct |
| tasks/ast_tools/src/parse/mod.rs | Updates file parsing to accept and use root path parameter |
| tasks/ast_tools/src/parse/load.rs | Modifies file loading to use root-relative paths |
| tasks/ast_tools/src/output/mod.rs | Updates output writing to use root-relative paths |
| tasks/ast_tools/src/main.rs | Updates calls to use the root path for file operations |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Merge activity
|
…13898) Get path to root of repo from `CARGO_MANIFEST_DIR` env var rather than `env::current_dir`, so it doesn't depend on `cwd`. This means that you can run `cargo run -p oxc_ast_tools` from anywhere in the repo, which is really useful when working on parser + linter NAPI packages which contain generated code. The root path will also be used in another PR to follow which generates an ESTree walker.
2c96551 to
7d45b2f
Compare

Get path to root of repo from
CARGO_MANIFEST_DIRenv var rather thanenv::current_dir, so it doesn't depend oncwd.This means that you can run
cargo run -p oxc_ast_toolsfrom anywhere in the repo, which is really useful when working on parser + linter NAPI packages which contain generated code.The root path will also be used in another PR to follow which generates an ESTree walker.