@lzear/repo-lint 4.0.2 → 4.1.0

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 ADDED
@@ -0,0 +1,83 @@
1
+ # @lzear/repo-lint
2
+
3
+ [![npm](https://img.shields.io/npm/v/@lzear/repo-lint)](https://www.npmjs.com/package/@lzear/repo-lint)
4
+ [![license](https://img.shields.io/npm/l/@lzear/repo-lint)](../../LICENSE)
5
+
6
+ Checks lzear repos against forge standards. Used internally by `forge check`.
7
+
8
+ ## Install
9
+
10
+ ```sh
11
+ npm install -D @lzear/repo-lint
12
+ # or
13
+ yarn add -D @lzear/repo-lint
14
+ ```
15
+
16
+ Requires Node ≥ 20.
17
+
18
+ ## CLI
19
+
20
+ ```sh
21
+ npx repo-lint # check current directory
22
+ ```
23
+
24
+ Most users should use `forge check` via [`@lzear/forge`](https://www.npmjs.com/package/@lzear/forge) instead.
25
+
26
+ ## Programmatic API
27
+
28
+ ```ts
29
+ import { checkLocal, checkRepo, CHECKS } from '@lzear/repo-lint'
30
+
31
+ // Check the current working directory
32
+ const report = await checkLocal()
33
+ console.log(report.results)
34
+ // [
35
+ // { pass: true, desc: 'README.md exists' },
36
+ // { pass: false, desc: 'publint (all published packages)', detail: '...' },
37
+ // ...
38
+ // ]
39
+
40
+ // Check a remote GitHub repo (clones via gh CLI)
41
+ const remote = await checkRepo('lzear/votes', { skipRemote: false })
42
+ ```
43
+
44
+ ### `checkLocal(options?)`
45
+
46
+ | Option | Type | Default | Description |
47
+ |---------------|-----------|---------|-----------------------------------|
48
+ | `skipRemote` | `boolean` | `false` | Skip GitHub secret checks |
49
+
50
+ Returns `Promise<RepoReport>`.
51
+
52
+ ### `RepoReport`
53
+
54
+ ```ts
55
+ interface RepoReport {
56
+ repo: string
57
+ results: { pass: boolean; desc: string; detail?: string }[]
58
+ }
59
+ ```
60
+
61
+ ## Checks performed
62
+
63
+ | Check | Description |
64
+ |--------------------------------|-------------------------------------------------------|
65
+ | `readme-exists` | `README.md` exists |
66
+ | `readme-npm-badge` | README has an npm badge |
67
+ | `readme-codacy-grade-badge` | README has Codacy grade badge |
68
+ | `readme-codacy-coverage-badge` | README has Codacy coverage badge |
69
+ | `editorconfig` | `.editorconfig` exists |
70
+ | `codacy-config` | `.codacy.yml` exists |
71
+ | `license` | `LICENSE` exists |
72
+ | `ci-workflow` | `.github/workflows/ci.yml` exists |
73
+ | `renovate` | `renovate.json` exists |
74
+ | `pkg-publint` | All published packages pass `publint` |
75
+ | `pkg-attw` | All published packages pass `attw` (ESM-only profile) |
76
+ | `pkg-knip` | No unused exports or dependencies (`knip`) |
77
+ | `deps-fresh` | All dependencies up to date (`ncu`) |
78
+ | `secret-npm-token` | GitHub secret `NPM_TOKEN` is set |
79
+ | `secret-codacy-token` | GitHub secret `CODACY_PROJECT_TOKEN` is set |
80
+
81
+ ## Part of forge
82
+
83
+ This package is part of [forge](https://github.com/lzear/forge) — shared dev tooling for lzear repos.
package/dist/bin.js CHANGED
@@ -76,10 +76,8 @@ var eachPublishedPkg = async (dir, fn) => {
76
76
  );
77
77
  const failures = results.filter((r) => !r.pass);
78
78
  if (failures.length === 0) return { pass: true };
79
- return {
80
- pass: false,
81
- detail: failures.flatMap((r) => r.detail ? [r.detail] : []).join("\n") || void 0
82
- };
79
+ const detail = failures.flatMap((r) => r.detail ? [r.detail] : []).join("\n");
80
+ return { pass: false, ...detail && { detail } };
83
81
  }
84
82
  return fn(dir);
85
83
  };
@@ -363,7 +361,7 @@ var main = async () => {
363
361
  \u2500\u2500 ${repo}`);
364
362
  try {
365
363
  const result = await checkRepo(repo, {
366
- token: values.token,
364
+ ...values.token !== void 0 && { token: values.token },
367
365
  baseDir: values.dir,
368
366
  skipRemote: values["skip-remote"]
369
367
  });
package/dist/index.js CHANGED
@@ -69,10 +69,8 @@ var eachPublishedPkg = async (dir, fn) => {
69
69
  );
70
70
  const failures = results.filter((r) => !r.pass);
71
71
  if (failures.length === 0) return { pass: true };
72
- return {
73
- pass: false,
74
- detail: failures.flatMap((r) => r.detail ? [r.detail] : []).join("\n") || void 0
75
- };
72
+ const detail = failures.flatMap((r) => r.detail ? [r.detail] : []).join("\n");
73
+ return { pass: false, ...detail && { detail } };
76
74
  }
77
75
  return fn(dir);
78
76
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lzear/repo-lint",
3
- "version": "4.0.2",
3
+ "version": "4.1.0",
4
4
  "description": "Checks lzear repos against forge standards",
5
5
  "repository": {
6
6
  "type": "git",
@@ -35,7 +35,7 @@
35
35
  "publint": "^0.3"
36
36
  },
37
37
  "devDependencies": {
38
- "@lzear/configs": "4.0.2",
38
+ "@lzear/configs": "4.1.0",
39
39
  "@types/node": "^25",
40
40
  "@vitest/coverage-v8": "^4",
41
41
  "tsup": "^8",