You've already forked AstralRinth
forked from didirus/AstralRinth
Fix tag icon generator
This commit is contained in:
@@ -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'];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user