Git Product home page Git Product logo

template-typescript-package's Introduction

TypeScript Package ready to be published to NPM

This is a template TypeScript Package ready to be published to NPM. It has been set up with automated tests and package publishing workflow using GitHub Actions.

The template uses google-github-actions/release-please-action which handles the following use cases:

  1. Automated releases based on conventional commits
  2. Automated CHANGELOG generation
  3. Automated version bumps based on commit messages. It does all of these by parsing the git history, it looks for Conventional Commit messages and it creates PR releases.

It uses npm, TypeScript, Jest, ESLint, Prettier, Husky, commitlint and lint-staged. The production files include CommonJS, ES Modules and TypeScript declaration files.

Install dependencies

Install dependencies with npm:

npm install

Write your code

  1. Update the TODOs inside .github/workflows/publish.yml file
  2. Make the necessary changes in package.json (name, version, description, keywords, author, etc).
  3. Write your code in src/ folder and unit test in tests/ folder, replacing the original files.

Build:

To build/compile the code, simply run:

npm run build

This command will generate CommonJS, ES Module as well as TypeScript declaration files inside the lib/ folder.

Test

Test your code with Jest:

npm run test

Publish

This package is configured to use GitHub Actions CI/CD to automate the publishing of a package to npm.

Follow npm's official instruction to create an npm token.

If you use 2FA, then make sure it's enabled for authorization only instead of authorization and publishing (Edit Profile -> Modify 2FA).

On the page of your newly created or existing GitHub repo, click Settings -> Secrets -> New repository secret, the Name should be NPM_TOKEN and the Value should be your npm token.

Writing Conventional Commits

The most important prefixes you should have in mind are:

  1. fix: which represents bug fixes, and correlates to a SemVer patch.
  2. feat: which represents a new feature, and correlates to a SemVer minor.
  3. feat!:, fix!: or refactor!:, etc., which represent a breaking change (indicated by the !) and will result in a SemVer major.

template-typescript-package's People

Contributors

abhi-markan avatar dependabot[bot] avatar ignatg avatar mend-bolt-for-github[bot] avatar renovate[bot] avatar ttbarnes avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

olafrancis

template-typescript-package's Issues

Dependencies Dashboard (Renovate Bot)

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore(deps): update all to v4 (major) (actions/checkout, actions/setup-node, google-github-actions/release-please-action)
  • chore(deps): update all to v9 (major) (eslint, eslint-config-prettier, husky)
  • chore(deps): update commitlint monorepo to v18 (major) (@commitlint/cli, @commitlint/config-conventional)
  • chore(deps): update commitlint monorepo to v19 (major) (@commitlint/cli, @commitlint/config-conventional)
  • chore(deps): update dependency eslint-plugin-prettier to v5
  • chore(deps): update dependency lint-staged to v14
  • chore(deps): update dependency lint-staged to v15
  • chore(deps): update typescript-eslint monorepo to v6 (major) (@typescript-eslint/eslint-plugin, @typescript-eslint/parser)
  • chore(deps): update typescript-eslint monorepo to v7 (major) (@typescript-eslint/eslint-plugin, @typescript-eslint/parser)
  • ๐Ÿ” Create all rate-limited PRs at once ๐Ÿ”

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/codeql-analysis.yml
  • actions/checkout v3
  • github/codeql-action v2
  • github/codeql-action v2
  • github/codeql-action v2
.github/workflows/publish.yml
  • google-github-actions/release-please-action v3
  • actions/checkout v3
  • actions/setup-node v3
npm
package.json
  • dotenv ^16.0.3
  • ts-node ^10.9.1
  • @commitlint/cli ^17.4.2
  • @commitlint/config-conventional ^17.4.2
  • @types/jest ^29.4.0
  • @typescript-eslint/eslint-plugin ^5.50.0
  • @typescript-eslint/parser ^5.50.0
  • eslint ^8.33.0
  • eslint-config-prettier ^8.6.0
  • eslint-plugin-prettier ^4.2.1
  • husky ^8.0.3
  • jest ^29.4.1
  • lint-staged ^13.1.0
  • prettier ^2.8.3
  • ts-jest ^29.0.5
  • ts-loader ^9.4.2
  • typescript ^5.0.0

  • Check this box to trigger a request for Renovate to run again on this repository

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.