Skip to content

derived-studio/rollup-ts-jest-react

 
 

Repository files navigation

Typescript, Rollup & Jest Starter

Starter project for building typescript projects using Rollup and Jest, React and React Test Library.

Inspiration

This project has been originally inspired, and thus forked from danielelder/typescript-rollup-jest. It shares the same ISC license but doesn't really share much code.

Usage

git clone --depth=1 git@github.com:derived-studio/rollup-ts-jest-react.git [yourProjectName]

Optional

To remove git history run from project folder

yarn
yarn detach

After detaching remove detach script from package.json and run

git add .
git commit "Initial commit"

Original features

  • Statically typed build system for working with Typescript.
  • Consistent code style with TSLint. - (removed)
  • Dead code elimination
  • Rollup for bundling
  • Jest for unit testing and code coverage
  • JSDOM for DOM based testing
  • Flexible build configuration using environment variables
  • Rapid development with automatic javascript building and browser hot reloading
  • Easy debugging via VSCode integration

Fork features

  • Uses typescript-eslint@3.7.1 instead of tslint
  • Adds NPM distribution friendly output bundle files
  • Distributes with TS definition files
  • Includes an example build for naive greeter lib
  • Improves jest configuration with initial jest setup
  • Supports React and React-Dom
  • Includes React Testing Library
  • Git hooks for pre commit and pre push (with husky)
  • Contains yarn detach script removing git history

Todo

  • Clean up npm scripts (in progress)
  • Restore serve files
  • Include react in an example build

Scripts

  • build - Builds the minified production bundle along with typescript modules
  • test - Runs tests with code coverage report
  • lint - Lints source files
  • clean - removes dist folder
  • serve - temporarily disabled Builds the development bundle, creates a local server and watches for changes

VS Code Integration

Tasks

Access the task list using shift+command+b (ctrl+shift+b in Windows) to run any of the above scripts.

Debugging

Unit tests can be debugged from within VS Code by placing a break point within your code and then launching the debugger.

  • Jest - All - Runs all unit tests in debug mode
  • Jest - Current - Runs the currently visible within VS Code editor

Coverage reports

The coverage reports are generated with Jest, and output to the /coverage folder.

To view the html report open: coverage/lcov-report/index.html

About

Typescript starter project with Rollup and Jest

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 91.6%
  • TypeScript 4.2%
  • HTML 4.2%