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

1.0.11 • Public • Published

TStevedore

TStevedore is a utility that automates the task of changing typescript imports from one module to be from another module. It provides a straightforward API and an interactive prompt for ease of use.

For example if you have a module my-utils that exports a function myFunction, but you decide to create a new module my-functions that exports the same function, you can use TStevedore to change all imports of my-utils to my-functions.

Outputs are prettier-formatted.

Before:

import { myFunction, someOtherModule } from 'my-utils';

After:

import { someOtherModule } from 'my-utils';
import { myFunction } from 'my-functions';

Usage

To run TStevedore, use the following command:

npx tstevedore

Command Line Interface

TStevedore is meant to be run interactively with the npx tstevedore command. But a CLI is provided for convenience. To run TStevedore with command-line arguments, use:

npx stevedore -i [identifiers] -r [regex expressions] -o [oldModule] -n [newModule] -d [directory] 

Arguments:

  • -i, --identifiers: Identifiers to target (array of strings)
  • -o, --oldModule: Old module name
  • -n, --newModule: New module name
  • -r, --regex: Regex to target (array of strings)
  • -d, --directory: Path to the directory you want to target (default is current directory)
  • --ignoreNodeModules: Ignore node_modules/**? (boolean, default is true)

The identifiers, oldModule, and newModule arguments are mandatory. If any are missing, the tool will not run.

Installation

TStevedore doesn't require explicit installation if you're using npx. However, if you'd like to install it globally on your system, use the following command:

npm install -g tstevedore

Readme

Keywords

none

Package Sidebar

Install

npm i tstevedore

Weekly Downloads

1

Version

1.0.11

License

MIT

Unpacked Size

53.5 kB

Total Files

50

Last publish

Collaborators

  • trevor-coleman