Skip to content

Commit

Permalink
feat(turbo): add version query (#9197)
Browse files Browse the repository at this point in the history
### Description

Add version query so studio can negotiate version

### Testing Instructions

<!--
  Give a quick description of steps to test your changes.
-->
  • Loading branch information
NicholasLYang authored Sep 27, 2024
1 parent 349dd47 commit cd86f80
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions crates/turborepo-lib/src/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use turbopath::AbsoluteSystemPathBuf;
use turborepo_repository::package_graph::PackageName;

use crate::{
get_version,
query::file::File,
run::{builder::RunBuilder, Run},
signal::SignalHandler,
Expand Down Expand Up @@ -315,6 +316,10 @@ impl RepositoryQuery {
})
}

async fn version(&self) -> &'static str {
get_version()
}

async fn file(&self, path: String) -> Result<File, Error> {
let abs_path = AbsoluteSystemPathBuf::from_unknown(self.run.repo_root(), path);

Expand Down
8 changes: 8 additions & 0 deletions turborepo-tests/integration/tests/command-query.t
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,12 @@ Run the query
]
}
}
}
$ ${TURBO} query "query { version }"
WARNING query command is experimental and may change in the future
{
"data": {
"version": "2.1.3-canary.2"
}
}

0 comments on commit cd86f80

Please sign in to comment.