Skip to content

Commit 5c9ce17

Browse files
committed
fix: stop gen-schemas-md and prettier fighting each other
1 parent fc5de1d commit 5c9ce17

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,8 @@ jobs:
2626
run: |
2727
sed -i 's|// skip|throw e;|g' node_modules/@atproto/lex-cli/dist/util.js
2828
29+
- name: Generate SCHEMAS.md
30+
run: npm run gen-schemas-md
31+
2932
- name: Run checks
3033
run: npm run check

.husky/pre-commit

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
npm run gen-schemas-md
2+
npm run format
13
npm run check

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
},
4040
"scripts": {
4141
"list": "find ./lexicons -name '*.json'",
42-
"check": "npm run gen-schemas-md && npm run gen-api && npm run lint && npm run typecheck && npm run build && npm run test",
42+
"check": "npm run gen-api && npm run lint && npm run typecheck && npm run build && npm run test",
4343
"build": "rollup -c && npm run build:types",
4444
"build:types": "tsc --project tsconfig.build.json",
4545
"gen-api": "find ./lexicons -name '*.json' | xargs lex gen-api --yes ./generated && ./scripts/create-shims.sh && npm run gen-index",

scripts/generate-schemas.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,11 +273,16 @@ function generateLexiconSection(lexicon, isFirst = false) {
273273

274274
if (additionalDefs.length > 0) {
275275
output.push("", "#### Defs", "");
276-
for (const [defName, defData] of additionalDefs) {
276+
for (let i = 0; i < additionalDefs.length; i++) {
277+
const [defName, defData] = additionalDefs[i];
277278
output.push(`##### ${defName}`, "");
278279
const defRows = extractPropertyRows(defData, defData.required || []);
279280
if (defRows.length > 0) {
280281
output.push(...renderTable(defRows, false));
282+
// Add blank line after table only if not the last def
283+
if (i < additionalDefs.length - 1) {
284+
output.push("");
285+
}
281286
}
282287
}
283288
}

0 commit comments

Comments
 (0)