Sort your TS Imports with complex Rules.
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.
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
# using the short form
primp <path>
# using the long form
pretty-ts-imports <path>
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 modeYou 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.yamlAnd following file names:
primppretty-ts-importsprettytsimportsExamples of the config files may be found in examples.
Explanation of the config may be found in primp.json5 or in primp.yml.
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.
Generated using TypeDoc