Skip to content

Commit 7fc345c

Browse files
authored
feat: add typescript template integration (#614)
* feat: add typescript template integration
1 parent 9bd9056 commit 7fc345c

File tree

5 files changed

+13
-6
lines changed

5 files changed

+13
-6
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ AlgoKit helps you develop Algorand solutions:
4747
- **AlgoKit Utils** ([Python](https://github.com/algorandfoundation/algokit-utils-py#readme) | [TypeScript](https://github.com/algorandfoundation/algokit-utils-ts#readme)): A set of utility libraries so you can develop, test, build and deploy Algorand solutions quickly and easily
4848
- [algosdk](https://developer.algorand.org/docs/sdks/) ([Python](https://github.com/algorand/py-algorand-sdk#readme) | [TypeScript](https://github.com/algorand/js-algorand-sdk#readme)) - The core Algorand SDK providing Algorand protocol API calls, which AlgoKit Utils wraps, but still exposes for advanced scenarios
4949
- [**Algorand Python**](https://github.com/algorandfoundation/puya): A semantically and syntactically compatible, typed Python language that works with standard Python tooling and allows you to express smart contracts (apps) and smart signatures (logic signatures) for deployment on the Algorand Virtual Machine (AVM).
50+
- [**Algorand TypeScript (Beta)**](https://github.com/algorandfoundation/puya-ts): A semantically and syntactically compatible, typed TypeScript language that works with standard TypeScript tooling and allows you to express smart contracts (apps) and smart signatures (logic signatures) for deployment on the Algorand Virtual Machine (AVM). This language is currently in beta.
5051
- [**TEALScript**](https://github.com/algorandfoundation/TEALScript): A subset of TypeScript that can be used to express smart contracts (apps) and smart signatures (logic signatures) for deployment on the Algorand Virtual Machine (AVM).
5152
- [**AlgoKit LocalNet**](https://github.com/algorandfoundation/algokit-cli/blob/main/docs/features/localnet.md): A local isolated Algorand network so you can simulate real transactions and workloads on your computer
5253

@@ -61,7 +62,7 @@ AlgoKit comes with out-of-the-box [Continuous Integration / Continuous Deploymen
6162
The set of capabilities supported by AlgoKit will evolve over time, but currently includes:
6263

6364
- Quickly run, explore and interact with an isolated local Algorand network (LocalNet)
64-
- Building, testing, deploying and calling [Algorand Python](https://github.com/algorandfoundation/puya) / [TEALScript](https://github.com/algorandfoundation/TEALScript) smart contracts
65+
- Building, testing, deploying and calling [Algorand Python](https://github.com/algorandfoundation/puya) / [Algorand TypeScript (Beta)](https://github.com/algorandfoundation/puya-ts) / [TEALScript](https://github.com/algorandfoundation/TEALScript) smart contracts
6566

6667
For a user guide and guidance on how to use AlgoKit, please refer to the [docs](https://github.com/algorandfoundation/algokit-cli/blob/main/docs/algokit.md).
6768

@@ -91,7 +92,7 @@ The key required dependency is Python 3.10+, but some of the installation option
9192
9293
- **Git**: Essential for creating and updating projects from templates. Installation guide available at [Git Installation](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git).
9394
- **Docker**: Necessary for running the AlgoKit LocalNet environment. Docker Compose version 2.5.0 or higher is required. See [Docker Installation](https://docs.docker.com/get-docker/).
94-
- **Node.js**: For those working on frontend templates or building contracts using TEALScript. **Minimum required versions are Node.js `v18` and npm `v9`**. Instructions can be found at [Node.js Installation](https://nodejs.org/en/download/).
95+
- **Node.js**: For those working on frontend templates or building contracts using TypeScript or TEALScript. **Minimum required versions are Node.js `v22` and npm `v10`**. Instructions can be found at [Node.js Installation](https://nodejs.org/en/download/).
9596

9697
> **Note**
9798
> If you have previously installed AlgoKit using `pipx` and would like to switch to a different installation method, please ensure that

docs/cli/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@ Name of an official template to use. To choose interactively, run this command w
675675

676676
* **Options**
677677

678-
tealscript | python | react | fullstack | base
678+
tealscript | typescript | python | react | fullstack | base
679679

680680

681681

docs/features/init.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ $ ~ algokit init
2020
? Name of project / directory to create the project in: my-cool-app
2121
```
2222

23-
Once above 2 questions are answered, the `cli` will start instantiating the project and will start asking questions specific to the template you are instantiating. By default official templates such as `python`, `fullstack`, `react`, `python` include a notion of a `preset`. If you want to skip all questions and let the tool preset the answers tailored for a starter project you can pick `Starter`, for a more advanced project that includes unit tests, CI automation and other advanced features, pick `Production`. Lastly, if you prefer to modify the experience and tailor the template to your needs, pick the `Custom` preset.
23+
Once above 2 questions are answered, the `cli` will start instantiating the project and will start asking questions specific to the template you are instantiating. By default official templates such as `python`, `typescript`, `fullstack`, `react`, `python` include a notion of a `preset`. If you want to skip all questions and let the tool preset the answers tailored for a starter project you can pick `Starter`, for a more advanced project that includes unit tests, CI automation and other advanced features, pick `Production`. Lastly, if you prefer to modify the experience and tailor the template to your needs, pick the `Custom` preset.
2424

2525
If you want to accept the default for each option simply hit [enter] or alternatively to speed things up you can run `algokit init --defaults` and they will be auto-accepted.
2626

src/algokit/cli/init.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ class TemplateKey(str, Enum):
8181

8282
BASE = "base"
8383
PYTHON = "python"
84+
TYPESCRIPT = "typescript"
8485
TEALSCRIPT = "tealscript"
8586
FULLSTACK = "fullstack"
8687
REACT = "react"
@@ -113,7 +114,7 @@ def __eq__(self, other: object) -> bool:
113114

114115
LANGUAGE_TO_TEMPLATE_MAP = {
115116
ContractLanguage.PYTHON: TemplateKey.PYTHON,
116-
ContractLanguage.TYPESCRIPT: TemplateKey.TEALSCRIPT,
117+
ContractLanguage.TYPESCRIPT: TemplateKey.TYPESCRIPT,
117118
}
118119

119120

@@ -124,6 +125,10 @@ def _get_blessed_templates() -> dict[TemplateKey, BlessedTemplateSource]:
124125
url="gh:algorand-devrel/tealscript-algokit-template",
125126
description="Official starter template for TEALScript applications.",
126127
),
128+
TemplateKey.TYPESCRIPT: BlessedTemplateSource(
129+
url="gh:algorandfoundation/algokit-typescript-template",
130+
description="Official starter template for Algorand TypeScript (Beta) applications",
131+
),
127132
TemplateKey.PYTHON: BlessedTemplateSource(
128133
url="gh:algorandfoundation/algokit-python-template",
129134
description="Official starter template for Algorand Python applications",
@@ -649,7 +654,7 @@ def _get_template_interactive() -> TemplateSource:
649654
raise click.ClickException("No template selected. Please try again.")
650655

651656
# Map the template string directly to the TemplateSource
652-
# This is needed to be able to reuse fullstack to work with python and tealscript templates
657+
# This is needed to be able to reuse fullstack to work with python and typescript templates
653658
blessed_templates = _get_blessed_templates()
654659
if template in blessed_templates:
655660
selected_template_source = blessed_templates[template]

tests/init/test_init.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ class ExtendedTemplateKey(str, Enum):
8686
# Include all keys from TemplateKey and add new ones
8787
BASE = "base"
8888
PYTHON = "python"
89+
TYPESCRIPT = "typescript"
8990
TEALSCRIPT = "tealscript"
9091
FULLSTACK = "fullstack"
9192
REACT = "react"

0 commit comments

Comments
 (0)