Socket
Socket
Sign inDemoInstall

ts-purify

Package Overview
Dependencies
13
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ts-purify

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


Version published
Weekly downloads
69
increased by11.29%
Maintainers
1
Created
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

FAQs

Last updated on 20 Oct 2021

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc