Skip to content

Commit

Permalink
Merge pull request #2 from a8cteam51/repo-sync/team51-patterns/default
Browse files Browse the repository at this point in the history
πŸ”„ synced file(s) with a8cteam51/team51-patterns
  • Loading branch information
GeoJunkie authored Mar 23, 2024
2 parents adb9d25 + 4d342c3 commit 2a7c94a
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/bin/build.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

$meta_files = glob('*/metadata.json', GLOB_BRACE);
foreach ( $meta_files as $meta_file ) {
$meta = json_decode(file_get_contents($meta_file), true);
$path = dirname($meta_file);
$slug = basename($path);
$data['categories'][$slug] = $meta;
}

// Read all other JSON files
$json_files = glob('*/*.json', GLOB_BRACE);
foreach ( $json_files as $json_file ) {
if ( basename($json_file) == 'metadata.json' ) {
continue;
}
$meta = json_decode(file_get_contents($json_file), true);
$path = dirname($json_file);
$slug = basename($json_file, '.json');
$data['patterns'][$path]['items'][$slug] = $meta;
}

echo json_encode($data);

0 comments on commit 2a7c94a

Please sign in to comment.