{"id":14155583,"url":"https://github.com/jasonkuhrt/template-typescript-lib","last_synced_at":"2025-04-09T23:14:27.504Z","repository":{"id":37025336,"uuid":"259789508","full_name":"jasonkuhrt/template-typescript-lib","owner":"jasonkuhrt","description":"🎛️ Project template for TypeScript libraries","archived":false,"fork":false,"pushed_at":"2025-04-07T19:53:36.000Z","size":2101,"stargazers_count":53,"open_issues_count":14,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-09T23:14:21.595Z","etag":null,"topics":["example","library","template","typescript"],"latest_commit_sha":null,"homepage":"","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/jasonkuhrt.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-29T01:02:41.000Z","updated_at":"2025-03-25T11:56:26.000Z","dependencies_parsed_at":"2024-02-23T00:26:28.564Z","dependency_job_id":"93464a4e-70cb-4bd0-8007-e357f7c30b55","html_url":"https://github.com/jasonkuhrt/template-typescript-lib","commit_stats":{"total_commits":306,"total_committers":3,"mean_commits":102.0,"dds":"0.10130718954248363","last_synced_commit":"387b06c4ce38417ae6189620466bf34463de0f7c"},"previous_names":["prisma-labs/project-lib-typescript"],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonkuhrt%2Ftemplate-typescript-lib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonkuhrt%2Ftemplate-typescript-lib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonkuhrt%2Ftemplate-typescript-lib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jasonkuhrt%2Ftemplate-typescript-lib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jasonkuhrt","download_url":"https://codeload.github.com/jasonkuhrt/template-typescript-lib/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248125589,"owners_count":21051770,"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":["example","library","template","typescript"],"created_at":"2024-08-17T08:04:08.539Z","updated_at":"2025-04-09T23:14:27.474Z","avatar_url":"https://github.com/jasonkuhrt.png","language":"TypeScript","funding_links":[],"categories":["typescript","TypeScript"],"sub_categories":[],"readme":"# template-typescript-lib\n\n[![trunk](https://github.com/jasonkuhrt/template-typescript-lib/actions/workflows/trunk.yaml/badge.svg)](https://github.com/jasonkuhrt/template-typescript-lib/actions/workflows/trunk.yaml)\n\nProject template for Node libraries. Features:\n\n- Modules: Hybrid ESM/CJS\n- Types: TypeScript\n- Tests: Vitest\n- Linting: ESLint\n- Formatting: dprint\n- Publishing: Dripip\n- Continuous Integration: GitHub Actions\n- Dependency Management: Renovate\n- Community: Issue Templates\n\n## Quick Start\n\nMake sure you have `corepack` enabled:\n\n```\n$ corepack enable\n```\n\n### Used as a GitHub Template Repo\n\nThe following will get you a ready to go new repository on GitHub based on this one.\n\n1. Run:\n\n   ```\n   gh repo create foobar --template jasonkuhrt/template-typescript-lib --clone --public \u0026\u0026 \\\n   cd foobar \u0026\u0026 \\\n   pnpm install \u0026\u0026 \\\n   pnpm bootstrap\n   ```\n\n2. [Setup a repo secret](https://help.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets) called `NPM_TOKEN` containing an [npm token](https://docs.npmjs.com/creating-and-viewing-authentication-tokens) for CI package publishing.\n\n### Used With Manual Git Setup\n\nThe following will get you a ready to go new repository on GitHub based on this one.\n\n1. Run:\n\n   ```\n   gh repo clone jasonkuhrt/template-typescript-lib \u003cdirectory\u003e \u0026\u0026 \\\n   cd \u003cdirectory\u003e \u0026\u0026 \\\n   pnpm install \u0026\u0026 \\\n   pnpm bootstrap\n   ```\n\n2. [Setup a repo secret](https://help.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets) called `NPM_TOKEN` containing an [npm token](https://docs.npmjs.com/creating-and-viewing-authentication-tokens) for CI package publishing.\n\n## Details\n\n\u003c!-- toc --\u003e\n\n- [TypeScript](#typescript)\n- [ESLint](#eslint)\n- [Vitest](#vitest)\n- [Dripip](#dripip)\n- [Simple succinct friendly low-barrier issue templates](#simple-succinct-friendly-low-barrier-issue-templates)\n- [dprint](#dprint)\n- [npm scripts for development lifecycle](#npm-scripts-for-development-lifecycle)\n- [CI with GitHub Actions](#ci-with-github-actions)\n- [Renovate](#renovate)\n- [PnPM](#pnpm)\n- [CJS+ESM Hybrid package build](#cjsesm-hybrid-package-build)\n- [VSCode Settings](#vscode-settings)\n- [Readme Table of Contents](#readme-table-of-contents)\n- [Useful TypeScript Libraries](#useful-typescript-libraries)\n\n\u003c!-- tocstop --\u003e\n\n#### [TypeScript](https://www.typescriptlang.org/) for Type Safety \u0026 Productivity\n\n1. Optimal settings for type safety via `@tsconfig/node18` and `@tsconfig/strictest`\n1. `.tsbuildinfo` cache setup, output discretely into `node_modules/.cache`\n1. Base `tsconfig.json` shared across `tests` and `src`.\n1. Optimal output setup for your users\n\n   1. [`declaration`](https://www.typescriptlang.org/tsconfig#declaration) so your users can power their intellisense with your packages typings.\n   1. [`declarationMap`](https://www.typescriptlang.org/tsconfig#declarationMap) enabled to make your published source code be navigated to when your users use \"go to definition\".\n   1. `package.json` [`typeVersions`](https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html#version-selection-with-typesversions) used to emit only **one** set of declaration files shared by both CJS and ESM builds.\n   1. [`sourceMap`](https://www.typescriptlang.org/tsconfig#sourceMap) enabled to allow your users' tools to base off the source for e.g. stack traces instead of the less informative derived built JS.\n   1. Publish `src` with build files so that jump-to-definition tools work optimally for users.\n\n1. `tsx` for running TypeScript scripts/modules.\n\n#### [ESLint](https://eslint.org/) For Linting\n\n1. TypeScript integration\n1. TS type-checker powered eslint checks enabled\n1. Setup as a CI check for PRs\n1. Always display as warning to keep IDE error feedback for TypeScript (CI enforces warnings).\n1. Auto-fixable import sorting\n\n#### [Vitest](https://vitest.dev) for Testing\n\nJust Works :)\n\n#### [Dripip](https://github.com/prisma-labs/dripip) for Releasing\n\n#### Simple succinct friendly low-barrier issue templates\n\n1. Emojis ✈️\n1. Feature / bug / docs / something-else\n1. Config to display discussions link right in new issue type listing UI\n\n#### [dprint](https://dprint.dev/) for code formatting\n\n1. Setup as a CI check for PRs\n1. [VSCode extension](https://marketplace.visualstudio.com/items?itemName=dprint.dprint) in recommended extensions list so that when collaborators open the project they'll get prompted to install it if they haven't already.\n1. npm script\n\n#### npm scripts for development lifecycle\n\n1. `clean` to remove cache and build files\n1. `build` that runs `clean` beforehand\n1. `prepublishOnly` that runs `build` beforehand\n1. `format` to run `dprint` over whole codebase\n1. `lint` to run `eslint` over whole codebase\n\n#### CI with GitHub Actions\n\n1. Separate trunk and pull-request (PR) workflows.\n1. [Dependency install cache](https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#caching-packages-dependencies) enabled.\n1. On PR:\n   1. Formatting Check\n   1. Lint Check\n   1. Type Check\n   1. Tests across matrix of mac/linux/windows for Node 14/16\n1. On trunk:\n   1. Tests across matrix of mac/linux/windows for Node 14/16\n   1. Automated canary release\n\n#### [Renovate](https://github.com/renovatebot/renovate) configuration\n\n1. JSON Schema setup for optimal intellisense\n1. Group all non-major devDependency updates into single PR (which \"chore\" conventional commit type)\n1. Group all major devDependency updates into single PR (with \"chore\" conventional commit type)\n1. Group all non-major dependency updates into single PR (with \"deps\" conventional commit type)\n1. Each major dependency update in own PR (with \"deps\" conventional commit type)\n\n#### [PnPM](https://pnpm.io/) for package management\n\n1. Using [Corepack](https://nodejs.org/api/corepack.html#enabling-the-feature). This means the PnPM specified in `package.json` will be used. And note this is a PnPM binary shipped with Node now. In a future version of Node you will not need to even opt-in into Corepack. Make sure you've done `corepack enable` at least once.\n\n#### CJS+ESM Hybrid package build\n\nAn [actually working](https://kuhrt.me/logs/hybrid-esm-cjs-node-packages-using-typescript-take-2) hybrid CJS/ESM build.\n\n#### VSCode Settings\n\n1. Optimize project search by recursively (ready for monorepo) ignoring `build/*`, snapshots, lock files, and more.\n1. On-Save actions for optimal editing experience (e.g. ESLint auto-fix to [organize imports automatically](https://github.com/lydell/eslint-plugin-simple-import-sort#can-i-use-this-without-autofix))\n1. List of VSCode extensions that users who open the project will be prompted to install if they don't already.\n1. Enable `typescript.enablePromptUseWorkspaceTsdk` so that oneself and collaborators will get prompted to use the workspace version of TypeScript instead of the one in the editor.\n\n#### Readme Table of Contents\n\n1. Using [`markdown-toc`](https://github.com/jonschlinkert/markdown-toc)\n\n#### Useful TypeScript Libraries\n\nHere are some TypeScript libraries you might want to use for your new project:\n\nhttps://github.com/stars/jasonkuhrt/lists/typescript\n\n![Alt](https://repobeats.axiom.co/api/embed/3c932f1cb76da4ad21328bfdd0ad1c6fbbe76a0b.svg 'Repobeats analytics image')\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjasonkuhrt%2Ftemplate-typescript-lib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjasonkuhrt%2Ftemplate-typescript-lib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjasonkuhrt%2Ftemplate-typescript-lib/lists"}