Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,15 @@ jobs:
- run: echo "$PWD/target/debug" >> "$GITHUB_PATH" && chmod +x target/debug/mise
- uses: ./.github/actions/mise-tools
- run: mise x -- bun i
- run: mise run render
- name: assert render produces no diff
run: |
if [ -n "$(git status --porcelain)" ]; then
echo "::error::'mise run render' produced changes. Run it locally and commit."
git status
git diff HEAD
exit 1
fi
Comment thread
greptile-apps[bot] marked this conversation as resolved.
- run: rm -rf ~/.cargo/advisory-dbs && cargo deny check
- run: cargo msrv verify
- run: cargo machete --with-metadata
Expand Down
19 changes: 19 additions & 0 deletions xtasks/render/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
//MISE description="Render JSON schema"
//MISE depends=["docs:setup"]

import { spawnSync } from "node:child_process";
import * as fs from "node:fs";
import * as toml from "toml";

Expand Down Expand Up @@ -42,8 +43,24 @@ type NestedElement = {
properties: Record<string, Element>;
};

const writtenPaths: string[] = [];

function writeFormattedJson(path: string, value: unknown) {
fs.writeFileSync(path, `${JSON.stringify(value, null, 2)}\n`);
writtenPaths.push(path);
}

function formatWithPrettier(paths: string[]) {
if (paths.length === 0) return;
const result = spawnSync("prettier", ["--write", ...paths], {
stdio: "inherit",
});
if (result.error) {
throw new Error(`prettier failed to spawn: ${result.error.message}`);
}
if (result.status !== 0) {
throw new Error(`prettier exited with status ${result.status}`);
}
}

function crawlReferencedDefs(schema: JsonObject, root: unknown) {
Expand Down Expand Up @@ -226,3 +243,5 @@ const misercSchema = {
};

writeFormattedJson("schema/miserc.json", misercSchema);

formatWithPrettier(writtenPaths);
Loading