{"id":18893971,"url":"https://github.com/bard/starter-truffle-typescript-prettier-typechain","last_synced_at":"2026-02-27T05:30:14.876Z","repository":{"id":66470720,"uuid":"482214688","full_name":"bard/starter-truffle-typescript-prettier-typechain","owner":"bard","description":"A truffle-based Solidity development starter optimized for tight feedback loops and smooth teamwork","archived":false,"fork":false,"pushed_at":"2022-05-13T21:43:46.000Z","size":165,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-14T03:28:57.689Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bard.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-16T09:45:17.000Z","updated_at":"2022-04-16T09:46:03.000Z","dependencies_parsed_at":"2023-02-25T04:30:24.412Z","dependency_job_id":null,"html_url":"https://github.com/bard/starter-truffle-typescript-prettier-typechain","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bard%2Fstarter-truffle-typescript-prettier-typechain","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bard%2Fstarter-truffle-typescript-prettier-typechain/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bard%2Fstarter-truffle-typescript-prettier-typechain/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bard%2Fstarter-truffle-typescript-prettier-typechain/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bard","download_url":"https://codeload.github.com/bard/starter-truffle-typescript-prettier-typechain/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239869219,"owners_count":19710485,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T08:17:04.801Z","updated_at":"2026-02-27T05:30:14.847Z","avatar_url":"https://github.com/bard.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"A `truffle`-based Solidity development starter optimized for tight feedback loops and smooth teamwork.\n\n# Features\n\n- tests and migrations in TypeScript\n- test watcher for red-green-refactor style workflow (see [below](#suggested-workflow))\n- type checking and autocompletion on contract invocations (courtesy of [TypeChain](https://github.com/dethcrypto/TypeChain))\n- choise between [chai](./test/Counter-chai.ts) or [jest-expect](./test/Counter-jest.ts) for assertions\n- consistent environment across the team by bundling `truffle` and [pinning](https://github.com/bard/starter-truffle-typescript-prettier-typechain/blob/2a6a450666c38cee3d5c3dfd2bebd3c5aa8b2b26/truffle-config.js#L90) `solc` version\n- consistent style across the team for both TypeScript and Solidity sources through [prettier](https://prettier.io/) and [lint-staged](https://github.com/okonet/lint-staged)\n\n# Suggested workflow\n\n(All instances of `yarn` below can be replaced with `npm run`)\n\n1. run `yarn start:localchain` (runs `truffle`'s development blockchain)\n1. run `yarn build:watch` (rebuilds types whenever Solidity sources change)\n1. run `yarn deploy` (deploys the contracts to the development blockchain)\n1. run `yarn test:watch` (re-runs tests whenever tests or contracts change)\n1. after creating a contract and a migration, run `yarn deploy` (transpiles migrations and runs them)\n\nTests are run in [debug mode](https://trufflesuite.com/docs/truffle/getting-started/using-the-truffle-debugger/#in-test-debugging) by default, so wrapping `debug()` around a contract invocation will drop you into the debugger.\n\n# chai or jest-expect?\n\n`jest-expect` is what most modern JavaScript developers are familiar with due to being used in popular starters such as [Create React App](https://create-react-app.dev/).\n\n`chai` is `truffle`'s default and makes it easier to follow its documentation, plus it has a plugin with assertions for BigNumber.\n\nIf you don't care about JavaScript/TypeScript beyond testing Solidity contracts, `chai` might be the path of least resistance, otherwise the lower cognitive load of `jest-expect` more than makes up for the occasional mental translation when reading `chai`-based examples.\n\n# Note for monorepos: type clash between jest and mocha\n\nRegardless of which assertion library you choose, if you use this starter inside a monorepo where Jest is already used, you might run into this error:\n\n```\n../../node_modules/@types/jest/index.d.ts:35:13 - error TS2403: Subsequent variable declarations must have the same type.  Variable 'beforeEach' must be of type 'HookFunction', but here has type 'Lifecycle'.\n\n35 declare var beforeEach: jest.Lifecycle;\n               ~~~~~~~~~~\n```\n\nThis happens because `mocha` (the test runner used by `truffle`) and `jest` define the same top-level variables. To fix:\n\n1. create an empty `overrides/jest/index.d.ts` folder\n2. modify `tsconfig.json`. Assuming you placed this starter in `\u003crootDir\u003e/packages/truffle`:\n\n```diff\n     \"esModuleInterop\": true\n+    \"typeRoots\": [\"overrides\", \"../../node_modules/@types\"]\n   }\n```\n\nThis essentially \"blanks out\" the type definition for jest, allowing `@types/mocha` to take precedence ([source](https://medium.com/@elenasufieva/handling-type-declarations-clash-in-typescript-b05b10723f47)).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbard%2Fstarter-truffle-typescript-prettier-typechain","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbard%2Fstarter-truffle-typescript-prettier-typechain","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbard%2Fstarter-truffle-typescript-prettier-typechain/lists"}