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