• Stars
    star
    216
  • Rank 183,179 (Top 4 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 4 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Fast TypeScript runner using esbuild for eager compilation

ts-eager

Fast TypeScript runner and register hook with eager compilation.

Similar to ts-node, except it uses esbuild – an extremely fast TypeScript transpiler – to eagerly compile all included files from your tsconfig.json on startup. This makes a noticeable difference for tasks where you're likely to load a good portion of your TS files, eg running tests.

It falls back to lazy compilation if a file is require'd that's not in tsconfig.json, and will also fallback to ts-node (if it's installed) for any type-specific compilation that esbuild doesn't support (such as emitDecoratorMetadata). It will also optionally require tsconfig-paths for paths support if your tsconfig needs it.

Installation

npm install -D ts-eager

# Optional, but recommended: for determining files from tsconfig.json
npm install -D typescript

# Optional, if you need emitDecoratorMetadata support
npm install -D ts-node

# Optional, if you need paths support
npm install -D tsconfig-paths

Usage

ts-eager myfile.ts

Or as a require hook:

node -r ts-eager/register myfile.ts

Configuration

ts-eager doesn't have any specific command-line options – it invokes node and passes all command-line arguments through.

It supports these environment variables:

  • TS_EAGER_LOGLEVEL: 'error' (default), 'warning', 'info', 'silent'
  • TS_NODE_PROJECT: tsconfig file (default tsconfig.json)
  • TS_NODE_IGNORE: comma separated regexes to skip compilation completely

Examples

If you want to customize which files ts-eager compiles up-front, you can specify a different tsconfig.json using TS_NODE_PROJECT, and then use the standard TypeScript include/exclude options in your config.

For example, if this was in tsconfig.test.json:

{
  "extends": "./tsconfig.json",
  "include": ["test"],
  "exclude": ["**/*.template.ts"]
}

Then you could run mocha like this:

TS_NODE_PROJECT=tsconfig.test.json mocha -r ts-eager/register

And it would only eagerly compile files in test, and exclude any matching *.template.ts.

mocha also supports adding require hooks in .mocharc.json:

{
  "recursive": true,
  "require": ["ts-eager/register"],
  "timeout": 5000
}

More Repositories

1

mobiledoc-kit

A toolkit for building WYSIWYG editors with Mobiledoc
JavaScript
1,549
star
2

shep

A framework for building JavaScript Applications with AWS API Gateway and Lambda
JavaScript
377
star
3

ember-restless

A lightweight data model library for Ember.js
JavaScript
313
star
4

bluestream

A collection of streams that work well with promises (through, map, reduce). Think Through2 with promises
TypeScript
103
star
5

ember-mobiledoc-editor

JavaScript
86
star
6

streaming-iterables

A Swiss army knife for async iterables. Designed to replace your streams.
TypeScript
43
star
7

ember-cli-amp

render valid Google's Accelerated Mobile Pages project (AMP) pages with your ember app and Fastboot
JavaScript
32
star
8

mobiledoc-dom-renderer

JavaScript
25
star
9

graphql-helper

A simple helper library for constructing GraphQL queries.
JavaScript
24
star
10

ember-cli-deploy-fastboot-lambda

JavaScript
23
star
11

nemesis-db

An Open Source Port of the Gradius API Storage Engine
TypeScript
22
star
12

sammie

Serverless Application Model Made Infinitely Easier
JavaScript
21
star
13

coloring-palette

🎨 🖌 A library to generate color palettes based on Material UI's approach to colors
TypeScript
20
star
14

radredis

Basic redis backed object modeling for Node.
JavaScript
19
star
15

dynamo-graph

Low-level graph operations implemented on DynamoDB
JavaScript
18
star
16

ember-mobiledoc-dom-renderer

Render mobiledoc documents in an ember app
JavaScript
15
star
17

ember-cli-image

Stateful image components for Ember.js
JavaScript
14
star
18

statsd-lambda

A simple UDP based statsd client designed for functions as a service
TypeScript
12
star
19

aws-sudo

JavaScript
10
star
20

radql

Opinionated, service-oriented, GraphQL architecture
JavaScript
9
star
21

yajsondiff

Yet another JSON diff utility, for generating and applying patches
JavaScript
8
star
22

mobiledoc-text-renderer

A text renderer for Mobiledoc
JavaScript
7
star
23

redis_assist

Redis Assist - Easy Redis Backed Object Modeling
Ruby
7
star
24

redis-loader

A Redis command batcher
TypeScript
6
star
25

chai-graphql

GraphQL response matcher for Chai assertion library
JavaScript
6
star
26

mobiledoc-vdom-renderer

🔮 Render Mobiledoc as VDOM by passing your React or React-like `createElement` function
TypeScript
6
star
27

wordpress-exporter

WordPress model exporter for Bustle
PHP
5
star
28

broccoli-test-builder

JavaScript
4
star
29

gziptest

JavaScript
4
star
30

broccoli-multi-builder

JavaScript
4
star
31

ember-cli-image-imgix

An addon that builds on top of ember-cli-image to add imgix.com support
JavaScript
3
star
32

wool

Lambda Wrapper
JavaScript
3
star
33

mobiledoc-html-renderer

Deprecated. See https://github.com/bustlelabs/mobiledoc-dom-renderer#rendering-html
JavaScript
3
star
34

ember-mobiledoc-text-renderer

JavaScript
3
star
35

fastText-layer

fastText for AWS Lambda
Shell
3
star
36

ember-cli-image-lazy

An addon that builds on top of ember-cli-image to add lazy-loaded image support.
JavaScript
2
star
37

slugify

JavaScript
2
star
38

broccoli-amd-loader

JavaScript
2
star
39

max-socket

Prototype socket server for our internal CMS. Used for talk at Ember NYC.
JavaScript
2
star
40

apple-news-cli

A node CLI tool for publishing to Apple News
JavaScript
1
star
41

mobiledoc-jsx-renderer

TypeScript
1
star
42

s3_master

Manage S3 bucket policies without cloudformation
Ruby
1
star
43

graphql-loader

GraphQL Loader for Webpack
TypeScript
1
star
44

statsd-docker

Statsd dockerized service using elasticsearch-statsd-backend
Dockerfile
1
star
45

mobiledoc-apple-news-renderer

JavaScript
1
star