Skip to content

Commit 058c246

Browse files
committed
feat: add dart support
1 parent 86dbbae commit 058c246

File tree

6 files changed

+468
-6
lines changed

6 files changed

+468
-6
lines changed

Cargo.lock

Lines changed: 22 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ reqwest = { version = "0.12", default-features = false, features = [
2727
] }
2828
serde = { version = "1", features = ["derive"] }
2929
serde_json = "1"
30+
serde_yaml = "0.9"
3031
toml = "0.9"
3132
thiserror = "2"
3233
url = "2"

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@ https://github.com/user-attachments/assets/d7a7b047-312e-4d56-ba5d-25ed6eb2e5ce
1414

1515
The following ecosystems are currently detected when you run the tool:
1616

17-
| Ecosystem | Detection Source | Implementation |
17+
| Ecosystem | Detection Source | Implementation |
1818
| --------------- | ------------------------------------------------------------------------------ | ---------------------------------------------------------- |
1919
| Cargo (Rust) | `Cargo.toml` | [`src/ecosystems/cargo.rs`](src/ecosystems/cargo.rs) |
2020
| Node.js | `package.json` | [`src/ecosystems/node.rs`](src/ecosystems/node.rs) |
2121
| Go (Go Modules) | `go.mod` | [`src/ecosystems/go.rs`](src/ecosystems/go.rs) |
22+
| Dart | `pubspec.yaml` | [`src/ecosystems/dart.rs`](src/ecosystems/dart.rs) |
2223
| Composer (PHP) | `composer.lock` / `composer.json` | [`src/ecosystems/composer.rs`](src/ecosystems/composer.rs) |
2324
| Ruby (Bundler) | `Gemfile` / `Gemfile.lock` | [`src/ecosystems/ruby.rs`](src/ecosystems/ruby.rs) |
2425
| Python | `pyproject.toml` / `requirements.txt` / `Pipfile` / `Pipfile.lock` / `uv.lock` | [`src/ecosystems/python.rs`](src/ecosystems/python.rs) |

src/discovery.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ use std::thread;
33

44
use crate::ecosystems::{
55
CargoDiscoverer, CargoDiscoveryError, CommandMetadataFetcher, ComposerDiscoverer,
6-
ComposerDiscoveryError, GoDiscoverer, GoDiscoveryError, GradleDiscoverer, GradleDiscoveryError,
7-
NodeDiscoverer, NodeDiscoveryError, PythonDiscoverer, PythonDiscoveryError, RenvDiscoverer,
8-
RenvDiscoveryError, RubyDiscoverer, RubyDiscoveryError,
6+
ComposerDiscoveryError, DartDiscoverer, DartDiscoveryError, GoDiscoverer, GoDiscoveryError,
7+
GradleDiscoverer, GradleDiscoveryError, NodeDiscoverer, NodeDiscoveryError, PythonDiscoverer,
8+
PythonDiscoveryError, RenvDiscoverer, RenvDiscoveryError, RubyDiscoverer, RubyDiscoveryError,
99
};
1010
use url::Url;
1111

@@ -22,6 +22,7 @@ pub enum Framework {
2222
Node,
2323
Cargo,
2424
Go,
25+
Dart,
2526
Composer,
2627
Ruby,
2728
Python,
@@ -38,6 +39,8 @@ pub enum DiscoveryError {
3839
#[error(transparent)]
3940
Go(Box<GoDiscoveryError>),
4041
#[error(transparent)]
42+
Dart(Box<DartDiscoveryError>),
43+
#[error(transparent)]
4144
Composer(Box<ComposerDiscoveryError>),
4245
#[error(transparent)]
4346
Ruby(Box<RubyDiscoveryError>),
@@ -62,6 +65,7 @@ macro_rules! impl_from_discovery_error {
6265
impl_from_discovery_error!(Node, NodeDiscoveryError);
6366
impl_from_discovery_error!(Cargo, CargoDiscoveryError);
6467
impl_from_discovery_error!(Go, GoDiscoveryError);
68+
impl_from_discovery_error!(Dart, DartDiscoveryError);
6569
impl_from_discovery_error!(Composer, ComposerDiscoveryError);
6670
impl_from_discovery_error!(Ruby, RubyDiscoveryError);
6771
impl_from_discovery_error!(Python, PythonDiscoveryError);
@@ -83,6 +87,9 @@ pub fn detect_frameworks(project_root: &Path) -> Vec<Framework> {
8387
if project_root.join("go.mod").exists() {
8488
frameworks.push(Framework::Go);
8589
}
90+
if project_root.join("pubspec.yaml").exists() {
91+
frameworks.push(Framework::Dart);
92+
}
8693
if project_root.join("composer.lock").exists() || project_root.join("composer.json").exists() {
8794
frameworks.push(Framework::Composer);
8895
}
@@ -132,6 +139,10 @@ pub fn discover_for_frameworks(
132139
let discoverer = GoDiscoverer::new();
133140
discoverer.discover(project_root)?
134141
}
142+
Framework::Dart => {
143+
let discoverer = DartDiscoverer::new();
144+
discoverer.discover(project_root)?
145+
}
135146
Framework::Composer => {
136147
let discoverer = ComposerDiscoverer::new();
137148
discoverer.discover(project_root)?

0 commit comments

Comments
 (0)