Skip to content

Commit

Permalink
fix: fix JSONC parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
trollixx committed May 18, 2024
1 parent 6a1aa3e commit 702b153
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
uses: oven-sh/setup-bun@v1

- name: Build
run: bun run build
run: bun install && bun run build

- name: Deploy
uses: peaceiris/actions-gh-pages@v4
Expand Down
5 changes: 4 additions & 1 deletion build.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Script to minimize rules JSON for publishing.
// Docs: https://docs.clearurls.xyz/1.26.1/specs/rules/#dataminjson-catalog

import JSON5 from "json5";

type Provider = {
urlPattern: string;
completeProvider?: boolean;
Expand All @@ -15,7 +17,8 @@ type Provider = {
const rule_file = "rules.jsonc";
const minimized_file = "build/rules.min.json";

const json = await Bun.file(rule_file).json();
const blob = await Bun.file(rule_file).text();
const json = JSON5.parse(blob);
console.log("Loaded", Object.keys(json.providers).length, "rules.");

const providers: { [key: string]: object } = {};
Expand Down
Binary file modified bun.lockb
Binary file not shown.
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,8 @@
},
"bin": {
"biome": "@biomejs/biome"
},
"dependencies": {
"json5": "^2.2.3"
}
}

0 comments on commit 702b153

Please sign in to comment.