All Projects → metachris → typescript-boilerplate

metachris / typescript-boilerplate

Licence: MIT license
A modern TypeScript project setup, for Node.js and browsers (using esbuild).

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to typescript-boilerplate

sqrs
🚌SQRS is a JavaScript library for implementing CQRS pattern.
Stars: ✭ 23 (-95.42%)
Mutual labels:  jest, typedoc
tangerine-monorepo
A "fast" TypeScript-based Node.js monorepo setup powered by esbuild & turborepo
Stars: ✭ 191 (-61.95%)
Mutual labels:  jest, esbuild
Typescript Library Starter
Starter kit with zero-config for building a library in TypeScript, featuring RollupJS, Jest, Prettier, TSLint, Semantic Release, and more!
Stars: ✭ 3,943 (+685.46%)
Mutual labels:  jest, typedoc
zero
📦 A zero config scripts library
Stars: ✭ 17 (-96.61%)
Mutual labels:  jest
esbuild-rails
Esbuild Rails plugin
Stars: ✭ 102 (-79.68%)
Mutual labels:  esbuild
aegir
AEgir - Automated JavaScript project building
Stars: ✭ 73 (-85.46%)
Mutual labels:  esbuild
react-initial-bootstrap
an "almost complete" template for your new projects
Stars: ✭ 24 (-95.22%)
Mutual labels:  jest
nodejs-graphql-template
Template project for Node.js® GraphQL APIs
Stars: ✭ 13 (-97.41%)
Mutual labels:  jest
ts-detox-example
Example TypeScript + React-Native + Jest project that integrates Detox for writing end-to-end tests
Stars: ✭ 54 (-89.24%)
Mutual labels:  jest
typescript-nuxtjs-boilerplate
🍱 Nuxt.js with TypeScript and Run with docker and docker-compose 🐶🦄🔥 visit: https://typescript-nuxtjs-boilerplate.netlify.com/example
Stars: ✭ 51 (-89.84%)
Mutual labels:  jest
Coursera-Clone
Coursera clone
Stars: ✭ 48 (-90.44%)
Mutual labels:  jest
react-jest-enzyme-example
A minimal configuration for testing React components with Jest and Enzyme.
Stars: ✭ 23 (-95.42%)
Mutual labels:  jest
nodejs-vuejs-mysql-boilerplate
Node.js (REST API) + Vue.js/Nuxt.js (Frontend/Backend) + MySQL Boilerplate
Stars: ✭ 134 (-73.31%)
Mutual labels:  jest
graphql-workshop
🕸️ GraphQL Node.js Workshop: Create an API Gateway
Stars: ✭ 20 (-96.02%)
Mutual labels:  jest
ionic2-jest-example
Example of how to test an Ionic2 app with Jest
Stars: ✭ 43 (-91.43%)
Mutual labels:  jest
wily
Build Node.js APIs from the command line (Dead Project 😵)
Stars: ✭ 14 (-97.21%)
Mutual labels:  jest
aws-nestjs-starter
Serverless, AWS, NestJS, GraphQL and DynamoDB starter
Stars: ✭ 200 (-60.16%)
Mutual labels:  jest
React-Redux-Enterprise
A React-Redux boilerplate for enterprise/large scaled web applications
Stars: ✭ 77 (-84.66%)
Mutual labels:  jest
xv
❌ ✔️ zero-config test runner for simple projects
Stars: ✭ 588 (+17.13%)
Mutual labels:  jest
ng-nest-cnode
Angular 10 Front-End and Nestjs 7 framework Back-End build Fullstack CNode
Stars: ✭ 17 (-96.61%)
Mutual labels:  jest

TypeScript Boilerplate for 2021

Build and test status

TypeScript project boilerplate with modern tooling, for Node.js programs, libraries and browser modules. Get started quickly and right-footed 🚀

See also the introduction blog post: Starting a TypeScript Project in 2021.

Getting Started

# Clone the repository (you can also click "Use this template")
git clone https://github.com/metachris/typescript-boilerplate.git your_project_name
cd your_project_name

# Edit `package.json` and `tsconfig.json` to your liking
...

# Install dependencies
yarn install

# Now you can run various yarn commands:
yarn cli
yarn lint
yarn test
yarn build-all
yarn ts-node <filename>
yarn esbuild-browser
...
  • Take a look at all the scripts in package.json
  • For publishing to npm, use yarn publish (or npm publish)

esbuild

esbuild is an extremely fast bundler that supports a large part of the TypeScript syntax. This project uses it to bundle for browsers (and Node.js if you want).

# Build for browsers
yarn esbuild-browser:dev
yarn esbuild-browser:watch

# Build the cli for node
yarn esbuild-node:dev
yarn esbuild-node:watch

You can generate a full clean build with yarn build-all (which uses both tsc and esbuild).

  • package.json includes scripts for various esbuild commands: see here
  • esbuild has a --global-name=xyz flag, to store the exports from the entry point in a global variable. See also the esbuild "Global name" docs.
  • Read more about the esbuild setup here.
  • esbuild for the browser uses the IIFE (immediately-invoked function expression) format, which executes the bundled code on load (see also evanw/esbuild#29)

Tests with Jest

You can write Jest tests like this:

import { greet } from './main'

test('the data is peanut butter', () => {
  expect(1).toBe(1)
});

test('greeting', () => {
  expect(greet('Foo')).toBe('Hello Foo')
});

Run the tests with yarn test, no separate compile step is necessary.

Documentation, published with CI

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.

Generate the documentation, using src/main.ts as entrypoint (configured in package.json):

yarn docs

The resulting HTML is saved in docs/.

You can publish the documentation through CI:

This is the documentation for this boilerplate project: https://metachris.github.io/typescript-boilerplate/

References

Feedback

Reach out with feedback and ideas:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].