Skip to content

chore: update Azle templates to 0.29.0 #4040

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

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
3 changes: 1 addition & 2 deletions src/dfx/assets/project_templates/any_js/tsconfig.json
Copy link
Author

Choose a reason for hiding this comment

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

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.

Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
"compilerOptions": {
"strict": true,
"target": "ES2020",
"experimentalDecorators": true,
"strictPropertyInitialization": false,
"module": "ES2020",
"moduleResolution": "node",
"allowJs": true,
"outDir": "HACK_BECAUSE_OF_ALLOW_JS"
Expand Down
17 changes: 2 additions & 15 deletions src/dfx/assets/project_templates/azle/dfx.json-patch
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,8 @@
"path": "/canisters/__backend_name__",
"op": "add",
"value": {
"type": "custom",
"main": "src/__backend_name__/src/index.ts",
"candid": "src/__backend_name__/__backend_name__.did",
"build": "npx azle __backend_name__",
"wasm": ".azle/__backend_name__/__backend_name__.wasm",
"gzip": true,
"tech_stack": {
"language": {
"javascript": {},
"typescript": {}
},
"cdk": {
"azle": {}
}
}
"type": "azle",
"main": "src/__backend_name__/src/index.ts"
}
}
]

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"private": true,
"type": "module",
"dependencies": {
"azle": "^0.19.0"
"azle": "^0.25.0"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
import { Canister, query, text } from 'azle';
import { IDL, query, update } from 'azle';

export default Canister({
greet: query([text], text, (name) => {
return `Hello, ${name}!`;
})
})
export default class {
message: string = 'Hello world!';

@query([], IDL.Text)
getMessage(): string {
return this.message;
}

@update([IDL.Text])
setMessage(message: string): void {
this.message = message;
}
}
10 changes: 5 additions & 5 deletions src/dfx/src/lib/project/templates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ pub fn builtin_templates() -> Vec<ProjectTemplate> {
get_archive_fn: assets::new_project_svelte_files,
},
category: ProjectTemplateCategory::Frontend,
post_create: vec![NPM_INSTALL.to_string()],
post_create: vec![],
post_create_failure_warning: Some(NPM_INSTALL_FAILURE_WARNING.to_string()),
post_create_spinner_message: Some(NPM_INSTALL_SPINNER_MESSAGE.to_string()),
requirements: vec![ProjectTemplateName("dfx_js_base".to_string())],
Expand All @@ -86,7 +86,7 @@ pub fn builtin_templates() -> Vec<ProjectTemplate> {
get_archive_fn: assets::new_project_react_files,
},
category: ProjectTemplateCategory::Frontend,
post_create: vec![NPM_INSTALL.to_string()],
post_create: vec![],
post_create_failure_warning: Some(NPM_INSTALL_FAILURE_WARNING.to_string()),
post_create_spinner_message: Some(NPM_INSTALL_SPINNER_MESSAGE.to_string()),
requirements: vec![ProjectTemplateName("dfx_js_base".to_string())],
Expand All @@ -100,7 +100,7 @@ pub fn builtin_templates() -> Vec<ProjectTemplate> {
get_archive_fn: assets::new_project_vue_files,
},
category: ProjectTemplateCategory::Frontend,
post_create: vec![NPM_INSTALL.to_string()],
post_create: vec![],
post_create_failure_warning: Some(NPM_INSTALL_FAILURE_WARNING.to_string()),
post_create_spinner_message: Some(NPM_INSTALL_SPINNER_MESSAGE.to_string()),
requirements: vec![ProjectTemplateName("dfx_js_base".to_string())],
Expand All @@ -114,7 +114,7 @@ pub fn builtin_templates() -> Vec<ProjectTemplate> {
get_archive_fn: assets::new_project_vanillajs_files,
},
category: ProjectTemplateCategory::Frontend,
post_create: vec![NPM_INSTALL.to_string()],
post_create: vec![],
post_create_failure_warning: Some(NPM_INSTALL_FAILURE_WARNING.to_string()),
post_create_spinner_message: Some(NPM_INSTALL_SPINNER_MESSAGE.to_string()),
requirements: vec![ProjectTemplateName("dfx_js_base".to_string())],
Expand Down Expand Up @@ -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

Copy link
Author

Choose a reason for hiding this comment

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

post_create_failure_warning: None,
post_create_spinner_message: None,

Choose a reason for hiding this comment

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

These post_create failure and spinner messages should also be moved from the referencing templates

Copy link
Author

Choose a reason for hiding this comment

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

Done

Copy link
Author

Choose a reason for hiding this comment

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

requirements: vec![],
Expand Down
Loading