mirror of
https://github.com/pesde-pkg/pesde.git
synced 2025-04-06 03:40:59 +01:00
feat: copy over peer pesde deps of scripts pkg in init command
This commit is contained in:
parent
5513ef41a3
commit
4d3ddd50cb
1 changed files with 21 additions and 3 deletions
|
@ -5,11 +5,12 @@ use colored::Colorize;
|
||||||
use inquire::validator::Validation;
|
use inquire::validator::Validation;
|
||||||
use pesde::{
|
use pesde::{
|
||||||
errors::ManifestReadError,
|
errors::ManifestReadError,
|
||||||
manifest::target::TargetKind,
|
manifest::{target::TargetKind, DependencyType},
|
||||||
names::PackageName,
|
names::PackageName,
|
||||||
source::{
|
source::{
|
||||||
git_index::GitBasedSource,
|
git_index::GitBasedSource,
|
||||||
pesde::{specifier::PesdeDependencySpecifier, PesdePackageSource},
|
pesde::{specifier::PesdeDependencySpecifier, PesdePackageSource},
|
||||||
|
specifiers::DependencySpecifiers,
|
||||||
traits::PackageSource,
|
traits::PackageSource,
|
||||||
},
|
},
|
||||||
Project, DEFAULT_INDEX_NAME, SCRIPTS_LINK_FOLDER,
|
Project, DEFAULT_INDEX_NAME, SCRIPTS_LINK_FOLDER,
|
||||||
|
@ -158,11 +159,28 @@ impl InitCommand {
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
let field = &mut manifest["dev_dependencies"]
|
let dev_deps = &mut manifest["dev_dependencies"]
|
||||||
.or_insert(toml_edit::Item::Table(toml_edit::Table::new()))["scripts"];
|
.or_insert(toml_edit::Item::Table(toml_edit::Table::new()));
|
||||||
|
|
||||||
|
let field = &mut dev_deps["scripts"];
|
||||||
field["name"] = toml_edit::value(pkg_ref.name.to_string());
|
field["name"] = toml_edit::value(pkg_ref.name.to_string());
|
||||||
field["version"] = toml_edit::value(format!("^{}", v_id.version()));
|
field["version"] = toml_edit::value(format!("^{}", v_id.version()));
|
||||||
field["target"] = toml_edit::value(v_id.target().to_string());
|
field["target"] = toml_edit::value(v_id.target().to_string());
|
||||||
|
|
||||||
|
for (alias, (spec, ty)) in pkg_ref.dependencies {
|
||||||
|
if ty != DependencyType::Peer {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
let DependencySpecifiers::Pesde(spec) = spec else {
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
|
||||||
|
let field = &mut dev_deps[alias];
|
||||||
|
field["name"] = toml_edit::value(spec.name.to_string());
|
||||||
|
field["version"] = toml_edit::value(spec.version.to_string());
|
||||||
|
field["target"] = toml_edit::value(v_id.target().to_string());
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
println!(
|
println!(
|
||||||
"{}",
|
"{}",
|
||||||
|
|
Loading…
Add table
Reference in a new issue