kopytko-formatter 0.1.8 → 0.1.9
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 +29 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,17 +10,39 @@ Use it as a **CLI tool** in CI pipelines, or import it as a **library** in your
|
|
|
10
10
|
npm install --save-dev kopytko-formatter
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
+
## Recommended npm Scripts
|
|
14
|
+
|
|
15
|
+
Add these scripts to your project's `package.json` to run the formatter with the locally installed version — no `npx` needed:
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"scripts": {
|
|
20
|
+
"format": "kopytko-format --write \"src/**/*.brs\"",
|
|
21
|
+
"format:check": "kopytko-format --check \"src/**/*.brs\""
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Then run:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm run format # format files in place
|
|
30
|
+
npm run format:check # CI — exit 1 if any file needs formatting
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
> **Why npm scripts over npx?** `npx` may download a different version than what's installed locally. npm scripts resolve binaries from `node_modules/.bin/`, guaranteeing the exact installed version is used.
|
|
34
|
+
|
|
13
35
|
## CLI Usage
|
|
14
36
|
|
|
15
37
|
```bash
|
|
16
38
|
# Check mode — exit 1 if any file needs formatting (use in CI)
|
|
17
|
-
|
|
39
|
+
kopytko-format --check "src/**/*.brs"
|
|
18
40
|
|
|
19
41
|
# Write mode — format files in place
|
|
20
|
-
|
|
42
|
+
kopytko-format --write "src/**/*.brs"
|
|
21
43
|
|
|
22
44
|
# With explicit config
|
|
23
|
-
|
|
45
|
+
kopytko-format --check --config .kopytkorc "components/**/*.brs"
|
|
24
46
|
```
|
|
25
47
|
|
|
26
48
|
### Options
|
|
@@ -83,7 +105,7 @@ Exclude paths from formatting via the `ignore` array in your config file or the
|
|
|
83
105
|
|
|
84
106
|
```bash
|
|
85
107
|
# CLI flag (repeatable)
|
|
86
|
-
|
|
108
|
+
kopytko-format --check --ignore "**/_tests/**" --ignore "**/dist/**" app
|
|
87
109
|
|
|
88
110
|
# Or in kopytko-formatter.json / .vscode/settings.json
|
|
89
111
|
# "ignore": ["**/_tests/**", "**/dist/**"]
|
|
@@ -137,9 +159,11 @@ jobs:
|
|
|
137
159
|
with:
|
|
138
160
|
node-version: 24
|
|
139
161
|
- run: npm ci
|
|
140
|
-
- run:
|
|
162
|
+
- run: npm run format:check
|
|
141
163
|
```
|
|
142
164
|
|
|
165
|
+
> This assumes `format:check` is defined in your `package.json` scripts (see [Recommended npm Scripts](#recommended-npm-scripts) above).
|
|
166
|
+
|
|
143
167
|
## Planned Features (Not Yet Implemented)
|
|
144
168
|
|
|
145
169
|
The following `FormattingConfig` fields are defined and accepted in config files but
|
package/package.json
CHANGED