mirror of
https://github.com/shadoll/sLogos.git
synced 2026-02-04 11:03:24 +00:00
Refactor PWA caching and image generation scripts
- Updated `generate-pwa-cache-list.js` to include images directory and remove duplicate file entries. - Refactored `generate-svg-variants.js` to utilize collections from a centralized source and renamed generation directory variable. - Modified `update-data.js` to align with new directory structure for images and variants, ensuring proper paths are used. - Adjusted `collections.js` to standardize directory naming for variants. - Enhanced Svelte components (`Actions.svelte`, `CardFull.svelte`, `CardMiddle.svelte`, `CardSmall.svelte`, `CardTiny.svelte`) to utilize context for collection management, simplifying image URL generation.
This commit is contained in:
@@ -2,19 +2,8 @@
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const { collections } = require('../src/collections.js');
|
||||
|
||||
const collections = [
|
||||
{ name: 'logos', label: 'Logos',
|
||||
baseDir: 'logos',
|
||||
genDir: 'logos_variants',
|
||||
dataFile: 'data/logos.json'
|
||||
},
|
||||
{ name: 'flags', label: 'Flags',
|
||||
baseDir: 'flags',
|
||||
genDir: 'flags_variants',
|
||||
dataFile: 'data/flags.json'
|
||||
}
|
||||
];
|
||||
|
||||
// Accept collection as a CLI arg or env var
|
||||
const collectionArg = process.argv.find(arg => arg.startsWith('--collection='));
|
||||
@@ -22,7 +11,7 @@ const collectionName = collectionArg ? collectionArg.split('=')[1] : (process.en
|
||||
const collection = collections.find(c => c.name === collectionName) || collections[0];
|
||||
|
||||
const LOGOS_DIR = path.join(__dirname, '..', 'public', collection.baseDir);
|
||||
const LOGOS_GEN_DIR = path.join(__dirname, '..', 'public', collection.genDir);
|
||||
const LOGOS_GEN_DIR = path.join(__dirname, '..', 'public', collection.varDir);
|
||||
|
||||
// Try multiple possible locations for logos.json
|
||||
const POSSIBLE_LOGOS_JSON_PATHS = [
|
||||
|
||||
Reference in New Issue
Block a user