From 89d0298cad66ad1133b135b40f2e211b9eca2108 Mon Sep 17 00:00:00 2001 From: Jordan Last Date: Sat, 14 Dec 2024 09:29:49 -0700 Subject: [PATCH 1/4] chore: update Azle templates to 0.24.1 --- .../project_templates/any_js/tsconfig.json | 3 +-- .../project_templates/azle/dfx.json-patch | 17 ++-------------- .../src/__backend_name__/__backend_name__.did | 3 --- .../azle/src/__backend_name__/package.json | 4 ++-- .../azle/src/__backend_name__/src/index.ts | 20 +++++++++++++------ 5 files changed, 19 insertions(+), 28 deletions(-) delete mode 100644 src/dfx/assets/project_templates/azle/src/__backend_name__/__backend_name__.did diff --git a/src/dfx/assets/project_templates/any_js/tsconfig.json b/src/dfx/assets/project_templates/any_js/tsconfig.json index f4629166d9..61d9e891a9 100644 --- a/src/dfx/assets/project_templates/any_js/tsconfig.json +++ b/src/dfx/assets/project_templates/any_js/tsconfig.json @@ -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" diff --git a/src/dfx/assets/project_templates/azle/dfx.json-patch b/src/dfx/assets/project_templates/azle/dfx.json-patch index 5965afc59f..b405cbee59 100644 --- a/src/dfx/assets/project_templates/azle/dfx.json-patch +++ b/src/dfx/assets/project_templates/azle/dfx.json-patch @@ -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" } } ] diff --git a/src/dfx/assets/project_templates/azle/src/__backend_name__/__backend_name__.did b/src/dfx/assets/project_templates/azle/src/__backend_name__/__backend_name__.did deleted file mode 100644 index b971bf69eb..0000000000 --- a/src/dfx/assets/project_templates/azle/src/__backend_name__/__backend_name__.did +++ /dev/null @@ -1,3 +0,0 @@ -service : { - "greet" : (text) -> (text) query; -} diff --git a/src/dfx/assets/project_templates/azle/src/__backend_name__/package.json b/src/dfx/assets/project_templates/azle/src/__backend_name__/package.json index 63bbb83d7f..5b98893f0c 100644 --- a/src/dfx/assets/project_templates/azle/src/__backend_name__/package.json +++ b/src/dfx/assets/project_templates/azle/src/__backend_name__/package.json @@ -4,6 +4,6 @@ "private": true, "type": "module", "dependencies": { - "azle": "^0.19.0" + "azle": "^0.24.1" } -} \ No newline at end of file +} diff --git a/src/dfx/assets/project_templates/azle/src/__backend_name__/src/index.ts b/src/dfx/assets/project_templates/azle/src/__backend_name__/src/index.ts index 87c3d05729..01690668bd 100644 --- a/src/dfx/assets/project_templates/azle/src/__backend_name__/src/index.ts +++ b/src/dfx/assets/project_templates/azle/src/__backend_name__/src/index.ts @@ -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; + } +} From 1a224d366463d93b06c96b2338e231c140a8205c Mon Sep 17 00:00:00 2001 From: Jordan Last Date: Fri, 10 Jan 2025 09:57:55 -0700 Subject: [PATCH 2/4] chore: update Azle templates to 0.25.0 --- .../project_templates/azle/src/__backend_name__/package.json | 2 +- src/dfx/src/lib/project/templates.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dfx/assets/project_templates/azle/src/__backend_name__/package.json b/src/dfx/assets/project_templates/azle/src/__backend_name__/package.json index 5b98893f0c..81e8dca849 100644 --- a/src/dfx/assets/project_templates/azle/src/__backend_name__/package.json +++ b/src/dfx/assets/project_templates/azle/src/__backend_name__/package.json @@ -4,6 +4,6 @@ "private": true, "type": "module", "dependencies": { - "azle": "^0.24.1" + "azle": "^0.25.0" } } diff --git a/src/dfx/src/lib/project/templates.rs b/src/dfx/src/lib/project/templates.rs index 8f52cc8ec9..52b29d2400 100644 --- a/src/dfx/src/lib/project/templates.rs +++ b/src/dfx/src/lib/project/templates.rs @@ -226,7 +226,7 @@ pub fn builtin_templates() -> Vec { get_archive_fn: assets::new_project_js_files, }, category: ProjectTemplateCategory::Support, - post_create: vec![], + post_create: vec![NPM_INSTALL.to_string()], post_create_failure_warning: None, post_create_spinner_message: None, requirements: vec![], From 25d06c6f2f63aaef3a5d7db502894284ed720ae4 Mon Sep 17 00:00:00 2001 From: Jordan Last Date: Mon, 13 Jan 2025 09:28:26 -0700 Subject: [PATCH 3/4] chore: update Azle templates to 0.25.0 --- src/dfx/src/lib/project/templates.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/dfx/src/lib/project/templates.rs b/src/dfx/src/lib/project/templates.rs index 52b29d2400..94ae1781ec 100644 --- a/src/dfx/src/lib/project/templates.rs +++ b/src/dfx/src/lib/project/templates.rs @@ -72,7 +72,7 @@ pub fn builtin_templates() -> Vec { 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())], @@ -86,7 +86,7 @@ pub fn builtin_templates() -> Vec { 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())], @@ -100,7 +100,7 @@ pub fn builtin_templates() -> Vec { 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())], @@ -114,7 +114,7 @@ pub fn builtin_templates() -> Vec { 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())], From 37a5715b19aca2d2ce6ad90db790930f2fd71043 Mon Sep 17 00:00:00 2001 From: Jordan Last Date: Mon, 27 Jan 2025 19:39:51 -0700 Subject: [PATCH 4/4] chore: update Azle templates to 0.25.0 --- src/dfx/src/lib/project/templates.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/dfx/src/lib/project/templates.rs b/src/dfx/src/lib/project/templates.rs index 94ae1781ec..c7b0a1c9c4 100644 --- a/src/dfx/src/lib/project/templates.rs +++ b/src/dfx/src/lib/project/templates.rs @@ -73,8 +73,8 @@ pub fn builtin_templates() -> Vec { }, category: ProjectTemplateCategory::Frontend, 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()), + post_create_failure_warning: None, + post_create_spinner_message: None, requirements: vec![ProjectTemplateName("dfx_js_base".to_string())], sort_order: 0, }; @@ -87,8 +87,8 @@ pub fn builtin_templates() -> Vec { }, category: ProjectTemplateCategory::Frontend, 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()), + post_create_failure_warning: None, + post_create_spinner_message: None, requirements: vec![ProjectTemplateName("dfx_js_base".to_string())], sort_order: 1, }; @@ -101,8 +101,8 @@ pub fn builtin_templates() -> Vec { }, category: ProjectTemplateCategory::Frontend, 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()), + post_create_failure_warning: None, + post_create_spinner_message: None, requirements: vec![ProjectTemplateName("dfx_js_base".to_string())], sort_order: 2, }; @@ -115,8 +115,8 @@ pub fn builtin_templates() -> Vec { }, category: ProjectTemplateCategory::Frontend, 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()), + post_create_failure_warning: None, + post_create_spinner_message: None, requirements: vec![ProjectTemplateName("dfx_js_base".to_string())], sort_order: 3, }; @@ -227,8 +227,8 @@ pub fn builtin_templates() -> Vec { }, category: ProjectTemplateCategory::Support, post_create: vec![NPM_INSTALL.to_string()], - post_create_failure_warning: None, - post_create_spinner_message: None, + 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, };