-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cli: refactor build, dev, start commands (#111)
### Context This PR refactors how the build, dev, and start commands work. We leverage the Rollup's virtual plugin to generate a list of indexers to build time. This indexers are then imported by the dev/start command at runtime.
- Loading branch information
Showing
55 changed files
with
828 additions
and
339 deletions.
There are no files selected for viewing
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
7 changes: 7 additions & 0 deletions
7
change/@apibara-indexer-843e6831-307c-49b1-bf59-833803a4a27f.json
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,7 @@ | ||
{ | ||
"type": "none", | ||
"comment": "Remove unused scripts", | ||
"packageName": "@apibara/indexer", | ||
"email": "francesco@ceccon.me", | ||
"dependentChangeType": "none" | ||
} |
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,7 @@ | ||
{ | ||
"type": "prerelease", | ||
"comment": "Refactor dev, build, and start commands", | ||
"packageName": "apibara", | ||
"email": "francesco@ceccon.me", | ||
"dependentChangeType": "patch" | ||
} |
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,15 @@ | ||
import { defineConfig } from "apibara/config"; | ||
|
||
export default defineConfig({ | ||
runtimeConfig: { | ||
test: 123, | ||
check: "something", | ||
}, | ||
presets: { | ||
dev: { | ||
runtimeConfig: { | ||
test: 999, | ||
}, | ||
}, | ||
}, | ||
}); |
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,24 @@ | ||
import { defineIndexer } from "@apibara/indexer"; | ||
import { StarknetStream } from "@apibara/starknet"; | ||
import { hash } from "starknet"; | ||
|
||
export default defineIndexer(StarknetStream)({ | ||
streamUrl: "https://starknet.preview.apibara.org", | ||
finality: "accepted", | ||
startingCursor: { | ||
orderKey: 800_000n, | ||
}, | ||
filter: { | ||
events: [ | ||
{ | ||
address: | ||
"0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7", | ||
keys: [hash.getSelectorFromName("Transfer")], | ||
includeReceipt: true, | ||
}, | ||
], | ||
}, | ||
async transform({ block: { header } }) { | ||
console.log("Transforming block ", header?.blockNumber); | ||
}, | ||
}); |
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,27 @@ | ||
{ | ||
"name": "example-cli-js", | ||
"private": true, | ||
"version": "1.0.0", | ||
"description": "", | ||
"scripts": { | ||
"build": "apibara build", | ||
"dev": "apibara dev", | ||
"start": "apibara start", | ||
"lint": "biome check .", | ||
"lint:fix": "pnpm lint --write" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"devDependencies": { | ||
"@types/node": "^20.5.2", | ||
"typescript": "^5.6.2" | ||
}, | ||
"dependencies": { | ||
"@apibara/indexer": "workspace:*", | ||
"@apibara/protocol": "workspace:*", | ||
"@apibara/starknet": "workspace:*", | ||
"apibara": "workspace:*", | ||
"starknet": "^6.11.0" | ||
} | ||
} |
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
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 was deleted.
Oops, something went wrong.
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,2 @@ | ||
export declare const pkgDir: string; | ||
export declare const runtimeDir: string; |
Oops, something went wrong.