chore: update Azle templates to 0.31.0#4040
Conversation
|
Dear @lastmjs, In order to potentially merge your code in this open-source repository and therefore proceed with your contribution, we need to have your approval on DFINITY's CLA. If you decide to agree with it, please visit this issue and read the instructions there. Once you have signed it, re-trigger the workflow on this PR to see if your code can be merged. — The DFINITY Foundation |
There was a problem hiding this comment.
The following fails, because with this setup the backend canister (type=azle) is relying on a frontend canister to run npm install to install the azle extension.
It might be enough for this specific case to move the npm install post_create setup in templates.js to the dfx_js_base template.
Even then, if npm install fails (and notice that dfx new is specifically set up to treat this as a warning), all dfx commands run in the project will report an error like the one below until npm install is run and succeeds.
$ dfx cache delete
$ dfx new azt --type azle --frontend none
Fetching manifest https://sdk.dfinity.org/manifest.json
Installed dfx 0.24.3-azletest to cache.
Creating new project "azt"...
Initializing git repository...
===============================================================================
Welcome to the internet computer developer community!
To learn more before you start coding, check out the developer docs and samples:
- Documentation: https://internetcomputer.org/docs/current/developer-docs
- Samples: https://internetcomputer.org/samples
===============================================================================
$ cd azt
$ dfx deploy
Error: Failed to create AgentEnvironment.
Caused by: canister 'azt_backend' has unknown type 'azle' and there is no installed extension by that name which could define it
I assume you meant |
| }, | ||
| category: ProjectTemplateCategory::Support, | ||
| post_create: vec![], | ||
| post_create: vec![NPM_INSTALL.to_string()], |
There was a problem hiding this comment.
This should remove the post create fields from the templates that require dfx_js_base, and add them here.
There was a problem hiding this comment.
I believe I have done this correctly now
src/dfx/src/lib/project/templates.rs
Outdated
| post_create_failure_warning: None, | ||
| post_create_spinner_message: None, |
There was a problem hiding this comment.
These post_create failure and spinner messages should also be moved from the referencing templates
0.29.0
There was a problem hiding this comment.
This is the tsconfig.json that we recommend for Azle projects, will this clash with your frontend code? I'm not sure what else this is used for.
0.29.00.31.0
I've updated the Azle template to I'm struggling to reproduce this exact error condition locally. Are you sure that you have set all of your I've checked in the Can you confirm that I am correct? |
|
@lastmjs I'll double check but I would expect that you would see this error if you're starting from scratch and you don't have the azle extension installed already (ie you've never run |
|
@raymondk Yes my testing in response to the problem reported is for that exact situation, at least with this command: I do not see this problem presenting locally, and I've tried to invoke it. My explanation above explains some caveats that may lead you to believe there is an issue when there is not. When you say starting from scratch, you're talking about using |
|
It would be great to get this merged ASAP. It would also be great if DFINITY could somehow take over maintenance of That being said, if there is some way for the Azle extension itself to define these templates, that would be even more ideal, since we own the extension and can keep it up to date easily. |
Description
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.
The
dfx newcommand forAzlehas been out-of-date for a while now. This PR updatesAzle's templates to the latest version and simplifies the templates with new changes possible because of the latest version.How Has This Been Tested?
I built the sdk locally and manually used the
dfx newcommand to create a new example project. I then deployed the project and checked that it worked in the Candid UI.Checklist: