Skip to content

Commit

Permalink
Update README.MD, update Changelog and bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
praveenperera committed Apr 25, 2022
1 parent c13da1d commit fad9102
Show file tree
Hide file tree
Showing 9 changed files with 127 additions and 107 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## [Unreleased]

## [0.15.0] - 2022-04-25

- Add `--config-file` option, thanks [@mweiss-carerev](https://github.com/mweiss-carerev) [#58](https://github.com/avencera/rustywind/pull/58)

## [0.14.0] - 2022-03-14

- `--ignore-files` option, thanks [@ftonato](https://github.com/neonowy) [#55](https://github.com/avencera/rustywind/pull/55)
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
authors = ["Praveen Perera <[email protected]>"]
edition = "2021"
name = "rustywind"
version = "0.14.0"
version = "0.15.0"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand Down
94 changes: 46 additions & 48 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -48,73 +48,71 @@ Run in CI, exit with error if unsorted classes are found:

- `rustywind --check-formatted .`

For more options run help
Run RustyWind with a custom sorter. The `config_file.json` should have a top level entry of `sortOrder`
which is an array with the classes listed in the order you want them sorted.

- `rustywind --help`
- `rustywind --config-file config_file.json`

## What

Inspired by [Ryan Heybourn's](https://github.com/heybourn) [headwind](https://github.com/heybourn/headwind)
vscode plugin. This is a CLI tool that will look through your project and sort all [Tailwind CSS](https://tailwindcss.com) classes.

It will also delete any duplicate classes it finds.
```shell
RustyWind 0.14.0
Praveen Perera <[email protected]>

## Why?
USAGE:
Run rustywind with a path to get a list of files that will be changed
rustywind . --dry-run

When Ryan released his vscode extension some people expressed an interest in having a CLI version.
If you want to reorganize all classes in place, and change the files run with the `--write` flag
rustywind --write .

In addition, I've had an interest in learning rust. I usually learn by doing. I thought this would be
the perfect opportunity to make a small useful tool while learning rust.
To print only the file names that would be changed run with the `--check-formatted` flag
rustywind --check-formatted .

Keep in mind this is my first rust project. My code here is most likely going to be ugly and not idiomatic rust.
If you are a rust expert you're help in making the code nicer and more idiomatic will be greatly appreciated.
If you want to run it on your STDIN, you can do:
echo "<FILE CONTENTS>" | rustywind --stdin

Any and all feedback and criticism is very welcome. If im doing anything stupid please let me know.
rustywind [FLAGS] <PATH>

## The Plan
ARGS:
<PATH>... A file or directory to run on

### ~~MVP~~
OPTIONS:
--allow-duplicates
When set, RustyWind will not delete duplicated classes

1. ~~Run on current directory~~
2. ~~Order all classes in all files in directory (except for gitignored ones)~~
--check-formatted
Checks if the files are already formatted, exits with 1 if not formatted

#### ~~Development Plan~~
--config-file <CONFIG_FILE>
When set, RustyWind will use the config file to derive configurations. The config file
current only supports json with one property sortOrder,e.g. { "sortOrder": ["class1",
...] }

1. ~~Get a list of all files in current directory recursively.~~ [#1](https://github.com/avencera/rustywind/pull/1)
2. ~~Ignore all files in .gitignore~~ [#1](https://github.com/avencera/rustywind/pull/1)
3. ~~Get all contents from the list of files 1 by 1~~ [#2](https://github.com/avencera/rustywind/pull/2)
4. ~~Run regex on all file contents and get all class names~~ [#3](https://github.com/avencera/rustywind/pull/3)
5. ~~Figure out how to sort class names using sorter array~~ [#4](https://github.com/avencera/rustywind/pull/4)
6. ~~Replace old class names with new list of class names~~ [#5](https://github.com/avencera/rustywind/pull/5)
7. ~~Save file~~ [#6](https://github.com/avencera/rustywind/pull/6)
8. ~~Release via NPM~~ (available via [npm](https://www.npmjs.com/package/rustywind) `npm install rustywind -g`)
- ~~[How to Distribute a Rust Binary on NPM](https://dev.to/kennethlarsen/how-to-distribute-a-rust-binary-on-npm-75n)~~
- ~~[Trust Repo](https://github.com/japaric/trust)~~
- ~~[Example](https://github.com/kennethlarsen/baelte-npm)~~
--custom-regex <CUSTOM_REGEX>
Uses a custom regex instead of default one

### ~~Phase 2 (CLI)~~
--dry-run
Prints out the new file content with the sorted classes to the terminal

1. ~~Add CLI parser~~ [#8](https://github.com/avencera/rustywind/pull/8)
2. ~~Use CLI parser to choose directory or file to run on~~ [#8](https://github.com/avencera/rustywind/pull/8)
3. ~~Add `--write` option which will change the files, change default to printing results to the terminal~~ [#8](https://github.com/avencera/rustywind/pull/8)
-h, --help
Print help information

### ~~Phase 3 (More CLI)~~
--ignored-files <IGNORED_FILES>
When set, RustyWind will ignore this list of files

1. ~~Add `--allow-duplicates` to allow duplicate class name~~ [#10](https://github.com/avencera/rustywind/pull/10)
2. ~~Add `--dry-run` option to print out all changes to console~~ [c975d1](https://github.com/avencera/rustywind/commit/c975d1f041f95b45e15760ccded24dbf62bf1f6f)
--stdin
Uses stdin instead of a file or folder

### ~~Phase 4 (Performance)~~
-V, --version
Print version information

1. ~~Search and change files in parallel (parallel map?)~~ [#9](https://github.com/avencera/rustywind/pull/9)
--write
Changes the files in place with the reorganized classes

### Phase 5 (Match Headwind Features)
```
1. Add custom sorter via CLI args `--customer-sorter=...`
2. ~~Add custom regex via CLI args `--custom-regex=...`~~ [#39](https://github.com/avencera/rustywind/pull/39)
## What
### Later Possibilities...
Inspired by [Ryan Heybourn's](https://github.com/heybourn) [headwind](https://github.com/heybourn/headwind)
vscode plugin. This is a CLI tool that will look through your project and sort all [Tailwind CSS](https://tailwindcss.com) classes.
- Add ability to add custom sorter
- Derive sorter from evaluation generated CSS from tailwind config file
- Add ability to exclude folders, or files using regex pattern
- Add argument for only searching in certain file types
It will also delete any duplicate classes it finds.
1 change: 1 addition & 0 deletions config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "sortOrder": [] }
123 changes: 70 additions & 53 deletions npm/README.MD
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# RustyWind [![Build Status Travis](https://travis-ci.org/avencera/rustywind.svg?branch=master)](https://travis-ci.org/avencera/rustywind) [![Build Status Appveyor](https://ci.appveyor.com/api/projects/status/at89lbs7n35wqy96?svg=true)](https://ci.appveyor.com/project/praveenperera/rustywind) [![npm version](https://badge.fury.io/js/rustywind.svg)](https://badge.fury.io/js/rustywind)

# RustyWind [![Mean Bean CI](https://github.com/avencera/rustywind/workflows/Mean%20Bean%20CI/badge.svg)](https://github.com/avencera/rustywind/actions?query=workflow%3A%22Mean+Bean+CI%22) [![npm version](https://badge.fury.io/js/rustywind.svg)](https://badge.fury.io/js/rustywind)

## Install

Expand All @@ -11,91 +10,109 @@ or

`npm install -g rustywind`

or
or

Install from a github release:

`curl -LSfs https://avencera.github.io/rustywind/install.sh | sh -s -- --git avencera/rustywind`

or
or

Download a release directly from github: [github.com/avencera/rustywind/releases](https://github.com/avencera/rustywind/releases)

or

You can use the dockerized version

`docker run --rm -v $PWD:/app avencera/rustywind:latest <rustywind arguments>`

## Usage

Run rustywind with a path to output updated file contents to the terminal:
- `rustywind .`

- `rustywind .`

If you want to reorganize all classes in place, and change the files run with the `--write` flag
- `rustywind --write .`

- `rustywind --write .`

Run rustywind with a path and the `--dry-run` to get a list of files that will be changed:
- `rustywind --dry-run .`

For more options run help
- `rustywind --help`
- `rustywind --dry-run .`

## What
Run rustywind on your STDIN:

Inspired by [Ryan Heybourn's](https://github.com/heybourn) [headwind](https://github.com/heybourn/headwind)
vscode plugin. This is a CLI tool that will look through your project and sort all [Tailwind CSS](https://tailwindcss.com) classes.
- `echo "<FILE CONTENTS>" | rustywind --stdin`

It will also delete any duplicate classes it finds.
Run in CI, exit with error if unsorted classes are found:

- `rustywind --check-formatted .`

Run RustyWind with a custom sorter. The `config_file.json` should have a top level entry of `sortOrder`
which is an array with the classes listed in the order you want them sorted.

## Why?
- `rustywind --config-file config_file.json`

When Ryan released his vscode extension some people expressed an interest in having a CLI version.
```shell
RustyWind 0.14.0
Praveen Perera <[email protected]>

In addition, I've had an interest in learning rust. I usually learn by doing. I thought this would be
the perfect opportunity to make a small useful tool while learning rust.
USAGE:
Run rustywind with a path to get a list of files that will be changed
rustywind . --dry-run

Keep in mind this is my first rust project. My code here is most likely going to be ugly and not idiomatic rust.
If you are a rust expert you're help in making the code nicer and more idiomatic will be greatly appreciated.
If you want to reorganize all classes in place, and change the files run with the `--write` flag
rustywind --write .

Any and all feedback and criticism is very welcome. If im doing anything stupid please let me know.
To print only the file names that would be changed run with the `--check-formatted` flag
rustywind --check-formatted .

## The Plan
If you want to run it on your STDIN, you can do:
echo "<FILE CONTENTS>" | rustywind --stdin

### ~~MVP~~
rustywind [FLAGS] <PATH>

1. ~~Run on current directory~~
2. ~~Order all classes in all files in directory (except for gitignored ones)~~
ARGS:
<PATH>... A file or directory to run on

#### ~~Development Plan~~
OPTIONS:
--allow-duplicates
When set, RustyWind will not delete duplicated classes

1. ~~Get a list of all files in current directory recursively.~~ [#1](https://github.com/avencera/rustywind/pull/1)
2. ~~Ignore all files in .gitignore~~ [#1](https://github.com/avencera/rustywind/pull/1)
3. ~~Get all contents from the list of files 1 by 1~~ [#2](https://github.com/avencera/rustywind/pull/2)
4. ~~Run regex on all file contents and get all class names~~ [#3](https://github.com/avencera/rustywind/pull/3)
5. ~~Figure out how to sort class names using sorter array~~ [#4](https://github.com/avencera/rustywind/pull/4)
6. ~~Replace old class names with new list of class names~~ [#5](https://github.com/avencera/rustywind/pull/5)
7. ~~Save file~~ [#6](https://github.com/avencera/rustywind/pull/6)
8. ~~Release via NPM~~ (available via [npm](https://www.npmjs.com/package/rustywind) `npm install rustywind -g`)
- ~~[How to Distribute a Rust Binary on NPM](https://dev.to/kennethlarsen/how-to-distribute-a-rust-binary-on-npm-75n)~~
- ~~[Trust Repo](https://github.com/japaric/trust)~~
- ~~[Example](https://github.com/kennethlarsen/baelte-npm)~~
--check-formatted
Checks if the files are already formatted, exits with 1 if not formatted

### ~~Phase 2 (CLI)~~
--config-file <CONFIG_FILE>
When set, RustyWind will use the config file to derive configurations. The config file
current only supports json with one property sortOrder,e.g. { "sortOrder": ["class1",
...] }

1. ~~Add CLI parser~~ [#8](https://github.com/avencera/rustywind/pull/8)
2. ~~Use CLI parser to choose directory or file to run on~~ [#8](https://github.com/avencera/rustywind/pull/8)
3. ~~Add `--write` option which will change the files, change default to printing results to the terminal~~ [#8](https://github.com/avencera/rustywind/pull/8)
--custom-regex <CUSTOM_REGEX>
Uses a custom regex instead of default one

### ~~Phase 3 (More CLI)~~
1. ~~Add `--allow-duplicates` to allow duplicate class name~~ [#10](https://github.com/avencera/rustywind/pull/10)
2. ~~Add `--dry-run` option to print out all changes to console~~ [c975d1](https://github.com/avencera/rustywind/commit/c975d1f041f95b45e15760ccded24dbf62bf1f6f)
--dry-run
Prints out the new file content with the sorted classes to the terminal

### ~~Phase 4 (Performance)~~
-h, --help
Print help information

1. ~~Search and change files in parallel (parallel map?)~~ [#9](https://github.com/avencera/rustywind/pull/9)
--ignored-files <IGNORED_FILES>
When set, RustyWind will ignore this list of files

### Phase 5 (Match Headwind Features)
1. Add custom sorter via CLI args `--customer-sorter=...`
2. Add custom regex via CLI args `--custom-regex=...`
--stdin
Uses stdin instead of a file or folder

### Later Possibilities...
-V, --version
Print version information

- Add ability to add custom sorter
- Derive sorter from evaluation generated CSS from tailwind config file
- Add ability to exclude folders, or files using regex pattern
- Add argument for only searching in certain file types
--write
Changes the files in place with the reorganized classes

```
## What
Inspired by [Ryan Heybourn's](https://github.com/heybourn) [headwind](https://github.com/heybourn/headwind)
vscode plugin. This is a CLI tool that will look through your project and sort all [Tailwind CSS](https://tailwindcss.com) classes.
It will also delete any duplicate classes it finds.
2 changes: 1 addition & 1 deletion npm/lib/postinstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if (forceInstall) {
console.log("--force, ignoring caches");
}

const VERSION = "v0.14.0";
const VERSION = "v0.15.0";
const BIN_PATH = path.join(__dirname, "../bin");

process.on("unhandledRejection", (reason, promise) => {
Expand Down
4 changes: 2 additions & 2 deletions npm/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion npm/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rustywind",
"version": "0.14.0",
"version": "0.15.0",
"description": "CLI for organizing Tailwind CSS classes",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down

0 comments on commit fad9102

Please sign in to comment.