Skip to content

Strip decorators and unused imports from a TypeScript project

Notifications You must be signed in to change notification settings

jfrazier-eth/strip-decorators

Repository files navigation

strip-decorators

Small library and CLI tool to strip decorators and unused imports from a TypeScript project. Using the TypeScript compiler API.

Installation

CLI

Install the CLI version globally:

npm i -g strip-decorators

Usage: strip-decorators <entrypoint> <path to tsconfig>

Example: strip-decorators ./src/index.ts ./tsconfig.json

Library

Install the dev dependency locally:

npm i -D strip-decorators

Usage:

import { compileFromOptions } = from 'strip-decorators';
import * as tsconfig from './tsconfig.json';

(() => {
  const entrypoints = ['./src/index.ts'];
  compileFromOptions(entrypoints, tsconfig.compilerOptions);
})();

See the example for more details.

Development

$ git clone https://github.com/jfrazier-eth/strip-decorators.git && cd strip-decorators
$ npm install
$ npm run build

References