Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@theomessin/ts-builder

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

@theomessin/ts-builder

TypeScript build system support for Node.js

  • 0.1.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
78
increased by105.26%
Maintainers
1
Weekly downloads
 
Created
Source

@theomessin/ts-builder

ts-builder is a simple script that enables Node.js to require TypeScript files. It is similar to ts-node.

It uses tsc --build to build a TypeScript project including any references. The new TypeScript build mode is quite fast as it uses a cache to perform smart incremental builds.

Installation

Install the package from npm:

npm install --save-dev @theomessin/ts-builder

You may then use ts-builder by registering it with Node.js:

node -r @theomessin/ts-builder foobar.ts

Behind the Scenes

ts-builder will register itself as the handler for all *.ts files. When a *.ts file is required the following steps will be performed.

  1. The corresponding tsconfig.json for that file will be found.
  2. The project will be built using tsc --build. This will build any project references. The outDir will be unaltered so compiled files will be saved as configured in tsconfig.json.
  3. The contents of the compiled .js file of the given .ts file will be returned.

Using with Mocha

ts-node does not support project references, which means that Mocha could not be used with TypeScript project references and the new build system. However, ts-builder can be used instead.

Just run mocha with -r @theomessin/ts-builder/register. Alternatively, register ts-builder in your .mocharc.js:

module.exports = {
  extension: ['ts'],
  require: [
    '@theomessin/ts-builder/register',
  ],
};

Keywords

FAQs

Package last updated on 02 Nov 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc