ts-purify
    TypeScript icon, indicating that this package has built-in type declarations

    3.0.5 • Public • Published

    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\""
    }

    Install

    npm i ts-purify

    DownloadsWeekly Downloads

    206

    Version

    3.0.5

    License

    ISC

    Unpacked Size

    20.5 kB

    Total Files

    18

    Last publish

    Collaborators

    • jpike