Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update Azle templates to 0.25.0 #4040

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

lastmjs
Copy link

@lastmjs lastmjs commented Dec 14, 2024

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.

The dfx new command for Azle has been out-of-date for a while now. This PR updates Azle'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 new command to create a new example project. I then deployed the project and checked that it worked in the Candid UI.

Checklist:

  • The title of this PR complies with Conventional Commits. (From @lastmjs Is this considered a breaking change?)
  • I have edited the CHANGELOG accordingly. (From @lastmjs do I need to edit the CHANGELOG?)
  • I have made corresponding changes to the documentation. (From @lastmjs Azle's documentation in DFINITY's web properties is generally out-of-date...I hear that soon DFINITY will simply point to Demergent Labs' documentation)

@lastmjs lastmjs requested a review from a team as a code owner December 14, 2024 18:10
@cla-idx-bot
Copy link

cla-idx-bot bot commented Dec 14, 2024

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

krpeacock
krpeacock previously approved these changes Jan 6, 2025
Copy link
Member

@ericswanson-dfinity ericswanson-dfinity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@lastmjs
Copy link
Author

lastmjs commented Jan 10, 2025

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.

I assume you meant templates.rs. I have attempted to do what you've described here, as well as updating Azle to its latest 0.25.0.

@@ -226,7 +226,7 @@ pub fn builtin_templates() -> Vec<ProjectTemplate> {
get_archive_fn: assets::new_project_js_files,
},
category: ProjectTemplateCategory::Support,
post_create: vec![],
post_create: vec![NPM_INSTALL.to_string()],

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should remove the post create fields from the templates that require dfx_js_base, and add them here.

Copy link
Author

@lastmjs lastmjs Jan 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe I have done this correctly now

@lastmjs lastmjs changed the title chore: update Azle templates to 0.24.1 chore: update Azle templates to 0.25.0 Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants