are the dependencies and frontend.entrypoint keys for asset canister definitions in dfx.json actually having an effect atm?
You can call dfx schema to check definition of keys in dfx.json.
As can be seen in a dfx new project: the frontend canister defines dependencies with the backend canister. This simply tell dfx that when there is a change in the backend, the frontend should also be redeployed.
There is no frontend.entrypoint key in dfx.json. Where frontend is present. The schema says âMostly unused. If this value is not null, a frontend URL is displayed after deployment even if the canister type is not âassetâ.â And it accept am object (key-value pairs). So, probably some project defines it as:
"frontend": {
"entrypoint": "some_value"
}
dfx doesnât really resolve the content of frontend. It just print a URL when frontend is not null.
dfxthat when there is a change in the backend, the frontend should also be redeployed.
Isnât that the case anyways? When I donât do any changes to my backend canister and run dfx deploy, dfx still always has a step to upload assets to the asset canister.
Generating a new project from dfx 12.0.0 creates the key for frontend canister, e.g.
"nns_test_frontend": {
"dependencies": [
"nns_test_backend"
],
"frontend": {
"entrypoint": "src/nns_test_frontend/src/index.html"
},
"source": [
"src/nns_test_frontend/assets",
"dist/nns_test_frontend/"
],
"type": "assets"
}
I noticed that if you removed the frontend entry, even though the canister is of type assets, the URL to access the Frontend is not displayed. I guess that is a bug?
//with frontend key
Deployed canisters.
URLs:
Frontend canister via browser
nns_test_frontend: http://127.0.0.1:4943/?canisterId=ryjl3-tyaaa-aaaaa-aaaba-cai
Backend canister via Candid interface:
nns_test_backend: http://127.0.0.1:4943/?canisterId=r7inp-6aaaa-aaaaa-aaabq-cai&id=rrkah-fqaaa-aaaaa-aaaaq-cai
// without frontend key
Deployed canisters.
URLs:
Backend canister via Candid interface:
nns_test_backend: http://127.0.0.1:4943/?canisterId=r7inp-6aaaa-aaaaa-aaabq-cai&id=rrkah-fqaaa-aaaaa-aaaaq-cai
I was aware of the dfx schema and the definitions of the keys, but I found some inconsistencies that are explained above. Hence my question wether those keys are deprecated now.
The entrypoint was never used by dfx in any way. We used it as a place to consolidate information about the canisters, but it only ever was used in webpack.
From my perspective as a frontend dev, I think the entrypoint in dfx.json is unnecessary and confusing
EDIT: dfx version mentioned in the linked page is different from top level version. but imo both are deprecated. the schema says version is to keep track of the different dfx.json versions, but dfx.json schema changed significantly while always being on version 1.
other keys that shouldnât be there by default imo are version and defaults. if weâre even suggesting to remove them, why are they there in the first place? iâd rather keep the dfx.json as clean an minimal as possible
bump @lwshang and 20 chars
I agree that the default new project from dfx new contains some noises that we should better remove.
Iâve write down this improvement request internally. Will get back to you when we make any progress.