Skip to content

Commit bf240f7

Browse files
committed
successful package publishing to temp
1 parent 3e84ee9 commit bf240f7

2 files changed

Lines changed: 31 additions & 12 deletions

File tree

crates/wasm-pkg-core/src/resolver.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -884,13 +884,15 @@ impl PublishPlan {
884884
.neighbors_directed(id, Direction::Outgoing)
885885
.peekable();
886886
if neighbors.peek().is_none() {
887-
tracing::debug!("{dep} has no dependents");
887+
// tracing::debug!("{dep} has no dependents");
888+
println!("{dep} has no dependents");
888889
}
889890

890-
if tracing::enabled!(Level::DEBUG) {
891+
// if tracing::enabled!(Level::DEBUG) {
892+
if true {
891893
while let Some(id) = neighbors.next() {
892894
let pkg = &self.dependents[id];
893-
tracing::debug!("{dep} -(DependencyOF)-> {pkg}");
895+
println!("{dep} -(DependencyOF)-> {pkg}");
894896
}
895897
}
896898

crates/wkg/src/main.rs

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -272,18 +272,35 @@ impl PublishArgs {
272272
[path] => path,
273273
paths => {
274274
let (overlay, tmp_dir) = wasm_pkg_client::local::LocalBackend::temp_dir()?;
275+
let local_backend = wasm_pkg_client::local::LocalConfig {
276+
root: tmp_dir.path().to_path_buf(),
277+
};
278+
let mut reg_config = RegistryConfig::default();
279+
reg_config.set_default_backend(Some("local".to_owned()));
280+
reg_config.set_backend_config("local", &local_backend)?;
281+
275282
let plan = PublishPlan::from_paths(paths)?;
276283
let mut lock_file = LockFile::load(true).await?;
277-
for spec in plan.iter_edges() {
278-
let mut reg_config = RegistryConfig::default();
279-
reg_config.set_default_backend(Some("local".to_owned()));
280-
reg_config.set_backend_config(
281-
"local",
282-
wasm_pkg_client::local::LocalConfig {
283-
root: tmp_dir.path().to_path_buf(),
284-
},
284+
285+
// Route every package in the plan to the local overlay registry
286+
// backed by `reg_config`, so the client used in `build_wit_dir`
287+
// resolves these packages against the local overlay instead of
288+
// an upstream remote.
289+
let mut config = self.common.load_config().await?;
290+
let local_registry: Registry = "local".parse()?;
291+
config
292+
.get_or_insert_registry_config_mut(&local_registry)
293+
.merge(reg_config);
294+
for spec in plan.iter() {
295+
config.set_package_registry_override(
296+
spec.package.clone(),
297+
RegistryMapping::Registry(local_registry.clone()),
285298
);
286-
let client = client.client.as_mut().unwrap();
299+
}
300+
let cache = self.common.load_cache().await?;
301+
let client = CachingClient::new(Some(Client::new(config)), cache);
302+
303+
for spec in plan.iter_edges() {
287304
let path = plan.get_path(&spec.package).unwrap();
288305
let (publish_path, _tmp) = if path.is_dir() {
289306
let _prev_lock_ref = (lock_file.version, lock_file.packages.clone());

0 commit comments

Comments
 (0)