@rtorcato/repo-tooling 3.7.3 → 3.7.4
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 +14 -0
- package/dist/cli/generators/linting.js +42 -1
- package/package.json +1 -1
- package/tooling/biome/biome.json +1 -1
package/README.md
CHANGED
|
@@ -53,6 +53,20 @@ npx @rtorcato/repo-tooling copy oxlint # → .oxlintrc.json
|
|
|
53
53
|
npx @rtorcato/repo-tooling copy claude-skill # → .claude/skills/repo-tooling.md
|
|
54
54
|
```
|
|
55
55
|
|
|
56
|
+
The Biome preset honours your `.gitignore`, so build output stays unlinted. One
|
|
57
|
+
known gap: Biome cannot parse Tailwind CSS v4 stylesheets (`@theme`, `@source`,
|
|
58
|
+
`@custom-variant`, `@apply`) and reports a parse error on them. If you use
|
|
59
|
+
Tailwind v4, exclude your stylesheet in `biome.json`:
|
|
60
|
+
|
|
61
|
+
```jsonc
|
|
62
|
+
{
|
|
63
|
+
"extends": ["@rtorcato/repo-tooling/biome"],
|
|
64
|
+
// `includes` replaces the preset's list rather than extending it — restate
|
|
65
|
+
// the exclusions you still want alongside the CSS one.
|
|
66
|
+
"files": { "includes": ["**", "!**/node_modules", "!**/dist", "!**/*.css"] }
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
56
70
|
**Already have a project?** Don't rerun `setup` — use `doctor` + `fix`:
|
|
57
71
|
|
|
58
72
|
```bash
|
|
@@ -34,6 +34,46 @@ export const BIOME_CONFIG = 'biome.json';
|
|
|
34
34
|
* BIOME_CONFIG and delete this on the way past, so the ambiguity can't persist.
|
|
35
35
|
*/
|
|
36
36
|
export const BIOME_LEGACY_CONFIG = 'biome.jsonc';
|
|
37
|
+
/**
|
|
38
|
+
* Used when nothing in the target repo says which Biome will read the config —
|
|
39
|
+
* a bare directory mid-`setup`, before `pnpm install` has run. Matches the
|
|
40
|
+
* `$schema` the shipped preset carries.
|
|
41
|
+
*/
|
|
42
|
+
const BIOME_SCHEMA_FALLBACK = '2.5.0';
|
|
43
|
+
async function readJsonOrNull(filepath) {
|
|
44
|
+
try {
|
|
45
|
+
return (await fs.readJson(filepath));
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* The Biome version the scaffolded `$schema` URL should name (#363).
|
|
53
|
+
*
|
|
54
|
+
* A hardcoded version drifts the moment the consumer's Biome moves, and Biome
|
|
55
|
+
* reports the mismatch on *every* invocation ("The configuration schema version
|
|
56
|
+
* does not match the CLI version 2.5.7") — noise on a file the consumer never
|
|
57
|
+
* wrote. The installed package wins because it is literally the binary that
|
|
58
|
+
* will parse the file and emit that warning; the declared range is the next
|
|
59
|
+
* best statement of intent when node_modules isn't populated yet.
|
|
60
|
+
*/
|
|
61
|
+
export async function resolveBiomeSchemaVersion(targetDir) {
|
|
62
|
+
const installed = await readJsonOrNull(path.join(targetDir, 'node_modules', '@biomejs', 'biome', 'package.json'));
|
|
63
|
+
const pkg = await readJsonOrNull(path.join(targetDir, 'package.json'));
|
|
64
|
+
const deps = {
|
|
65
|
+
...(pkg?.dependencies ?? {}),
|
|
66
|
+
...(pkg?.devDependencies ?? {}),
|
|
67
|
+
};
|
|
68
|
+
// Both an exact version ("2.5.7") and a range ("^2.5.0") carry the x.y.z we
|
|
69
|
+
// need, so one pattern covers every source.
|
|
70
|
+
for (const candidate of [installed?.version, deps['@biomejs/biome']]) {
|
|
71
|
+
const match = typeof candidate === 'string' ? /(\d+\.\d+\.\d+)/.exec(candidate) : null;
|
|
72
|
+
if (match?.[1])
|
|
73
|
+
return match[1];
|
|
74
|
+
}
|
|
75
|
+
return BIOME_SCHEMA_FALLBACK;
|
|
76
|
+
}
|
|
37
77
|
/**
|
|
38
78
|
* The thin pointer config — the same shape this repo dogfoods. `fix biome` used
|
|
39
79
|
* to copy the whole preset inline instead, which meant the scaffolded file
|
|
@@ -45,8 +85,9 @@ export async function generateBiomeConfig(targetDir) {
|
|
|
45
85
|
// file globs via `files.includes`; emitting the old 1.x `include`/`ignore`
|
|
46
86
|
// keys here forced consumers to run `biome migrate` before `biome check`
|
|
47
87
|
// would run at all.
|
|
88
|
+
const version = await resolveBiomeSchemaVersion(targetDir);
|
|
48
89
|
const biomeConfig = {
|
|
49
|
-
$schema:
|
|
90
|
+
$schema: `https://biomejs.dev/schemas/${version}/schema.json`,
|
|
50
91
|
extends: ['@rtorcato/repo-tooling/biome'],
|
|
51
92
|
};
|
|
52
93
|
await fs.writeJson(path.join(targetDir, BIOME_CONFIG), biomeConfig, { spaces: 2 });
|
package/package.json
CHANGED