From 65d533acc4b1434ef6e93a03ddfc6afc1543ddb1 Mon Sep 17 00:00:00 2001 From: Neil Campbell Date: Tue, 7 May 2024 10:31:33 +0800 Subject: [PATCH] chore: replicate python template tweaks to beaker template (#68) --- .../production_beaker_smart_contract_python/pyproject.toml | 1 + .../smart_contracts/helpers/build.py | 2 +- .../production_beaker_smart_contract_typescript/package.json | 5 +++-- .../smart_contracts/helpers/build.py | 2 +- .../tsconfig.json | 3 ++- .../starter_beaker_smart_contract_python/pyproject.toml | 1 + .../smart_contracts/helpers/build.py | 2 +- .../starter_beaker_smart_contract_typescript/package.json | 5 +++-- .../smart_contracts/helpers/build.py | 2 +- .../starter_beaker_smart_contract_typescript/tsconfig.json | 3 ++- examples/production_beaker/pyproject.toml | 1 + examples/production_beaker/smart_contracts/helpers/build.py | 2 +- examples/starter_beaker/pyproject.toml | 1 + examples/starter_beaker/smart_contracts/helpers/build.py | 2 +- template_content/pyproject.toml.jinja | 3 +++ template_content/smart_contracts/helpers/build.py.jinja | 2 +- ...t' or use_typescript_jest %}package.json{% endif %}.jinja | 5 +++-- ...script' or use_typescript_jest %}tsconfig.json{% endif %} | 3 ++- 18 files changed, 29 insertions(+), 16 deletions(-) diff --git a/examples/generators/production_beaker_smart_contract_python/pyproject.toml b/examples/generators/production_beaker_smart_contract_python/pyproject.toml index 26cd6c20..8e7f19fb 100644 --- a/examples/generators/production_beaker_smart_contract_python/pyproject.toml +++ b/examples/generators/production_beaker_smart_contract_python/pyproject.toml @@ -13,6 +13,7 @@ python-dotenv = "^1.0.0" [tool.poetry.group.dev.dependencies] setuptools = "^69.0.2" # Adding explicitly to work around pyteal https://github.com/algorand/pyteal/issues/712 +algokit-client-generator = "^1.1.3" black = {extras = ["d"], version = "*"} ruff = "^0.1.6" mypy = "*" diff --git a/examples/generators/production_beaker_smart_contract_python/smart_contracts/helpers/build.py b/examples/generators/production_beaker_smart_contract_python/smart_contracts/helpers/build.py index 753727bf..cd2098d7 100644 --- a/examples/generators/production_beaker_smart_contract_python/smart_contracts/helpers/build.py +++ b/examples/generators/production_beaker_smart_contract_python/smart_contracts/helpers/build.py @@ -34,7 +34,7 @@ def build(output_dir: Path, app: beaker.Application) -> Path: if result.returncode: if "No such command" in result.stdout: raise Exception( - "Could not generate typed client, requires AlgoKit 1.8.0 or " + "Could not generate typed client, requires AlgoKit 2.0.0 or " "later. Please update AlgoKit" ) else: diff --git a/examples/generators/production_beaker_smart_contract_typescript/package.json b/examples/generators/production_beaker_smart_contract_typescript/package.json index 933f41bb..e64561d1 100644 --- a/examples/generators/production_beaker_smart_contract_typescript/package.json +++ b/examples/generators/production_beaker_smart_contract_typescript/package.json @@ -14,10 +14,11 @@ "npm": ">=9.0" }, "dependencies": { - "@algorandfoundation/algokit-utils": "^5.1.0", - "algosdk": "^2.5.0" + "@algorandfoundation/algokit-utils": "^6.0.2", + "algosdk": "^2.7.0" }, "devDependencies": { + "@algorandfoundation/algokit-client-generator": "^3.0.3", "@types/jest": "^29.5.11", "dotenv": "^16.0.3", "prettier": "^2.8.4", diff --git a/examples/generators/production_beaker_smart_contract_typescript/smart_contracts/helpers/build.py b/examples/generators/production_beaker_smart_contract_typescript/smart_contracts/helpers/build.py index 167ee907..ee6ddaa4 100644 --- a/examples/generators/production_beaker_smart_contract_typescript/smart_contracts/helpers/build.py +++ b/examples/generators/production_beaker_smart_contract_typescript/smart_contracts/helpers/build.py @@ -34,7 +34,7 @@ def build(output_dir: Path, app: beaker.Application) -> Path: if result.returncode: if "No such command" in result.stdout: raise Exception( - "Could not generate typed client, requires AlgoKit 1.8.0 or " + "Could not generate typed client, requires AlgoKit 2.0.0 or " "later. Please update AlgoKit" ) else: diff --git a/examples/generators/production_beaker_smart_contract_typescript/tsconfig.json b/examples/generators/production_beaker_smart_contract_typescript/tsconfig.json index 7c762042..fc758938 100644 --- a/examples/generators/production_beaker_smart_contract_typescript/tsconfig.json +++ b/examples/generators/production_beaker_smart_contract_typescript/tsconfig.json @@ -14,11 +14,12 @@ "forceConsistentCasingInFileNames": true, "allowJs": false, "allowSyntheticDefaultImports": true, + "module": "CommonJS", "moduleResolution": "Node", "resolveJsonModule": true, "isolatedModules": true, "noEmit": true }, - "include": ["src/**/*.ts"], + "include": ["smart_contracts/**/*.ts"], "exclude": ["node_modules", "dist", "coverage"] } diff --git a/examples/generators/starter_beaker_smart_contract_python/pyproject.toml b/examples/generators/starter_beaker_smart_contract_python/pyproject.toml index 9fab407a..8b9eb1ae 100644 --- a/examples/generators/starter_beaker_smart_contract_python/pyproject.toml +++ b/examples/generators/starter_beaker_smart_contract_python/pyproject.toml @@ -13,6 +13,7 @@ python-dotenv = "^1.0.0" [tool.poetry.group.dev.dependencies] setuptools = "^69.0.2" # Adding explicitly to work around pyteal https://github.com/algorand/pyteal/issues/712 +algokit-client-generator = "^1.1.3" [build-system] requires = ["poetry-core"] diff --git a/examples/generators/starter_beaker_smart_contract_python/smart_contracts/helpers/build.py b/examples/generators/starter_beaker_smart_contract_python/smart_contracts/helpers/build.py index 753727bf..cd2098d7 100644 --- a/examples/generators/starter_beaker_smart_contract_python/smart_contracts/helpers/build.py +++ b/examples/generators/starter_beaker_smart_contract_python/smart_contracts/helpers/build.py @@ -34,7 +34,7 @@ def build(output_dir: Path, app: beaker.Application) -> Path: if result.returncode: if "No such command" in result.stdout: raise Exception( - "Could not generate typed client, requires AlgoKit 1.8.0 or " + "Could not generate typed client, requires AlgoKit 2.0.0 or " "later. Please update AlgoKit" ) else: diff --git a/examples/generators/starter_beaker_smart_contract_typescript/package.json b/examples/generators/starter_beaker_smart_contract_typescript/package.json index 75b8aa27..e329b0d0 100644 --- a/examples/generators/starter_beaker_smart_contract_typescript/package.json +++ b/examples/generators/starter_beaker_smart_contract_typescript/package.json @@ -13,10 +13,11 @@ "npm": ">=9.0" }, "dependencies": { - "@algorandfoundation/algokit-utils": "^5.1.0", - "algosdk": "^2.5.0" + "@algorandfoundation/algokit-utils": "^6.0.2", + "algosdk": "^2.7.0" }, "devDependencies": { + "@algorandfoundation/algokit-client-generator": "^3.0.3", "dotenv": "^16.0.3", "prettier": "^2.8.4", "ts-node-dev": "^2.0.0", diff --git a/examples/generators/starter_beaker_smart_contract_typescript/smart_contracts/helpers/build.py b/examples/generators/starter_beaker_smart_contract_typescript/smart_contracts/helpers/build.py index 167ee907..ee6ddaa4 100644 --- a/examples/generators/starter_beaker_smart_contract_typescript/smart_contracts/helpers/build.py +++ b/examples/generators/starter_beaker_smart_contract_typescript/smart_contracts/helpers/build.py @@ -34,7 +34,7 @@ def build(output_dir: Path, app: beaker.Application) -> Path: if result.returncode: if "No such command" in result.stdout: raise Exception( - "Could not generate typed client, requires AlgoKit 1.8.0 or " + "Could not generate typed client, requires AlgoKit 2.0.0 or " "later. Please update AlgoKit" ) else: diff --git a/examples/generators/starter_beaker_smart_contract_typescript/tsconfig.json b/examples/generators/starter_beaker_smart_contract_typescript/tsconfig.json index 7c762042..fc758938 100644 --- a/examples/generators/starter_beaker_smart_contract_typescript/tsconfig.json +++ b/examples/generators/starter_beaker_smart_contract_typescript/tsconfig.json @@ -14,11 +14,12 @@ "forceConsistentCasingInFileNames": true, "allowJs": false, "allowSyntheticDefaultImports": true, + "module": "CommonJS", "moduleResolution": "Node", "resolveJsonModule": true, "isolatedModules": true, "noEmit": true }, - "include": ["src/**/*.ts"], + "include": ["smart_contracts/**/*.ts"], "exclude": ["node_modules", "dist", "coverage"] } diff --git a/examples/production_beaker/pyproject.toml b/examples/production_beaker/pyproject.toml index ab37365d..fbbe9b00 100644 --- a/examples/production_beaker/pyproject.toml +++ b/examples/production_beaker/pyproject.toml @@ -13,6 +13,7 @@ python-dotenv = "^1.0.0" [tool.poetry.group.dev.dependencies] setuptools = "^69.0.2" # Adding explicitly to work around pyteal https://github.com/algorand/pyteal/issues/712 +algokit-client-generator = "^1.1.3" black = {extras = ["d"], version = "*"} ruff = "^0.1.6" mypy = "*" diff --git a/examples/production_beaker/smart_contracts/helpers/build.py b/examples/production_beaker/smart_contracts/helpers/build.py index 753727bf..cd2098d7 100644 --- a/examples/production_beaker/smart_contracts/helpers/build.py +++ b/examples/production_beaker/smart_contracts/helpers/build.py @@ -34,7 +34,7 @@ def build(output_dir: Path, app: beaker.Application) -> Path: if result.returncode: if "No such command" in result.stdout: raise Exception( - "Could not generate typed client, requires AlgoKit 1.8.0 or " + "Could not generate typed client, requires AlgoKit 2.0.0 or " "later. Please update AlgoKit" ) else: diff --git a/examples/starter_beaker/pyproject.toml b/examples/starter_beaker/pyproject.toml index 656b6398..dabb1bd0 100644 --- a/examples/starter_beaker/pyproject.toml +++ b/examples/starter_beaker/pyproject.toml @@ -13,6 +13,7 @@ python-dotenv = "^1.0.0" [tool.poetry.group.dev.dependencies] setuptools = "^69.0.2" # Adding explicitly to work around pyteal https://github.com/algorand/pyteal/issues/712 +algokit-client-generator = "^1.1.3" [build-system] requires = ["poetry-core"] diff --git a/examples/starter_beaker/smart_contracts/helpers/build.py b/examples/starter_beaker/smart_contracts/helpers/build.py index 753727bf..cd2098d7 100644 --- a/examples/starter_beaker/smart_contracts/helpers/build.py +++ b/examples/starter_beaker/smart_contracts/helpers/build.py @@ -34,7 +34,7 @@ def build(output_dir: Path, app: beaker.Application) -> Path: if result.returncode: if "No such command" in result.stdout: raise Exception( - "Could not generate typed client, requires AlgoKit 1.8.0 or " + "Could not generate typed client, requires AlgoKit 2.0.0 or " "later. Please update AlgoKit" ) else: diff --git a/template_content/pyproject.toml.jinja b/template_content/pyproject.toml.jinja index 89a12418..1de3c195 100644 --- a/template_content/pyproject.toml.jinja +++ b/template_content/pyproject.toml.jinja @@ -13,6 +13,9 @@ python-dotenv = "^1.0.0" [tool.poetry.group.dev.dependencies] setuptools = "^69.0.2" # Adding explicitly to work around pyteal https://github.com/algorand/pyteal/issues/712 +{% if deployment_language == 'python' -%} +algokit-client-generator = "^1.1.3" +{% endif -%} {% if use_python_black -%} black = {extras = ["d"], version = "*"} {% endif -%} diff --git a/template_content/smart_contracts/helpers/build.py.jinja b/template_content/smart_contracts/helpers/build.py.jinja index 206a183d..d7afde6e 100644 --- a/template_content/smart_contracts/helpers/build.py.jinja +++ b/template_content/smart_contracts/helpers/build.py.jinja @@ -37,7 +37,7 @@ def build(output_dir: Path, app: beaker.Application) -> Path: if result.returncode: if "No such command" in result.stdout: raise Exception( - "Could not generate typed client, requires AlgoKit 1.8.0 or " + "Could not generate typed client, requires AlgoKit 2.0.0 or " "later. Please update AlgoKit" ) else: diff --git a/template_content/{% if deployment_language == 'typescript' or use_typescript_jest %}package.json{% endif %}.jinja b/template_content/{% if deployment_language == 'typescript' or use_typescript_jest %}package.json{% endif %}.jinja index 26e66744..14b0174c 100644 --- a/template_content/{% if deployment_language == 'typescript' or use_typescript_jest %}package.json{% endif %}.jinja +++ b/template_content/{% if deployment_language == 'typescript' or use_typescript_jest %}package.json{% endif %}.jinja @@ -16,10 +16,11 @@ "npm": ">=9.0" }, "dependencies": { - "@algorandfoundation/algokit-utils": "^5.1.0", - "algosdk": "^2.5.0" + "@algorandfoundation/algokit-utils": "^6.0.2", + "algosdk": "^2.7.0" }, "devDependencies": { + "@algorandfoundation/algokit-client-generator": "^3.0.3", {%- if use_typescript_jest %} "@types/jest": "^29.5.11", {%- endif %} diff --git a/template_content/{% if deployment_language == 'typescript' or use_typescript_jest %}tsconfig.json{% endif %} b/template_content/{% if deployment_language == 'typescript' or use_typescript_jest %}tsconfig.json{% endif %} index 7c762042..fc758938 100644 --- a/template_content/{% if deployment_language == 'typescript' or use_typescript_jest %}tsconfig.json{% endif %} +++ b/template_content/{% if deployment_language == 'typescript' or use_typescript_jest %}tsconfig.json{% endif %} @@ -14,11 +14,12 @@ "forceConsistentCasingInFileNames": true, "allowJs": false, "allowSyntheticDefaultImports": true, + "module": "CommonJS", "moduleResolution": "Node", "resolveJsonModule": true, "isolatedModules": true, "noEmit": true }, - "include": ["src/**/*.ts"], + "include": ["smart_contracts/**/*.ts"], "exclude": ["node_modules", "dist", "coverage"] }