In preparation for making formatting work on ssh remotes Release Notes: - N/A
Showing the changes to crates/node_runtime/src/node_runtime.rs (1 of 6 files). Show all
Unified · Split
| @@ -462,3 +462,52 @@ impl NodeRuntime for FakeNodeRuntime { · 461 unmodified lines | |||
| 462 | unreachable!("Should not install packages {packages:?}") | 462 | unreachable!("Should not install packages {packages:?}") |
| 463 | } | 463 | } |
| 464 | } | 464 | } |
| 465 | |||
| 466 | // TODO: Remove this when headless binary can run node | ||
| 467 | pub struct DummyNodeRuntime; | ||
| 468 | |||
| 469 | impl DummyNodeRuntime { | ||
| 470 | pub fn new() -> Arc<dyn NodeRuntime> { | ||
| 471 | Arc::new(Self) | ||
| 472 | } | ||
| 473 | } | ||
| 474 | |||
| 475 | #[async_trait::async_trait] | ||
| 476 | impl NodeRuntime for DummyNodeRuntime { | ||
| 477 | async fn binary_path(&self) -> anyhow::Result<PathBuf> { | ||
| 478 | anyhow::bail!("Dummy Node Runtime") | ||
| 479 | } | ||
| 480 | |||
| 481 | async fn node_environment_path(&self) -> anyhow::Result<OsString> { | ||
| 482 | anyhow::bail!("Dummy node runtime") | ||
| 483 | } | ||
| 484 | |||
| 485 | async fn run_npm_subcommand( | ||
| 486 | &self, | ||
| 487 | _: Option<&Path>, | ||
| 488 | _subcommand: &str, | ||
| 489 | _args: &[&str], | ||
| 490 | ) -> anyhow::Result<Output> { | ||
| 491 | anyhow::bail!("Dummy node runtime") | ||
| 492 | } | ||
| 493 | |||
| 494 | async fn npm_package_latest_version(&self, _name: &str) -> anyhow::Result<String> { | ||
| 495 | anyhow::bail!("Dummy node runtime") | ||
| 496 | } | ||
| 497 | |||
| 498 | async fn npm_package_installed_version( | ||
| 499 | &self, | ||
| 500 | _local_package_directory: &Path, | ||
| 501 | _name: &str, | ||
| 502 | ) -> Result<Option<String>> { | ||
| 503 | anyhow::bail!("Dummy node runtime") | ||
| 504 | } | ||
| 505 | |||
| 506 | async fn npm_install_packages( | ||
| 507 | &self, | ||
| 508 | _: &Path, | ||
| 509 | _packages: &[(&str, &str)], | ||
| 510 | ) -> anyhow::Result<()> { | ||
| 511 | anyhow::bail!("Dummy node runtime") | ||
| 512 | } | ||
| 513 | } | ||