npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

tys

v0.2.5

Published

Run typescript scripts faster with cached compilation.

Downloads

4

Readme

Tys

Tys runs TypeScript scripts with full type checking and a persistent cache for speed.

# run a script
tys myScript.ts

# use gulp with a TypeScript gulpfile.ts
gulptys --tasks

TypeScript fans prefer TypeScript to JavaScript to get better error checking, richer IDE support, etc. But TypeScript compilation takes a second or two and requires some build boilerplate. Hopefully tys makes it easier to use TypeScript scripts for lightweight tasks.

Alternatives to tys for running a TypeScript

ts-node is more general purpose, but for the specific case of running command line scripts, tys is about 4x faster than ts-node because tys caches compilation results externally.

sucrase-node is faster than ts-node, but provides no type checking.

Add .ts config file support to an existing tool with .js config files

Tys can also compile and cache TypeScript configuration files for existing tools that use .js configuration files.

See gulptys for an example. A gulptys symlink is installed when you install tys. (gulp also supports .ts config files on its own, but the gulptys wrapper is 4x faster.)

Create a new tool with .ts config files

See config-file-ts to integrate caching TypeScript config files into tools you write.

Install

# yarn project
yarn add --dev tys

# npm project
npm -i --dev tys

# general use via yarn
yarn global add tys

# general use via npm
npm -i -g tys

Usage

tys [tys options] cmd.ts [-- cmd arguments]
tys -c [tysConfigFile] [tys options] [-- cmd arguments]

Command line options

  • --otherTsFiles <glob glob glob> If your TypeScript script imports other TypeScript files, list them here so that tys knows when to recompile. No need to list packages installed in node_modules.
  • --command <cmd> [cmd arguments] Execute this command after TypeScript compilation instead of executing the compiled TypeScript. This is handy to compile a config file for an existing tool.

Advanced command line options

  • -c, --config [configFile] Specify tys options by default exporting a TysConfig structure from a TypeScript file. If -c is specified without an config file, tys will look for a file named tysconfig.ts in the current directory, the directory containing a link to tys if tys was launched via a symlink. and the tys installation directory.

  • --outDir <directory> Directory in which to cache transpiled JavaScript output files. Without this option, tys caches in $HOME/.cache/tys.

  • [symlink-to-tys] <cmd arguments> If tys is launched through a symlink, tys will look for a configuration file named after the symlink, e.g. symlink-to-tys.config.ts. All command line arguments are passed to the configured command. See gulptys for an example.