Skip to content

Commit

Permalink
remove comment, change main to pathbuf
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacherr committed Mar 23, 2024
1 parent c267934 commit 84b3591
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
6 changes: 1 addition & 5 deletions crates/dash_node_impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,11 @@ pub fn run_with_nodejs_mnemnoics(path: &str, opt: OptLevel, initial_gc_threshold
async fn run_inner_fallible(path: &str, opt: OptLevel, initial_gc_threshold: Option<usize>) -> anyhow::Result<()> {
let path = Path::new(path);
let package_state = if path.is_dir() {
// TODO: make it also work with paths to files. need to adjust the execute_node_module call too,
// since that needs a dir path
process_package_json(path)?
} else {
PackageState {
base_dir: path.parent().unwrap_or(&env::current_dir()?).into(),
metadata: Package::default_with_entry(
String::from_utf8_lossy(path.to_str().unwrap_or_default().as_bytes()).to_string(),
),
metadata: Package::default_with_entry(path.into()),
}
};

Expand Down
5 changes: 3 additions & 2 deletions crates/dash_node_impl/src/package.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::collections::HashMap;
use std::path::PathBuf;

use dash_proc_macro::Trace;
use serde::Deserialize;
Expand All @@ -8,12 +9,12 @@ pub struct Package {
pub name: String,
pub version: String,
pub description: String,
pub main: String,
pub main: PathBuf,
#[serde(default)]
pub dependencies: HashMap<String, String>,
}
impl Package {
pub fn default_with_entry(entry: String) -> Self {
pub fn default_with_entry(entry: PathBuf) -> Self {
Package {
name: String::default(),
version: String::default(),
Expand Down

0 comments on commit 84b3591

Please sign in to comment.