Skip to content

Commit

Permalink
Tweak check-icons to use local zotero-schema
Browse files Browse the repository at this point in the history
Now that it is included in the build, there is no reason to fetch it from the API.
  • Loading branch information
tnajdek committed Feb 3, 2025
1 parent 3758d42 commit 091b7fa
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions scripts/check-icons.js
Original file line number Diff line number Diff line change
@@ -1,27 +1,19 @@
import { dirname, join } from 'path';
import { fileURLToPath } from 'url';
import fs from 'fs-extra';
import apiLib from 'zotero-api-client'; //TODO improt api from 'zotero-api-client' should work

const api = apiLib.default;

const __dirname = dirname(fileURLToPath(import.meta.url));
const ROOT = join(__dirname, '..');
const schemaPath = join(ROOT, 'modules', 'zotero-schema', 'schema.json');
const targetJSONPath = join(ROOT, 'data', 'item-types-with-icons.json');

const ignoredItemTypes = ['annotation', 'attachment'];

const iconsPaths = {
desktop: join(ROOT, 'src', 'static', 'icons', '16', 'item-type'),
mobile: join(ROOT, 'src', 'static', 'icons', '28', 'item-type'),
};

const knownItemTypes = await api().schema().get()
.then(response => response
.getData()
.itemTypes
.map(({ itemType }) => itemType)
);
const knownItemTypes = (await fs.readJson(schemaPath)).itemTypes.map(({ itemType }) => itemType);

for(let [iconTypeName, iconDir] of Object.entries(iconsPaths)) {
const foundItemTypes = (await fs.readdir(iconDir, { withFileTypes: true }))
Expand Down

0 comments on commit 091b7fa

Please sign in to comment.