rustywind 0.13.0 → 0.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.MD CHANGED
@@ -1,5 +1,4 @@
1
- # 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)
2
-
1
+ # 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)
3
2
 
4
3
  ## Install
5
4
 
@@ -11,91 +10,109 @@ or
11
10
 
12
11
  `npm install -g rustywind`
13
12
 
14
- or
13
+ or
15
14
 
16
15
  Install from a github release:
17
16
 
18
17
  `curl -LSfs https://avencera.github.io/rustywind/install.sh | sh -s -- --git avencera/rustywind`
19
18
 
20
- or
19
+ or
21
20
 
22
21
  Download a release directly from github: [github.com/avencera/rustywind/releases](https://github.com/avencera/rustywind/releases)
23
22
 
23
+ or
24
+
25
+ You can use the dockerized version
26
+
27
+ `docker run --rm -v $PWD:/app avencera/rustywind:latest <rustywind arguments>`
28
+
24
29
  ## Usage
25
30
 
26
31
  Run rustywind with a path to output updated file contents to the terminal:
27
- - `rustywind .`
32
+
33
+ - `rustywind .`
28
34
 
29
35
  If you want to reorganize all classes in place, and change the files run with the `--write` flag
30
- - `rustywind --write .`
36
+
37
+ - `rustywind --write .`
31
38
 
32
39
  Run rustywind with a path and the `--dry-run` to get a list of files that will be changed:
33
- - `rustywind --dry-run .`
34
40
 
35
- For more options run help
36
- - `rustywind --help`
41
+ - `rustywind --dry-run .`
37
42
 
38
- ## What
43
+ Run rustywind on your STDIN:
39
44
 
40
- Inspired by [Ryan Heybourn's](https://github.com/heybourn) [headwind](https://github.com/heybourn/headwind)
41
- vscode plugin. This is a CLI tool that will look through your project and sort all [Tailwind CSS](https://tailwindcss.com) classes.
45
+ - `echo "<FILE CONTENTS>" | rustywind --stdin`
42
46
 
43
- It will also delete any duplicate classes it finds.
47
+ Run in CI, exit with error if unsorted classes are found:
48
+
49
+ - `rustywind --check-formatted .`
50
+
51
+ Run RustyWind with a custom sorter. The `config_file.json` should have a top level entry of `sortOrder`
52
+ which is an array with the classes listed in the order you want them sorted.
44
53
 
45
- ## Why?
54
+ - `rustywind --config-file config_file.json`
46
55
 
47
- When Ryan released his vscode extension some people expressed an interest in having a CLI version.
56
+ ```shell
57
+ RustyWind 0.14.0
58
+ Praveen Perera <praveen@avencera.com>
48
59
 
49
- In addition, I've had an interest in learning rust. I usually learn by doing. I thought this would be
50
- the perfect opportunity to make a small useful tool while learning rust.
60
+ USAGE:
61
+ Run rustywind with a path to get a list of files that will be changed
62
+ rustywind . --dry-run
51
63
 
52
- Keep in mind this is my first rust project. My code here is most likely going to be ugly and not idiomatic rust.
53
- If you are a rust expert you're help in making the code nicer and more idiomatic will be greatly appreciated.
64
+ If you want to reorganize all classes in place, and change the files run with the `--write` flag
65
+ rustywind --write .
54
66
 
55
- Any and all feedback and criticism is very welcome. If im doing anything stupid please let me know.
67
+ To print only the file names that would be changed run with the `--check-formatted` flag
68
+ rustywind --check-formatted .
56
69
 
57
- ## The Plan
70
+ If you want to run it on your STDIN, you can do:
71
+ echo "<FILE CONTENTS>" | rustywind --stdin
58
72
 
59
- ### ✅ ~~MVP~~
73
+ rustywind [FLAGS] <PATH>
60
74
 
61
- 1. ~~Run on current directory~~
62
- 2. ~~Order all classes in all files in directory (except for gitignored ones)~~
75
+ ARGS:
76
+ <PATH>... A file or directory to run on
63
77
 
64
- #### ✅ ~~Development Plan~~
78
+ OPTIONS:
79
+ --allow-duplicates
80
+ When set, RustyWind will not delete duplicated classes
65
81
 
66
- 1. ~~Get a list of all files in current directory recursively.~~ [#1](https://github.com/avencera/rustywind/pull/1)
67
- 2. ~~Ignore all files in .gitignore~~ [#1](https://github.com/avencera/rustywind/pull/1)
68
- 3. ~~Get all contents from the list of files 1 by 1~~ [#2](https://github.com/avencera/rustywind/pull/2)
69
- 4. ~~Run regex on all file contents and get all class names~~ [#3](https://github.com/avencera/rustywind/pull/3)
70
- 5. ~~Figure out how to sort class names using sorter array~~ [#4](https://github.com/avencera/rustywind/pull/4)
71
- 6. ~~Replace old class names with new list of class names~~ [#5](https://github.com/avencera/rustywind/pull/5)
72
- 7. ~~Save file~~ [#6](https://github.com/avencera/rustywind/pull/6)
73
- 8. ~~Release via NPM~~ (available via [npm](https://www.npmjs.com/package/rustywind) `npm install rustywind -g`)
74
- - ~~[How to Distribute a Rust Binary on NPM](https://dev.to/kennethlarsen/how-to-distribute-a-rust-binary-on-npm-75n)~~
75
- - ~~[Trust Repo](https://github.com/japaric/trust)~~
76
- - ~~[Example](https://github.com/kennethlarsen/baelte-npm)~~
82
+ --check-formatted
83
+ Checks if the files are already formatted, exits with 1 if not formatted
77
84
 
78
- ### ✅ ~~Phase 2 (CLI)~~
85
+ --config-file <CONFIG_FILE>
86
+ When set, RustyWind will use the config file to derive configurations. The config file
87
+ current only supports json with one property sortOrder,e.g. { "sortOrder": ["class1",
88
+ ...] }
79
89
 
80
- 1. ~~Add CLI parser~~ [#8](https://github.com/avencera/rustywind/pull/8)
81
- 2. ~~Use CLI parser to choose directory or file to run on~~ [#8](https://github.com/avencera/rustywind/pull/8)
82
- 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)
90
+ --custom-regex <CUSTOM_REGEX>
91
+ Uses a custom regex instead of default one
83
92
 
84
- ### ✅ ~~Phase 3 (More CLI)~~
85
- 1. ~~Add `--allow-duplicates` to allow duplicate class name~~ [#10](https://github.com/avencera/rustywind/pull/10)
86
- 2. ~~Add `--dry-run` option to print out all changes to console~~ [c975d1](https://github.com/avencera/rustywind/commit/c975d1f041f95b45e15760ccded24dbf62bf1f6f)
93
+ --dry-run
94
+ Prints out the new file content with the sorted classes to the terminal
87
95
 
88
- ### ✅~~Phase 4 (Performance)~~
96
+ -h, --help
97
+ Print help information
89
98
 
90
- 1. ~~Search and change files in parallel (parallel map?)~~ [#9](https://github.com/avencera/rustywind/pull/9)
99
+ --ignored-files <IGNORED_FILES>
100
+ When set, RustyWind will ignore this list of files
91
101
 
92
- ### Phase 5 (Match Headwind Features)
93
- 1. Add custom sorter via CLI args `--customer-sorter=...`
94
- 2. Add custom regex via CLI args `--custom-regex=...`
102
+ --stdin
103
+ Uses stdin instead of a file or folder
95
104
 
96
- ### Later Possibilities...
105
+ -V, --version
106
+ Print version information
97
107
 
98
- - Add ability to add custom sorter
99
- - Derive sorter from evaluation generated CSS from tailwind config file
100
- - Add ability to exclude folders, or files using regex pattern
101
- - Add argument for only searching in certain file types
108
+ --write
109
+ Changes the files in place with the reorganized classes
110
+
111
+ ```
112
+
113
+ ## What
114
+
115
+ Inspired by [Ryan Heybourn's](https://github.com/heybourn) [headwind](https://github.com/heybourn/headwind)
116
+ vscode plugin. This is a CLI tool that will look through your project and sort all [Tailwind CSS](https://tailwindcss.com) classes.
117
+
118
+ It will also delete any duplicate classes it finds.
@@ -16,7 +16,7 @@ if (forceInstall) {
16
16
  console.log("--force, ignoring caches");
17
17
  }
18
18
 
19
- const VERSION = "v0.13.0";
19
+ const VERSION = "v0.15.1";
20
20
  const BIN_PATH = path.join(__dirname, "../bin");
21
21
 
22
22
  process.on("unhandledRejection", (reason, promise) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rustywind",
3
- "version": "0.13.0",
3
+ "version": "0.15.1",
4
4
  "description": "CLI for organizing Tailwind CSS classes",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",