@browsercore/dev 0.2.2 → 0.2.3
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 +21 -3
- package/package.json +4 -2
- package/tsconfig.test.base.json +23 -0
package/README.md
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# @browsercore/dev
|
|
2
2
|
|
|
3
|
-
[](https://github.
|
|
3
|
+
[](https://www.npmjs.com/package/@browsercore/dev)
|
|
4
|
+
[](https://jverneuer.github.io/browsercore-dev/COVERAGE.md)
|
|
5
|
+
[](https://github.com/jverneuer/browsercore-dev/actions/workflows/build.yml)
|
|
5
6
|
[](LICENSE)
|
|
6
7
|
|
|
7
8
|
Shared build, lint, test, and coverage tooling for every `@browsercore/*` package. One published package is the single source of truth; consumers extend it live via npm.
|
|
@@ -27,6 +28,18 @@ npm install -D @browsercore/dev
|
|
|
27
28
|
|
|
28
29
|
For builds that emit declarations, extend `@browsercore/dev/tsconfig.build.base.json` instead (layers `declaration`, `declarationMap`, `sourceMap` on top of the base).
|
|
29
30
|
|
|
31
|
+
To genuinely typecheck tests (vitest only transpiles them), add a `tsconfig.test.json` extending `@browsercore/dev/tsconfig.test.base.json` and wire it as the second half of `npm run typecheck`:
|
|
32
|
+
|
|
33
|
+
```json
|
|
34
|
+
{ "extends": "@browsercore/dev/tsconfig.test.base.json" }
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
```json
|
|
38
|
+
"typecheck": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.test.json --noEmit"
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
The base includes `src/**/*.ts` + `tests/**/*.ts` under `noEmit` and **overrides `exclude`**. The repo tsconfig's `exclude: [..., "tests"]` (correct for builds) would otherwise nullify the test `include`, and the gate would silently typecheck zero test files.
|
|
42
|
+
|
|
30
43
|
### vitest
|
|
31
44
|
|
|
32
45
|
```ts
|
|
@@ -65,7 +78,7 @@ The bin reads `coverage/coverage-summary.json` (written by the `json-summary` re
|
|
|
65
78
|
|
|
66
79
|
| Command | Runs |
|
|
67
80
|
| --- | --- |
|
|
68
|
-
| `npm run typecheck` | `tsc -p tsconfig.json --noEmit` |
|
|
81
|
+
| `npm run typecheck` | `tsc -p tsconfig.json --noEmit && tsc -p tsconfig.test.json --noEmit` |
|
|
69
82
|
| `npm run lint` | `oxlint --type-aware src/` |
|
|
70
83
|
| `npm test` | `vitest run` |
|
|
71
84
|
| `npm run build` | `tsc -p tsconfig.build.json` |
|
|
@@ -81,6 +94,11 @@ node scripts/coverage-md.mjs # writes COVERAGE.md + coverage/badge.json
|
|
|
81
94
|
|
|
82
95
|
Provider is `@vitest/coverage-v8`. The report is generated from `coverage/coverage-summary.json`.
|
|
83
96
|
|
|
97
|
+
|
|
98
|
+
## Contributing
|
|
99
|
+
|
|
100
|
+
Contributions are welcome: bug reports, reproductions, docs and code alike. Start with [CONTRIBUTING.md](CONTRIBUTING.md); the full guide lives in the [browsersmith repo](https://github.com/jverneuer/browsersmith/blob/main/CONTRIBUTING.md). First timer? Check the [`good first issue`](https://github.com/jverneuer/browsercore-dev/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22) label. Security issues: [SECURITY.md](SECURITY.md), never a public issue.
|
|
101
|
+
|
|
84
102
|
## License
|
|
85
103
|
|
|
86
104
|
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@browsercore/dev",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Shared build, lint, test, and coverage tooling for the @browsercore/* packages.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
},
|
|
31
31
|
"./tsconfig.base.json": "./tsconfig.base.json",
|
|
32
32
|
"./tsconfig.build.base.json": "./tsconfig.build.base.json",
|
|
33
|
+
"./tsconfig.test.base.json": "./tsconfig.test.base.json",
|
|
33
34
|
"./CODING_STANDARDS.md": "./CODING_STANDARDS.md"
|
|
34
35
|
},
|
|
35
36
|
"bin": {
|
|
@@ -40,6 +41,7 @@
|
|
|
40
41
|
"bin",
|
|
41
42
|
"tsconfig.base.json",
|
|
42
43
|
"tsconfig.build.base.json",
|
|
44
|
+
"tsconfig.test.base.json",
|
|
43
45
|
"CODING_STANDARDS.md",
|
|
44
46
|
"LICENSE"
|
|
45
47
|
],
|
|
@@ -48,7 +50,7 @@
|
|
|
48
50
|
},
|
|
49
51
|
"scripts": {
|
|
50
52
|
"build": "tsc -p tsconfig.build.json",
|
|
51
|
-
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
53
|
+
"typecheck": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.test.json --noEmit",
|
|
52
54
|
"test": "vitest run",
|
|
53
55
|
"lint": "oxlint --type-aware src/",
|
|
54
56
|
"clean": "rm -rf dist coverage",
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
// Shared TEST typecheck base for every @browsercore/* package — the second
|
|
3
|
+
// half of the dual typecheck gate: `tsc -p tsconfig.test.json --noEmit`.
|
|
4
|
+
//
|
|
5
|
+
// A consumer's tsconfig.test.json is a one-liner:
|
|
6
|
+
// { "extends": "@browsercore/dev/tsconfig.test.base.json" }
|
|
7
|
+
//
|
|
8
|
+
// `exclude` is DECLARED here on purpose instead of being inherited from the
|
|
9
|
+
// repo tsconfig: family tsconfigs exclude "tests" (so `npm run build` never
|
|
10
|
+
// compiles test files). If a test config extends the repo tsconfig without
|
|
11
|
+
// overriding exclude, its `include` of tests/** matches nothing and the
|
|
12
|
+
// gate silently typechecks zero test files.
|
|
13
|
+
"extends": "./tsconfig.base.json",
|
|
14
|
+
"compilerOptions": {
|
|
15
|
+
"noEmit": true,
|
|
16
|
+
"declaration": false,
|
|
17
|
+
"declarationMap": false,
|
|
18
|
+
"sourceMap": false,
|
|
19
|
+
"rootDir": "."
|
|
20
|
+
},
|
|
21
|
+
"include": ["src/**/*.ts", "tests/**/*.ts"],
|
|
22
|
+
"exclude": ["node_modules", "dist"]
|
|
23
|
+
}
|