From 89d0298cad66ad1133b135b40f2e211b9eca2108 Mon Sep 17 00:00:00 2001 From: Jordan Last Date: Sat, 14 Dec 2024 09:29:49 -0700 Subject: [PATCH] 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; + } +}