TypeScript npm library project structure

TypeScript npm library project structure

Explorer

  • .git…
  • .changesetnew
  • config.jsonnew
  • README.mdnew
  • quick-owls-retry.mdnew
  • .vscodenew
  • settings.jsonnew
  • extensions.jsonnew
  • coverage…new, not committed
  • dist…, not committed
  • examplesnew
  • basic.tsnew
  • database-reconnect.tsnew
  • fetch-with-abort.tsnew
  • node_modules…, not committed
  • src
  • index.ts
  • retry.tsnew
  • backoff.tsnew
  • errors.tsnew
  • timeout.tsnew
  • hooks.tsnew
  • types.tsnew
  • tests
  • index.test.ts
  • retry.test.tsnew
  • backoff.test.tsnew
  • abort.test.tsnew
  • errors.test.tsnew
  • timeout.test.tsnew
  • fetch.test.tsnew
  • types.test-d.tsnew
  • .editorconfig
  • .gitignore
  • .node-versionnew
  • lefthook.ymlnew
  • pnpm-workspace.yamlnew
  • biome.jsonnew
  • CHANGELOG.mdnew
  • CONTRIBUTING.mdnew
  • LICENSE
  • package.json
  • pnpm-lock.yaml
  • README.md
  • tsconfig.json
  • tsdown.config.ts
  • vitest.config.tsnew
  1. # Create the library from the official tsdown starter (pick "Default")

    pnpm create tsdown@latest retry-kit
  2. # Build once, then run the tests

    cd retry-kit && pnpm install && pnpm build && pnpm test
  3. # Add lint, format and packaging checks

    pnpm add -D @biomejs/biome publint @arethetypeswrong/core @arethetypeswrong/cli
  4. # Set up Changesets for versions and changelogs

    pnpm add -D @changesets/cli && pnpm changeset init
  5. # Record a change before opening a pull request

    pnpm changeset
  6. # Check what would be published, without publishing

    pnpm pack --dry-run
  7. # Add API reports and size budgets for a mature package

    pnpm add -D @microsoft/api-extractor size-limit @size-limit/preset-small-lib knip