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
2 changes: 1 addition & 1 deletion .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ runs:
- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 22
node-version: 26
cache: npm

- name: Install dependencies
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/lint-and-check-gen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ jobs:
- name: Lint schema
run: npm run lint:schema

- name: Lint UUIDs
run: npm run lint:uuids

lint-links:
runs-on: ubuntu-latest

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/push-task-list-changes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- uses: ./.github/actions/setup

- name: Generate list
run: npm run gen:list:tedious
run: npm run gen:list:official

- name: Checkout plugin repository
uses: actions/checkout@v6
Expand All @@ -28,7 +28,7 @@ jobs:

- name: Copy task tiers to plugin repository
run: |
cp lists/tedious.json collection-log-master/src/main/resources/com/collectionlogmaster/task-list.json
cp lists/official.json collection-log-master/src/main/resources/com/collectionlogmaster/task-list.json

- name: Create PR
uses: ./.github/actions/create-pr
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"[jsonc]": {
"editor.defaultFormatter": "biomejs.biome"
},
"typescript.tsdk": "node_modules/typescript/lib",
"js/ts.tsdk.path": "node_modules/typescript/lib",
"editor.formatOnSave": true,
"editor.formatOnPaste": true,
"emmet.showExpandedAbbreviation": "never",
Expand Down
19 changes: 0 additions & 19 deletions bin/gen-uuids.mts

This file was deleted.

3 changes: 2 additions & 1 deletion bin/validate-links.mts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import ajv from '@/util/ajv.mjs';
const CACHE_DIR = './.cache/links';
const IMAGE_CONTENT_TYPE_REGEX = /^image\/(png|gif)/;
const HTML_CONTENT_TYPE_REGEX = /^text\/html/;
const HTTP_STATUS_OK = 200;

function cacheKey(link: string): string {
return hash('sha1', link);
Expand All @@ -23,7 +24,7 @@ async function validateLink(link: string, contentTypeRegex: RegExp): Promise<boo
const res = await fetch(link, { method: 'HEAD' });
const contentType = res.headers.get('Content-Type');

if (res.status !== 200 || !contentType?.match(contentTypeRegex)) {
if (res.status !== HTTP_STATUS_OK || !contentType?.match(contentTypeRegex)) {
return false;
}

Expand Down
59 changes: 59 additions & 0 deletions bin/validate-uuids.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import { randomUUID } from 'node:crypto';
import { readFile, writeFile } from 'node:fs/promises';
import { exit } from 'node:process';
import { Glob } from 'glob';
import type { Task, TaskTier } from '@/types.js';
import fmt from '@/util/formatter.mjs';

const flags = process.argv.slice(2);
const shouldGenerate = flags.includes('--generate');

const uuidMap = new Map<string, [string, Task][]>();

const tierWalker = new Glob('./tiers/*.json', {});
for await (const tierFile of tierWalker) {
const tierData: TaskTier = JSON.parse((await readFile(tierFile)).toString());
for (const task of tierData.tasks) {
if (shouldGenerate && (task.id === '' || task.id == null)) {
task.id = randomUUID();
console.log(`Generated UUID ${task.id} for task ${task.name}`);
}

const uuidTasks = uuidMap.getOrInsert(task.id ?? '', []);
uuidTasks.push([tierFile, task]);
}

if (shouldGenerate) {
// biome-ignore lint/style/noNonNullAssertion: trust me bro
await writeFile(tierFile, fmt.Serialize(tierData)!);
}
}

let hasErrors = false;

const emptyIdTasks = uuidMap.get('') ?? [];
if (emptyIdTasks.length > 0) {
hasErrors = true;

console.error('Tasks without an ID found:');
for (const [file, task] of emptyIdTasks) {
console.error(`- ${file}: ${task.name}`);
}
console.error();
}

uuidMap.delete('');
for (const [uuid, tasks] of uuidMap.entries()) {
if (tasks.length <= 1) {
continue;
}

console.error(`Duplicate tasks with ID ${uuid}:`);
for (const [file, task] of tasks) {
console.error(`- ${file}: ${task.name}`);
}
}

if (hasErrors) {
exit(1);
}
15 changes: 11 additions & 4 deletions biome.jsonc
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"$schema": "https://biomejs.dev/schemas/2.0.6/schema.json",
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"extends": ["ultracite"],
"files": {
"includes": [
"**",
// we'll use FracturedJson to format the tasks files
"!tiers/*.json",
"!lists/*.json",
"!ext/**",
"!ext",
"!package-lock.json",
"!types.d.ts"
]
Expand All @@ -28,9 +28,16 @@
"noConsole": "off"
},
"nursery": {
"noUselessUndefined": "off",
"noAwaitInLoop": "off"
"noUselessUndefined": "off"
},
"performance": {
"noAwaitInLoops": "off"
}
}
},
"javascript": {
"formatter": {
"quoteStyle": "single"
}
}
}
Loading
Loading