Skip to content

Starting point for a new TypeScript package, suitable for both frontend and backend.

License

Notifications You must be signed in to change notification settings

mediamonks/typescript-package-template

Repository files navigation

{{todo}}

Getting started

Installing

Add {{todo}} to your project:

npm i {{todo}}

Examples

import {{todo}} from '{{todo}}';

Instructions for setting up this new package

  1. Change all the {{todo}} occurrences to the name of your package.
  2. Change the package.json "name" to match your package.
  3. Change the package.json "repository" to match your repository.
  4. Change the package.json "author" to match your name.
  5. Change the package.json "keywords" to match your package.
  6. Change the package.json "description" to match your package.
  7. Start coding in the src folder.
  8. Remove this section from the README.md file.

Contributing

Development

npm install # to install all dependencies
npm run test # to run tests
npm run test -- --watch # to develop while running tests
npm run typecheck # to check types in the project
npm run lint # to run eslint
npm run fix # to fix eslint errors
npm run format # to run prettier
npm run build # create a build in the dist folder

Husky and lint-staged are set up to run before every commit, so you don't have to worry about formatting or linting.

Publishing

GitHub Actions

We are using GitHub Actions to build & publish the package to NPM. The workflow is triggered manually from the GitHub Actions tab. There you will be able to select a npm version update type (patch, minor, major) and a release type (rc, beta, alpha).

The GitHub Action does the version update, tagging, and committing as part of the workflow. The way the version number is retrieved from the package.json after updating it is specific for non-workspace projects. If you are using a workspace project, you will need to update the GitHub Workflow configuration differently.

# get a bare npm version without quotes

# non-workspace
npm pkg get version | tr -d '"'

# workspace
npm pkg get version | jq -r '.[]'

Automatic nightly dev builds

Dev builds (with the -dev.{commit} postfix) are published to the @next tag, and trigger automatically on every push to the main branch (e.g. when a PR is merged).

Manual

npm run build
npm publish

About

Starting point for a new TypeScript package, suitable for both frontend and backend.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published