Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Fix branch switching causing failing config verification (#81)
Browse files Browse the repository at this point in the history
* Categorize a project as a folder with a config.jsonc and discovered.jsonc

* changeset
  • Loading branch information
mateuszradomski authored Oct 23, 2023
1 parent 7d348a6 commit 0ee86c9
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
6 changes: 6 additions & 0 deletions packages/discovery/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @l2beat/discovery

## 0.18.4

### Patch Changes

- Categorize a project as a folder with a config.jsonc and discovered.json

## 0.18.3

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion packages/discovery/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@l2beat/discovery",
"description": "L2Beat discovery - engine & tooling utilized for keeping an eye on L2s",
"version": "0.18.3",
"version": "0.18.4",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"bin": {
Expand Down
21 changes: 19 additions & 2 deletions packages/discovery/src/discovery/config/ConfigReader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,26 @@ export class ConfigReader {
.filter((x) => x.isDirectory())
.map((x) => x.name)

if (contents.includes(ChainId.getName(chain))) {
projects.push(folder.name)
if (!contents.includes(ChainId.getName(chain))) {
continue
}

const chainFiles = readdirSync(
`discovery/${folder.name}/${ChainId.getName(chain)}`,
{
withFileTypes: true,
},
)
.filter((x) => x.isFile())
.map((x) => x.name)

const hasConfig = chainFiles.includes('config.jsonc')
const hasDiscovered = chainFiles.includes('discovered.json')
if (!hasConfig || !hasDiscovered) {
continue
}

projects.push(folder.name)
}

return projects
Expand Down

0 comments on commit 0ee86c9

Please sign in to comment.