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.29.0 #4040

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
731 changes: 419 additions & 312 deletions CHANGELOG.md

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions src/dfx/assets/project_templates/any_js/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{
"compilerOptions": {
"strict": true,
"target": "ES2020",
"experimentalDecorators": true,
"strictPropertyInitialization": false,
"moduleResolution": "node",
"target": "ES2024",
"module": "ES2022",
"moduleResolution": "bundler",
"allowJs": true,
"outDir": "HACK_BECAUSE_OF_ALLOW_JS"
"noEmit": true
}
}
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.29.0"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Canister, query, text } from 'azle';
import { IDL, query } from 'azle';

export default Canister({
greet: query([text], text, (name) => {
export default class {
@query([IDL.Text], IDL.Text)
greet(name: string): string {
return `Hello, ${name}!`;
})
})
}
}
30 changes: 15 additions & 15 deletions src/dfx/src/lib/project/templates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ 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_failure_warning: Some(NPM_INSTALL_FAILURE_WARNING.to_string()),
post_create_spinner_message: Some(NPM_INSTALL_SPINNER_MESSAGE.to_string()),
post_create: vec![],
post_create_failure_warning: None,
post_create_spinner_message: None,
requirements: vec![ProjectTemplateName("dfx_js_base".to_string())],
sort_order: 0,
};
Expand All @@ -87,9 +87,9 @@ 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_failure_warning: Some(NPM_INSTALL_FAILURE_WARNING.to_string()),
post_create_spinner_message: Some(NPM_INSTALL_SPINNER_MESSAGE.to_string()),
post_create: vec![],
post_create_failure_warning: None,
post_create_spinner_message: None,
requirements: vec![ProjectTemplateName("dfx_js_base".to_string())],
sort_order: 1,
};
Expand All @@ -101,9 +101,9 @@ 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_failure_warning: Some(NPM_INSTALL_FAILURE_WARNING.to_string()),
post_create_spinner_message: Some(NPM_INSTALL_SPINNER_MESSAGE.to_string()),
post_create: vec![],
post_create_failure_warning: None,
post_create_spinner_message: None,
requirements: vec![ProjectTemplateName("dfx_js_base".to_string())],
sort_order: 2,
};
Expand All @@ -115,9 +115,9 @@ 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_failure_warning: Some(NPM_INSTALL_FAILURE_WARNING.to_string()),
post_create_spinner_message: Some(NPM_INSTALL_SPINNER_MESSAGE.to_string()),
post_create: vec![],
post_create_failure_warning: None,
post_create_spinner_message: None,
requirements: vec![ProjectTemplateName("dfx_js_base".to_string())],
sort_order: 3,
};
Expand Down Expand Up @@ -227,9 +227,9 @@ pub fn builtin_templates() -> Vec<ProjectTemplate> {
get_archive_fn: assets::new_project_js_files,
},
category: ProjectTemplateCategory::Support,
post_create: vec![],
post_create_failure_warning: None,
post_create_spinner_message: None,
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: Some(NPM_INSTALL_FAILURE_WARNING.to_string()),
post_create_spinner_message: Some(NPM_INSTALL_SPINNER_MESSAGE.to_string()),
requirements: vec![],
sort_order: 2,
};
Expand Down