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

Fix schema and config file path in ponder-env.d.ts #1116

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
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
19 changes: 16 additions & 3 deletions packages/core/src/common/codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ export const ponderEnv = `// This file enables type checking and editor autocomp
declare module "@/generated" {
import type { Virtual } from "@ponder/core";

type config = typeof import("./ponder.config.ts").default;
type schema = typeof import("./ponder.schema.ts").default;
type config = typeof import("[[CONFIG]]").default;
type schema = typeof import("[[SCHEMA]]").default;

export const ponder: Virtual.Registry<config, schema>;

Expand Down Expand Up @@ -40,9 +40,22 @@ export function runCodegen({
common: Common;
graphqlSchema: GraphQLSchema;
}) {
// Replace the placeholder with the actual path to the config file
const relativeConfigFile = path.relative(
common.options.rootDir,
common.options.configFile,
);
const relativeSchemaFile = path.relative(
common.options.rootDir,
common.options.schemaFile,
);
const ponderEnvWithPath = ponderEnv
.replace("[[CONFIG]]", `./${relativeConfigFile}`)
.replace("[[SCHEMA]]", `./${relativeSchemaFile}`);

writeFileSync(
path.join(common.options.rootDir, "ponder-env.d.ts"),
ponderEnv,
ponderEnvWithPath,
"utf8",
);

Expand Down
Loading