Exciting news!Announcing our $4.6M Series Seed. Learn more
Socket
LoveBlogFAQ
Install
Log in

ts-purify

Package Overview
Dependencies
2
Maintainers
1
Versions
11
Issues
File Explorer

Advanced tools

ts-purify

ensure compiled typescript files are removed when the corresponding source files are

    3.0.5latest

Version published
Maintainers
1
Yearly downloads
16,850
decreased by-42.2%

Weekly downloads

Readme

Source

ts-purify

build status Known Vulnerabilities Renovate

Motivation

When compiling typescript files in src to an output directory in dist with tsc, the js files already existing in dist are left alone, potentially interfering with the build system and tests.

ts-purify deletes all js and js.map files in the output directory with no corresponding ts files when it is run. It can also be configured to watch the source directory for deletions and then delete corresponding output files as they occur.

Instructions

To recursively delete all js and js.map files in dist with no corresponding ts file in src:

% ts-purify -s src -d dist

To do the same as the above command, then use watchman to scan src for deleted ts files and remove files from dist as necessary:

% ts-purify -s src -d dist -w

These invocations show the defaults for -s and -l, they can be omitted when also using src and dist respectively.

The -v or --verbose option can be used to log deleted files. The -p option can be used to use watchman's watch-project command instead of watch.

In most cases package.json scripts will just need to be modified from something like:

{ "build:watch": "tsc -p . -w" }

To:

{ "build:watch": "ts-purify -w & tsc -p . -w" }

To support Windows, use concurrently instead of &:

{ "build:watch": "concurrently \"ts-purify -w\" \"tsc -p . -w\"" }

Keywords

Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc