-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: make setup easy to new list (#227)
* refactor * fix test * remove base * polish * doc * workflow * update lock * lock version * unlock * use node * fix coingecko
- Loading branch information
Showing
36 changed files
with
1,041 additions
and
8,051 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { buildList, saveList, VersionBump } from "./src/buildList.js"; | ||
import checksumAddresses from "./src/checksum.js"; | ||
import ciCheck from "./src/ci-check.js"; | ||
import topTokens from "./src/top-100.js"; | ||
import fetchThirdPartyList from "./src/fetchThirdPartyList.js"; | ||
import { LISTS } from "./src/constants.js"; | ||
import { exec } from "child_process"; | ||
|
||
const command = process.argv[2]; | ||
const listName = process.argv[3]; | ||
const versionBump = process.argv[4]; | ||
|
||
function checkListName() { | ||
if (LISTS[listName as keyof typeof LISTS] === undefined) { | ||
throw new Error(`Unknown list: ${listName}. Please check src/constants.ts`); | ||
} | ||
} | ||
|
||
switch (command) { | ||
case "checksum": | ||
checkListName(); | ||
await checksumAddresses(listName); | ||
break; | ||
case "generate": | ||
checkListName(); | ||
await saveList(await buildList(listName, versionBump as VersionBump), listName); | ||
break; | ||
case "makelist": | ||
checkListName(); | ||
await checksumAddresses(listName); | ||
await saveList(await buildList(listName, versionBump as VersionBump), listName); | ||
const proc = Bun.spawn({ | ||
cmd: ["bun", "test", "-t", `${listName}`], | ||
}); | ||
|
||
await proc.exited; | ||
if (proc.exitCode !== 0) { | ||
throw new Error(`Failed to generate list ${listName}`); | ||
} | ||
break; | ||
case "fetch": | ||
checkListName(); | ||
if (listName === "pcs-top-100") { | ||
await topTokens(); | ||
} | ||
await fetchThirdPartyList(listName); | ||
break; | ||
case "ci-check": | ||
await ciCheck(); | ||
break; | ||
default: | ||
console.info("Unknown command"); | ||
break; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.