1.1.0 • Published 2 years ago

pretty-ts-imports v1.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

primp is a tool to sort your typescript imports by a set of complex rules. Now you can have the imports your way, if you want that.

Installation

Simply install primp via command line with npm or yarn globally.

# via npm registry
npm install -g pretty-ts-imports

# via github registry
npm install -g @cptpiepmatz/pretty-ts-imports

Or in your project locally.

# via npm registry
npm install -D pretty-ts-imports

# via github registry
npm install -D @cptpiepmatz/pretty-ts-imports

Usage

# using the short form
primp <path>

# using the long form
pretty-ts-imports <path>

Arguments

By using argument flags you can further control primp to more specifically fit your needs.

  • -r, --recursive run recursively over the given directory
  • -o, --output output the files to the given path instead of in-place updates
  • -t, --tsconfig overwrite path to tsconfig
  • -c, --config overwrite path to config
  • -w, --watch run primp in watch mode

Config

You can use a config to customize how primp should handle your files. Primp will try to automatically find a primp-config in the given path and above it. If primp still won't find your config, you can help it out using the -c flag.

Primp will recognize following file formats automatically:

  • .json
  • .json5
  • .yml
  • .yaml

And following file names:

  • primp
  • pretty-ts-imports
  • prettytsimports

Examples of the config files may be found in examples.

Explanation of the config may be found in primp.json5 or in primp.yml.

Programmatically Usage

If you want to use elements of this code in your codebase. Either for handling imports yourself or using the sorter in webpack or anything like that, you can easily import them from this package.

You can find docs here.