Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

typescript-boilerplate-2021

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typescript-boilerplate-2021

Boilerplate for a TypeScript library

Source
npmnpm
Version
0.2.0
Version published
Weekly downloads
4
Maintainers
1
Weekly downloads
 
Created
Source

TypeScript Project Boilerplate

TypeScript project with modern tooling (March 2021) to get started quickly and right-footed. Ideal for quick projects as well as npm packages.

Batteries included:

  • TypeScript 4, optionally esbuild
  • Linting with typescript-eslint (tslint is deprecated)
  • Tests with Jest (and ts-jest)
  • CI for testing and linting (GitHub Actions / Gitlab CI)
  • Automatic API documentation with typedoc
  • Building a browser-compatible module with esbuild or webpack

See also the introduction blog post.

Getting Started

  • Clone the repository (you can also click "Use this template")
  • Edit package.json and tsconfig.json to your liking
  • Now you can run yarn run, yarn lint, yarn test, yarn build and yarn ts-node <filename>.
  • For publishing to npm, use yarn publish (or npm publish)

Want documentation, published to GitHub or GitLab pages?

You can auto-generate API documentation from the TyoeScript source files using typedoc. The generated documentation can be published to GitHub / GitLab pages through the CI:

  • Install typedoc: yarn add -D typedoc
  • Add docs script to package.json: "docs": "typedoc --entryPoints src/main.ts"
  • You can now generate the documentation with yarn docs. The resulting HTML is saved in docs/.
  • Publish to pages through CI:
    • GitHub pages: uncomment content of .github/workflows/deploy-gh-pages.yml and enable pages in GitHub repo settings
    • GitLab pages: uncomment deploy task in .gitlab-ci.yml

esbuild

You can use esbuild instead of the default TypeScript compiler (tsc) to build and bundle the output for node and browsers. esbuild is an extremely fast bundler that supports a large part of the TypeScript syntax.

# Install esbuild
yarn add -D esbuild

# Compile and bundle, with cli as entrypoint
./node_modules/.bin/esbuild src/cli.ts --bundle --platform=node --outfile=dist/esbuild/cli.js

# Build for browsers
./node_modules/.bin/esbuild src/browser.ts --bundle --outfile=dist/browser.js

References

Feedback

Please post your feedback and/or ideas:

FAQs

Package last updated on 15 Apr 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts