diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b9bffcec4..a9a15c9a82 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ # UNRELEASED +### fix: Include remote canisters in canisters_to_generate + +Generate frontend declarations for remote canisters too because frontend JS code may want to call them. + ### feat: Updated handling of missing values in state tree certificates The `Unknown` lookup of a path in a certificate results in an `AgentError` (the IC returns `Absent` for non-existing paths). diff --git a/e2e/tests-dfx/remote.bash b/e2e/tests-dfx/remote.bash index 1f71418f72..cdc4b9f22c 100644 --- a/e2e/tests-dfx/remote.bash +++ b/e2e/tests-dfx/remote.bash @@ -200,6 +200,15 @@ teardown() { assert_command jq .remote canister_ids.json assert_eq "null" + + # Assert frontend declarations are actually created + dfx generate + assert_file_exists "src/declarations/remote/remote.did" + assert_file_exists "src/declarations/remote/remote.did.js" + assert_file_exists "src/declarations/remote/remote.did.d.ts" + assert_file_exists "src/declarations/remote/index.js" + assert_file_exists "src/declarations/remote/index.d.ts" + } @test "for remote build, checks imports against the candid file rather than the mock" { diff --git a/src/dfx/src/commands/generate.rs b/src/dfx/src/commands/generate.rs index fad64afda1..17992ef765 100644 --- a/src/dfx/src/commands/generate.rs +++ b/src/dfx/src/commands/generate.rs @@ -35,16 +35,7 @@ pub fn exec(env: &dyn Environment, opts: GenerateOpts) -> DfxResult { let canisters_to_load = config .get_config() .get_canister_names_with_dependencies(opts.canister_name.as_deref())?; - let canisters_to_generate = canisters_to_load - .clone() - .into_iter() - .filter(|canister_name| { - !config - .get_config() - .is_remote_canister(canister_name, &env.get_network_descriptor().name) - .unwrap_or(false) - }) - .collect(); + let canisters_to_generate = canisters_to_load.clone().into_iter().collect(); let canister_pool_load = CanisterPool::load(&env, false, &canisters_to_load)?;