{"id":13496562,"url":"https://github.com/metachris/typescript-boilerplate","last_synced_at":"2025-04-12T18:41:58.230Z","repository":{"id":38391979,"uuid":"350137949","full_name":"metachris/typescript-boilerplate","owner":"metachris","description":"A modern TypeScript project setup, for Node.js and browsers","archived":false,"fork":false,"pushed_at":"2022-08-15T16:53:47.000Z","size":232,"stargazers_count":597,"open_issues_count":5,"forks_count":107,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-05-01T12:17:08.055Z","etag":null,"topics":["boilerplate","esbuild","javascript","jest","typedoc","typescript"],"latest_commit_sha":null,"homepage":"https://www.metachris.com/2021/03/bootstrapping-a-typescript-node.js-project/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/metachris.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-03-21T22:39:44.000Z","updated_at":"2024-04-21T17:59:11.000Z","dependencies_parsed_at":"2022-09-06T20:11:56.249Z","dependency_job_id":null,"html_url":"https://github.com/metachris/typescript-boilerplate","commit_stats":null,"previous_names":[],"tags_count":8,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metachris%2Ftypescript-boilerplate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metachris%2Ftypescript-boilerplate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metachris%2Ftypescript-boilerplate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/metachris%2Ftypescript-boilerplate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/metachris","download_url":"https://codeload.github.com/metachris/typescript-boilerplate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248617049,"owners_count":21134182,"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":["boilerplate","esbuild","javascript","jest","typedoc","typescript"],"created_at":"2024-07-31T19:01:51.692Z","updated_at":"2025-04-12T18:41:58.207Z","avatar_url":"https://github.com/metachris.png","language":"TypeScript","funding_links":[],"categories":["TypeScript","boilerplate"],"sub_categories":[],"readme":"# TypeScript Boilerplate for 2022\n\n[![Build and test status](https://github.com/metachris/typescript-boilerplate/workflows/Lint%20and%20test/badge.svg)](https://github.com/metachris/typescript-boilerplate/actions?query=workflow%3A%22Build+and+test%22)\n\nTypeScript project boilerplate with modern tooling, for Node.js programs, libraries and browser modules. Get started quickly and right-footed 🚀\n\n* [TypeScript 4](https://www.typescriptlang.org/)\n* Optionally [esbuild](https://esbuild.github.io/) to bundle for browsers (and Node.js)\n* Linting with [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint) ([tslint](https://palantir.github.io/tslint/) is deprecated)\n* Testing with [Jest](https://jestjs.io/docs/getting-started) (and [ts-jest](https://www.npmjs.com/package/ts-jest))\n* Publishing to npm\n* Continuous integration ([GitHub Actions](https://docs.github.com/en/actions) / [GitLab CI](https://docs.gitlab.com/ee/ci/))\n* Automatic API documentation with [TypeDoc](https://typedoc.org/guides/doccomments/)\n\nSee also the introduction blog post: **[Starting a TypeScript Project in 2021](https://www.metachris.com/2021/03/bootstrapping-a-typescript-node.js-project/)**.\n\n\n## Getting Started\n\n```bash\n# Clone the repository (you can also click \"Use this template\")\ngit clone https://github.com/metachris/typescript-boilerplate.git your_project_name\ncd your_project_name\n\n# Edit `package.json` and `tsconfig.json` to your liking\n...\n\n# Install dependencies\nyarn install\n\n# Now you can run various yarn commands:\nyarn cli\nyarn lint\nyarn test\nyarn build-all\nyarn ts-node \u003cfilename\u003e\nyarn esbuild-browser\n...\n```\n\n* Take a look at all the scripts in [`package.json`](https://github.com/metachris/typescript-boilerplate/blob/master/package.json)\n* For publishing to npm, use `yarn publish` (or `npm publish`)\n\n## esbuild\n\n[esbuild](https://esbuild.github.io/) is an extremely fast bundler that supports a [large part of the TypeScript syntax](https://esbuild.github.io/content-types/#typescript). This project uses it to bundle for browsers (and Node.js if you want).\n\n```bash\n# Build for browsers\nyarn esbuild-browser:dev\nyarn esbuild-browser:watch\n\n# Build the cli for node\nyarn esbuild-node:dev\nyarn esbuild-node:watch\n```\n\nYou can generate a full clean build with `yarn build-all` (which uses both `tsc` and `esbuild`).\n\n* `package.json` includes `scripts` for various esbuild commands: [see here](https://github.com/metachris/typescript-boilerplate/blob/master/package.json#L23)\n* `esbuild` has a `--global-name=xyz` flag, to store the exports from the entry point in a global variable. See also the [esbuild \"Global name\" docs](https://esbuild.github.io/api/#global-name).\n* Read more about the esbuild setup [here](https://www.metachris.com/2021/04/starting-a-typescript-project-in-2021/#esbuild).\n* esbuild for the browser uses the IIFE (immediately-invoked function expression) format, which executes the bundled code on load (see also https://github.com/evanw/esbuild/issues/29)\n\n\n## Tests with Jest\n\nYou can write [Jest tests](https://jestjs.io/docs/getting-started) [like this](https://github.com/metachris/typescript-boilerplate/blob/master/src/main.test.ts):\n\n```typescript\nimport { greet } from './main'\n\ntest('the data is peanut butter', () =\u003e {\n  expect(1).toBe(1)\n});\n\ntest('greeting', () =\u003e {\n  expect(greet('Foo')).toBe('Hello Foo')\n});\n```\n\nRun the tests with `yarn test`, no separate compile step is necessary.\n\n* See also the [Jest documentation](https://jestjs.io/docs/getting-started).\n* The tests can be automatically run in CI (GitHub Actions, GitLab CI): [`.github/workflows/lint-and-test.yml`](https://github.com/metachris/typescript-boilerplate/blob/master/.github/workflows/lint-and-test.yml), [`.gitlab-ci.yml`](https://github.com/metachris/typescript-boilerplate/blob/master/.gitlab-ci.yml)\n* Take a look at other modern test runners such as [ava](https://github.com/avajs/ava), [uvu](https://github.com/lukeed/uvu) and [tape](https://github.com/substack/tape)\n\n## Documentation, published with CI\n\nYou can auto-generate API documentation from the TypeScript source files using [TypeDoc](https://typedoc.org/guides/doccomments/). The generated documentation can be published to GitHub / GitLab pages through the CI.\n\nGenerate the documentation, using `src/main.ts` as entrypoint (configured in package.json):\n\n```bash\nyarn docs\n```\n\nThe resulting HTML is saved in `docs/`.\n\nYou can publish the documentation through CI:\n* [GitHub pages](https://pages.github.com/): See [`.github/workflows/deploy-gh-pages.yml`](https://github.com/metachris/typescript-boilerplate/blob/master/.github/workflows/deploy-gh-pages.yml)\n* [GitLab pages](https://docs.gitlab.com/ee/user/project/pages/): [`.gitlab-ci.yml`](https://github.com/metachris/typescript-boilerplate/blob/master/.gitlab-ci.yml)\n\nThis is the documentation for this boilerplate project: https://metachris.github.io/typescript-boilerplate/\n\n## References\n\n* **[Blog post: Starting a TypeScript Project in 2021](https://www.metachris.com/2021/03/bootstrapping-a-typescript-node.js-project/)**\n* [TypeScript Handbook](https://www.typescriptlang.org/docs/handbook/intro.html)\n* [tsconfig docs](https://www.typescriptlang.org/tsconfig)\n* [esbuild docs](https://esbuild.github.io/)\n* [typescript-eslint docs](https://github.com/typescript-eslint/typescript-eslint/blob/master/docs/getting-started/linting/README.md)\n* [Jest docs](https://jestjs.io/docs/getting-started)\n* [GitHub Actions](https://docs.github.com/en/actions), [GitLab CI](https://docs.gitlab.com/ee/ci/)\n\n\n## Feedback\n\nReach out with feedback and ideas:\n\n* [twitter.com/metachris](https://twitter.com/metachris)\n* [Create a new issue](https://github.com/metachris/typescript-boilerplate/issues)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetachris%2Ftypescript-boilerplate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmetachris%2Ftypescript-boilerplate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmetachris%2Ftypescript-boilerplate/lists"}