Skip to content

Commit 44304c2

Browse files
committed
notes about yml support and debugging
1 parent 6c3e24a commit 44304c2

File tree

5 files changed

+41
-10
lines changed

5 files changed

+41
-10
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,13 @@ Expect more docs soon...
3030

3131
1. [Getting started](getting-started.md)
3232
1. [How does it work?](how-does-it-work.md)
33-
1. [Configuration — codechecks.json/ts/js](configuration.md)
33+
1. [Configuration — codechecks.yml/json/ts/js](configuration.md)
3434
1. [Checks (plugins) development](developing-checks.md)
3535
1. Developing reusable checks
3636
1. Testing checks
3737
1. [How to build X?](how-to-build-X.md)
3838
1. [Client API reference](client-api.md)
3939
1. [Localmode](localmode.md)
40+
1. [Debugging](debugging.md)
4041
1. [FAQ](faq.md)
4142
1. [Roadmap](roadmap.md)

client-api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export class Client {
1616
report(report: CodeChecksReport): Promise<void>;
1717
success(report: CodeChecksReportBody): Promise<void>;
1818
failure(report: CodeChecksReportBody): Promise<void>;
19-
19+
2020
isPr(): boolean;
2121

2222
getArtifactLink(path: string): string;

configuration.md

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,30 @@
11
# Configuration
22

3-
JS Client by default will try to find codechecks.json, codechecks.js and codechecks.ts files and
4-
execute all that exist. In near future we might support yml as well.
3+
Client by default will try to find `codechecks.yml`, `codechecks.json`, `codechecks.js` and
4+
`codechecks.ts` files and execute all that exist.
5+
6+
To specify custom file just use `codechecks [FILES]`. Specifying multiple files can be useful
7+
because you should favour declarative configs (yml/json) but sometimes you still have custom rules
8+
that you need to define in `js` or `ts` files.
9+
10+
## codechecks.yml
11+
12+
<!-- prettier-ignore -->
13+
```yml
14+
checks:
15+
- name: build-size-watcher
16+
options:
17+
gzip: false
18+
files:
19+
- path: "./dist/**/*.d.ts"
20+
- path: "./dist/**/*.js"
21+
```
22+
23+
This is a preferable way of defining checks (plugins). It's fully declarative and using yml make it
24+
very readable. It works only with external checks ie. checks that part of your package.json.
25+
26+
Resolution engine for check's names will first try to find: `@codechecks/NAME` and then NAME in node
27+
modules and pass options.
528

629
## codechecks.json
730

@@ -21,15 +44,10 @@ execute all that exist. In near future we might support yml as well.
2144
}
2245
```
2346

24-
This is a preferable way of executing external checks (plugins). It's fully declarative. It will
25-
first try to find: `@codechecks/NAME` and then NAME in node modules and pass options.
47+
It's the same as YML config but written in JSON.
2648

2749
## codechecks.ts/js
2850

2951
If you want to execute arbitrary logic this is the way to go. The only thing you need to do is
3052
export async function from your module. We support es6 named export `main`, default export and
3153
commonjs export.
32-
33-
To specify custom file just use codechecks [FILES] Specifying multiple files makes sense because you
34-
should favour JSON configs but sometimes you still have custom rules that you need to define in `js`
35-
or `ts`.

debugging.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Debugging
2+
3+
We use `debug` package to provide verbose logs. Run codechecks CLI using:
4+
5+
```sh
6+
DEBUG=codechecks:* codechecks
7+
```

developing-checks.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,8 @@ this project are part of `/example` dir.
113113

114114
You can find more complicated example here:
115115
https://github.com/codechecks/build-size-watcher/tree/master/src/__tests__
116+
117+
## Debugging
118+
119+
For compatibility with codechecks client, to provide debug logs use `debug` package with
120+
`codechecks:YOUR_CHECK_NAME` namespace.

0 commit comments

Comments
 (0)