Skip to content

Commit

Permalink
fix(docs): update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
nivekcode committed Jun 26, 2020
1 parent b453603 commit e212184
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 4 deletions.
70 changes: 66 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,70 @@
![Logo](https://raw.githubusercontent.com/kreuzerk/import-conductor/master/assets/logo.png)

#import-conductor
Automatically organize your import statements to keep your code clean
and readable.
and readable. Clean imports allow you to get a quick overview of the
modules used in your code.

![Demo](https://raw.githubusercontent.com/kreuzerk/import-conductor/master/assets/demo.gif)

## What it does

Import conductor will order all imports into the following blocks:

```
1. Block - third party libraries
2. Block - user / company libraries
3. Block - imports from other modules or directories in your codebase
4. Block - imports fro the same module
```

Take a look at the following source file. It's hard to distinguish
between third party imports, company wide imports and files from same module.

```
import { Component, OnInit } from '@angular/core';
import {CustomerService} from './customer.service';
import {Customer} from './customer.model';
import {Order} from '../order/order.model';
import {LoggerService} from '@myorg/logger';
import {Observable} from 'rxjs';
```

A cleaner version of this could look like the following:

```
import { Component, OnInit } from '@angular/core';
import {Observable} from 'rxjs';
import {LoggerService} from '@myorg/logger';
import {Order} from '../order/order.model';
import {CustomerService} from './customer.service';
import {Customer} from './customer.model';
```

Of course, it's a lot of work to order all import statements in existing code bases.
Furthermore, in bigger development teams it's hard to enforce this syntax so that every
developer orders their imports accordingly. Especially with AutoImports in IDEs.

_That's where import-conductor comes into play_.
Import conductor can reorder all imports in your project and you can run
in combination with tools like for example `husky` to automatically reorder
import of changed files in a pre commit hook.

# Usage

`import-conductor` can be run via command line or as part of your npm scripts.

# Work in progess
## Arguments

First versions is already available for Beta users - first official
release is coming soon.
| Argument | Description |
| -------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| -s --source | regex to that matches the source files |
| -p --userLibPrefixes | the prefix of custom user libraries - this prefix is used to distinguish between third party libraries and company libs |
| --staged | run against staged files |
| -d --disableAutoAdd | disable automatically adding the commited files when the staged option is used |
Binary file added assets/demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e212184

Please sign in to comment.