Skip to content

Commit

Permalink
fix: separate covers json from peaks data
Browse files Browse the repository at this point in the history
  • Loading branch information
BohdanOne committed Apr 20, 2024
1 parent 09fc87d commit 749cf13
Show file tree
Hide file tree
Showing 41 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions scripts/addCoverImages.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import path from 'path';
// Read the covers.json file
const coversData = JSON.parse(fs.readFileSync('src/lib/data/covers.json', 'utf8'));

// Get all JSON files in the /data directory
const dataDir = 'src/lib/data';
const dataDir = 'src/lib/data/peaks';
const files = fs.readdirSync(dataDir);

files.forEach((file) => {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/routes/api/peaks/+server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export async function GET() {
async function getPeaks(): Promise<Peak[]> {
let peaks = [];

const jsonPaths = import.meta.glob('/src/lib/data/*.json', { eager: true }) as Record<
const jsonPaths = import.meta.glob('/src/lib/data/peaks/*.json', { eager: true }) as Record<
string,
{ default: Peak }
>;
Expand All @@ -30,7 +30,7 @@ async function getPeaks(): Promise<Peak[]> {
if (peak && typeof peak === 'object') {
let gpx;
try {
gpx = (await import(`../../../lib/data/${peak.slug}.gpx?raw`)).default;
gpx = (await import(`../../../lib/data/peaks/${peak.slug}.gpx?raw`)).default;
} catch (_) {
// no GPX file
}
Expand Down

0 comments on commit 749cf13

Please sign in to comment.