Draft
Conversation
There was a problem hiding this comment.
Pull request overview
Migrates the generated Python smart-contract TypeScript templates from CommonJS to ESM to support modern (ESM) dependencies and keep deploy/test workflows functional under Node 20+.
Changes:
- Switch TypeScript compilation settings to
NodeNextmodule + resolution. - Convert deploy entrypoints to be ESM-safe (
import.meta.url+fileURLToPath) and update dynamic deployer importing to use file URLs. - Update generated package scripts to use
tsx, and migrate Jest config tots-jest’s ESM preset (production template).
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| examples/generators/starter_python_smart_contract_typescript/tsconfig.json | Switch TS module settings to NodeNext for ESM-friendly resolution. |
| examples/generators/starter_python_smart_contract_typescript/smart_contracts/index.ts | Replace __dirname usage and adjust dynamic imports for ESM. |
| examples/generators/starter_python_smart_contract_typescript/package.json | Mark package as ESM and move deploy scripts from ts-node-dev to tsx. |
| examples/generators/production_python_smart_contract_typescript/tsconfig.json | Switch TS module settings to NodeNext for ESM-friendly resolution. |
| examples/generators/production_python_smart_contract_typescript/smart_contracts/index.ts | Replace __dirname usage and adjust dynamic imports for ESM. |
| examples/generators/production_python_smart_contract_typescript/package.json | Mark package as ESM, move deploy to tsx, and run Jest with ESM support flags. |
| examples/generators/production_python_smart_contract_typescript/jest.config.ts | Migrate Jest to ts-jest ESM preset and add ESM-related mappings. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
examples/generators/starter_python_smart_contract_typescript/package.json
Show resolved
Hide resolved
examples/generators/production_python_smart_contract_typescript/package.json
Show resolved
Hide resolved
…ssing but the tests were passing because of peer dep on ts-jest
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
chore: prepare for AlgoKit v4 beta (Python Generator)
This PR updates the Python generator to support the upcoming AlgoKit v4 beta. Following the same pattern as the TypeScript template, I've migrated the generated TypeScript deployment/testing code to be fully ESM-compatible.
Summary of Changes
tsconfig.jsontoNodeNextand added"type": "module"to the generatedpackage.json.ts-jest/presets/default-esmand updated the test script to use--experimental-vm-modules. This fixes the test failures I was seeing in the generated templates.smart_contracts/index.tsto useimport.meta.urlandpathToFileURLfor finding and loading deployer configs, replacing CJS__dirnamelogic.ts-node-devwithtsxin the generated templates and updated the README documentation.@algorandfoundationpackages to the latest v4 alphas (Utilsv10.0.0-alpha.40, etc.) and bumped TypeScript tov5.7.3.Important
Status: Draft
Like the other template PRs, this will remain a draft until the official v4 beta releases are live, at which point I'll update the alpha tags to stable versions.