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

implement the azle dfx extension and update all example projects #1759

Merged
merged 14 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
- if: contains(github.head_ref, 'release--')
name: Install dfx
run: |
DFXVM_INIT_YES=true DFX_VERSION=0.19.0 sh -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)"
DFXVM_INIT_YES=true DFX_VERSION=0.20.0-extensioncanistertype.0 sh -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)"
echo "$HOME/.local/share/dfx/bin" >> $GITHUB_PATH
# TODO we should use some Action-specific bot account
- if: contains(github.head_ref, 'release--')
Expand Down Expand Up @@ -244,7 +244,7 @@ jobs:
- if: ${{ needs.release-candidate-deploy.outputs.should_run_tests }}
name: Install dfx
run: |
DFXVM_INIT_YES=true DFX_VERSION=0.19.0 sh -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)"
DFXVM_INIT_YES=true DFX_VERSION=0.20.0-extensioncanistertype.0 sh -ci "$(curl -fsSL https://sdk.dfinity.org/install.sh)"
echo "$HOME/.local/share/dfx/bin" >> $GITHUB_PATH
- if: ${{ needs.release-candidate-deploy.outputs.should_run_tests }}
uses: actions/cache@v3
Expand Down Expand Up @@ -294,9 +294,6 @@ jobs:
- if: ${{ needs.release-candidate-deploy.outputs.should_run_tests }}
shell: bash -l {0}
run: npm run lint
- if: ${{ needs.release-candidate-deploy.outputs.should_run_tests }}
working-directory: ${{ matrix.example_directories }}
run: dfx start --clean --background --host 127.0.0.1:8000
- if: ${{ needs.release-candidate-deploy.outputs.should_run_tests }}
shell: bash -l {0}
working-directory: ${{ matrix.example_directories }}
Expand All @@ -305,6 +302,12 @@ jobs:
shell: bash -l {0}
working-directory: ${{ matrix.example_directories }}
run: npm link azle
- if: ${{ needs.release-candidate-deploy.outputs.should_run_tests }}
bdemann marked this conversation as resolved.
Show resolved Hide resolved
working-directory: ${{ matrix.example_directories }}
run: npx azle install-dfx-extension
- if: ${{ needs.release-candidate-deploy.outputs.should_run_tests }}
working-directory: ${{ matrix.example_directories }}
run: dfx start --clean --background --host 127.0.0.1:8000
# This is to put wasmedge-quickjs in the correct location for the --native-compilation tests
- if: ${{ needs.release-candidate-deploy.outputs.should_run_tests }}
shell: bash -l {0}
Expand Down
36 changes: 36 additions & 0 deletions dfx_extension/extension.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "azle",
"version": "0.0.0",
bdemann marked this conversation as resolved.
Show resolved Hide resolved
"homepage": "https://github.com/dfinity/dfx-extensions",
"authors": "",
"summary": "",
"categories": [],
"keywords": [],
"canister_type": {
"defaults": {
"candid": ".azle/{{canister_name}}/{{canister_name}}.did",
"build": "npx azle {{canister_name}}",
"post_install": "npx azle upload-assets {{canister_name}}",
"wasm": ".azle/{{canister_name}}/{{canister_name}}.wasm",
"gzip": true,
"metadata": [
{
"name": "candid:service"
},
{
"name": "cdk:name",
"content": "azle"
}
],
"tech_stack": {
"cdk": {
"azle": {}
},
"language": {
"typescript": {},
"javascript": {}
}
}
}
}
}
10 changes: 10 additions & 0 deletions dfx_extension/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
bdemann marked this conversation as resolved.
Show resolved Hide resolved

DFX_CACHE_DIR="$(dfx cache show)"

if [ ! -d "$DFX_CACHE_DIR" ]; then
dfx cache install
fi

mkdir -p "$DFX_CACHE_DIR/extensions/azle"
cp extension.json "$DFX_CACHE_DIR/extensions/azle/extension.json"
19 changes: 2 additions & 17 deletions examples/apollo_server/dfx.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,8 @@
{
"canisters": {
"apollo_server": {
"type": "custom",
"main": "src/index.ts",
"candid": "src/index.did",
"candid_gen": "http",
"build": "npx azle apollo_server",
"wasm": ".azle/apollo_server/apollo_server.wasm",
"gzip": true,
"metadata": [
{
"name": "candid:service",
"path": "src/index.did"
},
{
"name": "cdk:name",
"content": "azle"
}
]
"type": "azle",
"main": "src/index.ts"
}
}
}
4 changes: 0 additions & 4 deletions examples/apollo_server/src/index.did

This file was deleted.

21 changes: 4 additions & 17 deletions examples/async_await/dfx.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,14 @@
{
"canisters": {
"async_await": {
"type": "custom",
"type": "azle",
"main": "src/async_await.ts",
"candid": "src/async_await.did",
"build": "npx azle async_await",
"wasm": ".azle/async_await/async_await.wasm",
"gzip": true,
"candid_gen": "automatic",
"env": ["AZLE_TEST_FETCH"],
"declarations": {
"output": "test/dfx_generated/async_await",
"node_compatibility": true
},
"env": ["AZLE_TEST_FETCH"],
"metadata": [
{
"name": "candid:service",
"path": "src/async_await.did"
},
{
"name": "cdk:name",
"content": "azle"
}
]
}
}
}
}
6 changes: 0 additions & 6 deletions examples/async_await/src/async_await.did

This file was deleted.

20 changes: 2 additions & 18 deletions examples/audio_and_video/dfx.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
{
"canisters": {
"backend": {
"type": "custom",
"type": "azle",
"main": "src/backend/server.ts",
"candid": "src/backend/server.did",
"candid_gen": "http",
"build": "npx azle backend",
"wasm": ".azle/backend/backend.wasm",
"gzip": true,
"assets": [
["src/frontend/dist", "dist"],
["src/backend/media/audio.ogg", "media/audio.ogg"],
Expand All @@ -23,18 +18,7 @@
"media/popeye_the_sailor_meets_sindbad_the_sailor.mp4"
]
],
"post_install": "npx azle upload-assets backend",
"build_assets": "npm run build",
"metadata": [
{
"name": "candid:service",
"path": "src/backend/server.did"
},
{
"name": "cdk:name",
"content": "azle"
}
]
"build_assets": "npm run build"
}
}
}
4 changes: 0 additions & 4 deletions examples/audio_and_video/src/backend/server.did

This file was deleted.

17 changes: 2 additions & 15 deletions examples/audio_recorder/dfx.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,14 @@
{
"canisters": {
"audio_recorder": {
"type": "custom",
"type": "azle",
"main": "src/index.ts",
"candid": "src/index.did",
"candid_gen": "custom",
"build": "npx azle audio_recorder",
"wasm": ".azle/audio_recorder/audio_recorder.wasm",
"gzip": true,
"declarations": {
"output": "test/dfx_generated/audio_recorder",
"node_compatibility": true
},
"metadata": [
{
"name": "candid:service",
"path": "src/index.did"
},
{
"name": "cdk:name",
"content": "azle"
}
]
}
}
}
}
19 changes: 2 additions & 17 deletions examples/autoreload/dfx.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,8 @@
{
"canisters": {
"autoreload": {
"type": "custom",
"main": "src/server.ts",
"candid": "src/server.did",
"candid_gen": "http",
"build": "npx azle autoreload",
"wasm": ".azle/autoreload/autoreload.wasm",
"gzip": true,
"metadata": [
{
"name": "candid:service",
"path": "src/server.did"
},
{
"name": "cdk:name",
"content": "azle"
}
]
"type": "azle",
"main": "src/server.ts"
}
}
}
Empty file.
4 changes: 0 additions & 4 deletions examples/autoreload/src/server.did

This file was deleted.

21 changes: 4 additions & 17 deletions examples/bitcoin/dfx.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,14 @@
{
"canisters": {
"bitcoin": {
"type": "custom",
"type": "azle",
"main": "src/index.ts",
"candid": "src/index.did",
"build": "npx azle bitcoin",
"wasm": ".azle/bitcoin/bitcoin.wasm",
"gzip": true,
"candid_gen": "automatic",
"env": ["AZLE_TEST_FETCH"],
"declarations": {
"output": "test/dfx_generated/bitcoin",
"node_compatibility": true
},
"env": ["AZLE_TEST_FETCH"],
"metadata": [
{
"name": "candid:service",
"path": "src/index.did"
},
{
"name": "cdk:name",
"content": "azle"
}
]
}
}
},
"networks": {
Expand Down
6 changes: 0 additions & 6 deletions examples/bitcoin/src/index.did

This file was deleted.

8 changes: 2 additions & 6 deletions examples/bitcoinjs-lib/dfx.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
{
"canisters": {
"bitcoinjs": {
"type": "custom",
"main": "src/index.ts",
"candid": "src/index.did",
"build": "npx azle bitcoinjs",
"wasm": ".azle/bitcoinjs/bitcoinjs.wasm",
"gzip": true
"type": "azle",
"main": "src/index.ts"
}
}
}
4 changes: 0 additions & 4 deletions examples/bitcoinjs-lib/src/index.did

This file was deleted.

8 changes: 2 additions & 6 deletions examples/bitcore-lib/dfx.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
{
"canisters": {
"bitcore": {
"type": "custom",
"main": "src/index.ts",
"candid": "src/index.did",
"build": "npx azle bitcore",
"wasm": ".azle/bitcore/bitcore.wasm",
"gzip": true
"type": "azle",
"main": "src/index.ts"
}
}
}
4 changes: 0 additions & 4 deletions examples/bitcore-lib/src/index.did

This file was deleted.

19 changes: 3 additions & 16 deletions examples/blob_array/dfx.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,13 @@
{
"canisters": {
"blob_array": {
"type": "custom",
"type": "azle",
"main": "src/index.ts",
"candid": "src/index.did",
"build": "npx azle blob_array",
"wasm": ".azle/blob_array/blob_array.wasm",
"gzip": true,
"candid_gen": "automatic",
"declarations": {
"output": "test/dfx_generated/blob_array",
"node_compatibility": true
},
"metadata": [
{
"name": "candid:service",
"path": "src/index.did"
},
{
"name": "cdk:name",
"content": "azle"
}
]
}
}
}
}
4 changes: 0 additions & 4 deletions examples/blob_array/src/index.did

This file was deleted.

Loading
Loading