Fix tag icon generator
This commit is contained in:
parent
c83d694c7a
commit
d8d55f032e
@ -8,8 +8,6 @@
|
||||
"package": "svelte-kit package",
|
||||
"preview": "svelte-kit preview",
|
||||
"prepare": "svelte-kit sync",
|
||||
"generate": "node scripts/generate.cjs",
|
||||
"generate:watch": "nodemon --watch app --watch libs app/server.js",
|
||||
"check": "svelte-check --tsconfig ./tsconfig.json",
|
||||
"check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
|
||||
"lint": "prettier --ignore-path .gitignore --check --plugin-search-dir=. . && eslint --ignore-path .gitignore .",
|
||||
|
||||
@ -4,10 +4,10 @@ import { projectColors } from './outputs/projectColors.js';
|
||||
import { gameVersions } from './outputs/gameVersions.js';
|
||||
import { tags } from './outputs/tags.js';
|
||||
|
||||
const API_URL = 'https://api.modrinth.com/v2/'; //TODO Remove
|
||||
process.env.VITE_API_URL || process.env?.NODE_ENV === 'development'
|
||||
? 'https://staging-api.modrinth.com/v2/'
|
||||
: 'https://api.modrinth.com/v2/';
|
||||
const API_URL =
|
||||
process.env.VITE_API_URL || process.env?.NODE_ENV === 'development'
|
||||
? 'https://staging-api.modrinth.com/v2/'
|
||||
: 'https://api.modrinth.com/v2/';
|
||||
|
||||
// Time to live: 7 days
|
||||
const TTL = 7 * 24 * 60 * 60 * 1000;
|
||||
@ -33,6 +33,7 @@ export default function Generator(options) {
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Don't generate if the last generation was less than TTL and the options are the same
|
||||
if (
|
||||
state?.lastGenerated &&
|
||||
|
||||
@ -19,11 +19,6 @@ export async function tags(API_URL) {
|
||||
]);
|
||||
progressBar.update(4);
|
||||
|
||||
// Delete icons from original arrays
|
||||
categories = categories.map(({ icon, ...rest }) => rest);
|
||||
loaders = loaders.map(({ icon, ...rest }) => rest);
|
||||
progressBar.increment();
|
||||
|
||||
// Create single object with icons
|
||||
const tagIcons = {
|
||||
...categories.reduce((a, v) => ({ ...a, [v.name]: v.icon }), {}),
|
||||
@ -31,6 +26,11 @@ export async function tags(API_URL) {
|
||||
};
|
||||
progressBar.increment();
|
||||
|
||||
// Delete icons from original arrays
|
||||
categories = categories.map(({ icon, ...rest }) => rest);
|
||||
loaders = loaders.map(({ icon, ...rest }) => rest);
|
||||
progressBar.increment();
|
||||
|
||||
// Set project types
|
||||
const projectTypes = ['mod', 'modpack'];
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user