Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

convert codebase to ESM & add build watch support #377

Closed
wants to merge 29 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
76d2247
wip: esm
o-az Oct 5, 2023
79b9b7c
esm works: save progress
o-az Oct 5, 2023
68ea406
wip
o-az Oct 5, 2023
b92e04e
cleanup core files
o-az Oct 5, 2023
20b1202
more cleanup
o-az Oct 5, 2023
c048212
switch detect-package-manager to require
o-az Oct 5, 2023
6cdeb0e
fix some imports
o-az Oct 6, 2023
c6e9484
save progress
o-az Oct 6, 2023
f7028aa
create-ponder to ESM
o-az Oct 6, 2023
3895702
examples ESM
o-az Oct 6, 2023
64d090a
update codegen code to ESM
o-az Oct 6, 2023
088c2d6
update lockfile
o-az Oct 6, 2023
63c463b
esm-safe __dirname
o-az Oct 6, 2023
1812070
fix types by upgrading kysely
o-az Oct 6, 2023
14a7b02
set path alias for _test/ens and _test/art-gobblers in vitest config
o-az Oct 6, 2023
2618d7c
update _test/art-gobblers nested file import
o-az Oct 6, 2023
9aff69d
remove unecessary extra line
o-az Oct 6, 2023
8dbd119
Merge branch 'main' into o-az/esm-switch
o-az Oct 6, 2023
b00bcc8
rename to rejectedImports
o-az Oct 6, 2023
fbde514
Merge branch 'main' into o-az/esm-switch
o-az Oct 6, 2023
dff77e3
revert absolute import in ens and art-gobblers tests
o-az Oct 6, 2023
3a8cdc3
Merge branch 'main' into o-az/esm-switch
o-az Oct 6, 2023
cadb254
destructure array for first error
o-az Oct 6, 2023
d5cd391
set engines to >= v18 and eslint import type rule
o-az Oct 6, 2023
ac258ef
add build watch support with esbuild
o-az Oct 11, 2023
85a496c
fix lint
o-az Oct 11, 2023
84a4492
watch mode in dev works now
o-az Oct 11, 2023
3343ee4
Merge branch 'main' into o-az/esm-switch
o-az Oct 12, 2023
f8876b8
fix: import extension
o-az Oct 12, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
"simple-import-sort/exports": "error",
"import/first": "error",
"import/newline-after-import": "error",
"@typescript-eslint/consistent-type-imports": [
"error",
{ "prefer": "type-imports" }
],
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-non-null-assertion": "off",
Expand Down
6 changes: 6 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
auto-install-peers=true
# ensure postinstall scripts from dependencies like better-sqlite3 are run
ignore-scripts=false
enable-pre-post-scripts=true
# pre/postscripts don't run when package has been installe to store. This ensures it always runs
side-effects-cache=false
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
],
"typescript.tsdk": "node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true,
// automatically append .js to local imports
"typescript.preferences.importModuleSpecifierEnding": "js",
"search.exclude": {
"node_modules": true,
"pnpm-lock.yaml": true,
Expand Down
5 changes: 3 additions & 2 deletions benchmarks/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "ponder-benchmarks",
"private": true,
"type": "module",
"scripts": {
"bench": "export $(grep -v '^#' .env.local | xargs) && docker-compose up --detach && tsup-node && (node dist/bench.mjs || true) && docker-compose down",
"bench:ci": "tsup-node && node dist/bench.mjs"
Expand All @@ -9,11 +10,11 @@
"@graphprotocol/graph-cli": "^0.51.1",
"@graphprotocol/graph-ts": "^0.31.0",
"@ponder/core": "workspace:latest",
"@types/node": "^18.16.18",
"@types/node": "^20.8.2",
"execa": "^5.1.1",
"parse-prometheus-text-format": "^1.1.1",
"tsup": "^7.0.0",
"typescript": "^5.1.3",
"typescript": "^5.2.2",
"viem": "0.3.50"
}
}
5 changes: 3 additions & 2 deletions docs/pages/api/telemetry/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Analytics, TrackParams } from "@segment/analytics-node";
import { NextApiRequest, NextApiResponse } from "next";
import type { TrackParams } from "@segment/analytics-node";
import { Analytics } from "@segment/analytics-node";
import type { NextApiRequest, NextApiResponse } from "next";

if (!process.env.SEGMENT_WRITE_KEY) {
throw new Error('Missing required environment variable "SEGMENT_WRITE_KEY".');
Expand Down
3 changes: 2 additions & 1 deletion examples/art-gobblers/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "ponder-examples-art-gobblers",
"private": true,
"type": "module",
"scripts": {
"dev": "ponder dev",
"start": "ponder start",
Expand All @@ -14,7 +15,7 @@
"abitype": "^0.8.11",
"eslint": "^8.43.0",
"eslint-config-ponder": "workspace:latest",
"typescript": "^5.1.3",
"typescript": "^5.2.2",
"viem": "^1.2.6"
}
}
3 changes: 2 additions & 1 deletion examples/ethfs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "ponder-examples-ethfs",
"private": true,
"type": "module",
"scripts": {
"dev": "ponder dev",
"start": "ponder start",
Expand All @@ -14,7 +15,7 @@
"abitype": "^0.8.11",
"eslint": "^8.43.0",
"eslint-config-ponder": "workspace:latest",
"typescript": "^5.1.3",
"typescript": "^5.2.2",
"viem": "^1.2.6"
}
}
4 changes: 2 additions & 2 deletions examples/ethfs/ponder.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Config } from "@ponder/core";

import FileStoreAbi from "./abis/FileStore.json";
import FileStoreFrontendAbi from "./abis/FileStoreFrontend.json";
import FileStoreAbi from "./abis/FileStore.json" assert { type: "json" };
import FileStoreFrontendAbi from "./abis/FileStoreFrontend.json" assert { type: "json" };

export const config: Config = {
networks: [
Expand Down
3 changes: 2 additions & 1 deletion examples/ethfs/src/FileStore.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { fromHex, Hex } from "viem";
import type { Hex } from "viem";
import { fromHex } from "viem";

import { ponder } from "@/generated";

Expand Down
2 changes: 1 addition & 1 deletion examples/ethfs/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "node",
"moduleResolution": "Bundler",
"resolveJsonModule": true,
"esModuleInterop": true,
"strict": true,
Expand Down
5 changes: 3 additions & 2 deletions examples/friendtech/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "ponder-examples-friendtech",
"private": true,
"type": "module",
"scripts": {
"dev": "ponder dev",
"start": "ponder start",
Expand All @@ -10,9 +11,9 @@
"@ponder/core": "workspace:latest"
},
"devDependencies": {
"@types/node": "^18.11.18",
"@types/node": "^20.8.2",
"abitype": "^0.8.11",
"typescript": "^5.1.3",
"typescript": "^5.2.2",
"viem": "^1.2.6"
}
}
3 changes: 2 additions & 1 deletion examples/token-erc20/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "ponder-examples-token-erc20",
"private": true,
"type": "module",
"scripts": {
"dev": "ponder dev",
"start": "ponder start",
Expand All @@ -14,7 +15,7 @@
"abitype": "^0.8.11",
"eslint": "^8.43.0",
"eslint-config-ponder": "workspace:latest",
"typescript": "^5.1.3",
"typescript": "^5.2.2",
"viem": "^1.2.6"
}
}
3 changes: 2 additions & 1 deletion examples/token-erc721/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "ponder-examples-token-erc721",
"private": true,
"type": "module",
"scripts": {
"dev": "ponder dev",
"start": "ponder start",
Expand All @@ -14,7 +15,7 @@
"abitype": "^0.8.11",
"eslint": "^8.43.0",
"eslint-config-ponder": "workspace:latest",
"typescript": "^5.1.3",
"typescript": "^5.2.2",
"viem": "^1.2.6"
}
}
3 changes: 2 additions & 1 deletion examples/token-reth/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "ponder-examples-token-reth",
"private": true,
"type": "module",
"scripts": {
"dev": "ponder dev",
"start": "ponder start",
Expand All @@ -14,7 +15,7 @@
"abitype": "^0.8.11",
"eslint": "^8.43.0",
"eslint-config-ponder": "workspace:latest",
"typescript": "^5.1.3",
"typescript": "^5.2.2",
"viem": "^1.2.6"
}
}
Loading