@rielj/nyx 0.0.4 → 0.0.8

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.
Files changed (3) hide show
  1. package/README.md +49 -14
  2. package/package.json +6 -5
  3. package/schema.json +38 -0
package/README.md CHANGED
@@ -10,38 +10,48 @@ Built on top of `@tailwindcss/oxide` and the Tailwind v4 design system.
10
10
  npm install -g @rielj/nyx
11
11
  ```
12
12
 
13
- ## Usage
14
-
15
- ### Check (lint + format)
13
+ ## Quick start
16
14
 
17
15
  ```bash
18
- nyx check src/
19
- nyx check "src/**/*.tsx"
16
+ nyx init # scaffold nyx.config.json
17
+ nyx check src/ # lint + format check
18
+ nyx check --fix src/ # auto-fix
20
19
  ```
21
20
 
22
- ### Lint
21
+ ## Commands
23
22
 
24
- Find non-canonical Tailwind classes (e.g. `tw-bg-red-500` -> `bg-red-500`):
23
+ ### `nyx init`
24
+
25
+ Create a `nyx.config.json` in the current directory with default settings:
25
26
 
26
27
  ```bash
27
- nyx lint src/
28
+ nyx init
28
29
  ```
29
30
 
30
- ### Format
31
+ ### `nyx check`
31
32
 
32
- Sort Tailwind classes in the recommended order:
33
+ Run both lint and format checks:
33
34
 
34
35
  ```bash
35
- nyx format src/
36
+ nyx check src/
37
+ nyx check --fix src/
36
38
  ```
37
39
 
38
- ### Auto-fix
40
+ ### `nyx lint`
39
41
 
40
- Add `--fix` to any command to write changes to disk:
42
+ Find non-canonical Tailwind classes (e.g. `tw-bg-red-500` -> `bg-red-500`):
41
43
 
42
44
  ```bash
43
- nyx check --fix src/
45
+ nyx lint src/
44
46
  nyx lint --fix src/
47
+ ```
48
+
49
+ ### `nyx format`
50
+
51
+ Sort Tailwind classes in the recommended order:
52
+
53
+ ```bash
54
+ nyx format src/
45
55
  nyx format --fix src/
46
56
  ```
47
57
 
@@ -54,8 +64,33 @@ nyx format --fix src/
54
64
  | `--strategy <name>` | Sort strategy: `tailwind` (default) or `alphabetical` |
55
65
  | `--rem <px>` | Root font size in px (default: 16) |
56
66
  | `--collapse` | Collapse e.g. `mt-2 mr-2 mb-2 ml-2` into `m-2` |
67
+ | `--cache` | Enable file-level caching to skip unchanged files |
57
68
  | `--json` | Output diagnostics as JSON |
58
69
  | `--quiet` | Only show summary |
70
+ | `--verbose` | Show full diagnostics in fix mode |
71
+
72
+ ## Config file
73
+
74
+ Create a `nyx.config.json` in your project root (or run `nyx init`):
75
+
76
+ ```json
77
+ {
78
+ "$schema": "./node_modules/@rielj/nyx/schema.json",
79
+ "rem": 16,
80
+ "collapse": false,
81
+ "strategy": "tailwind"
82
+ }
83
+ ```
84
+
85
+ | Option | Type | Default | Description |
86
+ |---|---|---|---|
87
+ | `css` | `string` | auto-detect | Path to CSS entry point |
88
+ | `rem` | `number` | `16` | Root font size in px |
89
+ | `collapse` | `boolean` | `false` | Collapse longhand utilities into shorthand |
90
+ | `strategy` | `"tailwind" \| "alphabetical"` | `"tailwind"` | Class sort strategy |
91
+ | `cache` | `boolean` | auto | Enable file-level caching (on by default when nyx is locally installed) |
92
+
93
+ CLI flags override config file values.
59
94
 
60
95
  ## Supported file types
61
96
 
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "email": "bulaybulay.rielj@gmail.com",
10
10
  "url": "https://rielj.xyz"
11
11
  },
12
- "version": "0.0.4",
12
+ "version": "0.0.8",
13
13
  "description": "Tailwind CSS canonical class fixer CLI",
14
14
  "type": "module",
15
15
  "bin": {
@@ -25,13 +25,14 @@
25
25
  },
26
26
  "files": [
27
27
  "dist",
28
- "README.md"
28
+ "README.md",
29
+ "schema.json"
29
30
  ],
30
31
  "scripts": {
31
32
  "build": "tsup",
32
33
  "dev": "tsup --watch",
33
- "test": "vitest run",
34
- "test:watch": "vitest",
34
+ "test": "bun test",
35
+ "test:watch": "bun test --watch",
35
36
  "typecheck": "tsc --noEmit",
36
37
  "check": "biome check --fix"
37
38
  },
@@ -47,7 +48,7 @@
47
48
  "@types/node": "^25.2.3",
48
49
  "tsup": "^8.4.0",
49
50
  "typescript": "^5.7.0",
50
- "vitest": "^3.0.0"
51
+ "@types/bun": "^1.2.0"
51
52
  },
52
53
  "engines": {
53
54
  "node": ">=20"
package/schema.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "title": "Nyx Configuration",
4
+ "description": "Configuration file for @rielj/nyx — Tailwind CSS class formatter and linter",
5
+ "type": "object",
6
+ "properties": {
7
+ "$schema": {
8
+ "type": "string",
9
+ "description": "Path or URL to the nyx JSON Schema"
10
+ },
11
+ "css": {
12
+ "type": "string",
13
+ "description": "Path to the CSS entry point. If omitted, nyx auto-detects the Tailwind CSS entry point."
14
+ },
15
+ "rem": {
16
+ "type": "number",
17
+ "description": "Root font size in px used for canonical class resolution.",
18
+ "default": 16
19
+ },
20
+ "collapse": {
21
+ "type": "boolean",
22
+ "description": "Collapse longhand utilities (e.g. mt-2 mr-2 mb-2 ml-2) into shorthand (m-2).",
23
+ "default": false
24
+ },
25
+ "strategy": {
26
+ "type": "string",
27
+ "enum": ["tailwind", "alphabetical"],
28
+ "description": "Sort strategy for class ordering.",
29
+ "default": "tailwind"
30
+ },
31
+ "cache": {
32
+ "type": "boolean",
33
+ "description": "Enable file-level caching to skip unchanged files on subsequent runs.",
34
+ "default": false
35
+ }
36
+ },
37
+ "additionalProperties": false
38
+ }