2.2.0 โ€ข Published 28 days ago

@akashrajpurohit/ts-npm-template v2.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
28 days ago

@akashrajpurohit/ts-npm-template is a opinionated bootstrap template to create NPM packages.

Read more about the template and how it works in this guide.

Usage ๐Ÿ’ป

Click on the "Use this template" button from the options to create a new repository using this template. This will create a new repository with the same structure as this repository.

That is pretty much it, follow the configuration steps for setting up your package and its done ๐ŸŽ‰

Technology stack ๐Ÿš€

  • ๐Ÿ™๐Ÿพ Typescript with tsup build tool.
  • โšก๏ธ Vitest - Unit Test Framework
  • ๐Ÿ“ฆ Changesets - A way to manage your versioning and changelogs.
  • ๐Ÿ“– Typedoc - Generate documentation of your package.
  • ๐Ÿ”€ Github Actions - CI pipelines
  • ๐Ÿ’ช PNPM - Package manager

Configurations โš™๏ธ

Github Actions

In order for changesets to be able to create pull requests, you need to allow it to create and approve pull requests. You can find these settings under the repository settings in the "Actions" tab.

Allow changesets to create pull requests

Release to NPM

Few configurations are required for making the publishing and releasing to NPM automated.

First thing is to generate a NPM token. Automation tokens are recommended since they can be used for an automated workflow, even when your account is configured to use the auth-and-writes level of 2FA.

Save this token as NPM_TOKEN in github actions secrets.

Code coverage badge

If you want to generate a code coverage badge for your package, you need to follow the steps and configure the gist mentioned by dynamic-badges-action.

You need to add the GIST_SECRET in the github actions secrets if you are planning to add the code coverage badge.

Once you have followed the steps above and created a gist, uncomment these lines in the workflow file

- name: Get Coverage for badge ๐Ÿ”ข
  run: |
    COVERAGE="$(cat coverage/coverage-summary.json | jq -r '.total.lines.pct')"
    echo "COVERAGE=$(echo ${COVERAGE})" >> $GITHUB_ENV

- name: Create coverage badge โœ๐Ÿฝ
  uses: schneegans/dynamic-badges-action@v1.6.0
  with:
    auth: ${{ secrets.GIST_SECRET }}
    gistID: <gist-id>
    filename: <file-name>.json
    label: Code Coverage
    message: ${{ env.COVERAGE }}
    color: green
    namedLogo: vitest

Note: Make sure you change the <gist-id> and <file-name> in the ci.yml file along with the gist id in the coverage badge link in the README.md file.

Auto generate docs ๐Ÿ“š

The project is configured to auto-generate the documentation using typedoc. The documentation is generated in the docs folder.

The documentation will get generated when the code is pushed to the main branch. You can also generate the documentation locally by running the command pnpm run build:docs.

Contributing ๐Ÿซฑ๐Ÿปโ€๐Ÿซฒ๐Ÿผ

Follow the contribution guidelines to contribute to this project.

Bugs or Requests ๐Ÿ›

If you encounter any problems feel free to open an issue. If you feel the project is missing a feature, please raise a ticket on GitHub and I'll look into it. Pull requests are also welcome.

Projects using this template ๐Ÿ™Œ๐Ÿฝ

Are you using this template for your project? Feel free to open a PR and add your project to the list.

Where to find me? ๐Ÿ‘€

Website Badge Twitter Badge Linkedin Badge Instagram Badge Telegram Badge

2.2.0

28 days ago

2.1.0

1 month ago

2.0.0

1 month ago

1.2.0

2 months ago

1.6.0

2 months ago

1.5.0

2 months ago

1.4.0

2 months ago

1.3.0

2 months ago

1.1.1

2 months ago

1.1.0

2 months ago

1.0.5

7 months ago

1.0.4

8 months ago

1.0.3

10 months ago

1.0.2

11 months ago

1.0.1

12 months ago

1.0.0

12 months ago