From 5fa842b264f65eab99bb473f004fcec2b8f40da3 Mon Sep 17 00:00:00 2001 From: jaipaljadeja Date: Tue, 6 Aug 2024 19:36:11 +0530 Subject: [PATCH] cli: change output directory to .apibara --- examples/cli/package.json | 4 ++-- packages/cli/src/cli/commands/dev.ts | 2 +- packages/cli/src/cli/commands/prepare.ts | 2 +- packages/cli/src/core/config/defaults.ts | 2 +- packages/cli/src/rollup/config.ts | 8 +++++++- turbo.json | 1 + 6 files changed, 13 insertions(+), 6 deletions(-) diff --git a/examples/cli/package.json b/examples/cli/package.json index f24c5f0..da1bb33 100644 --- a/examples/cli/package.json +++ b/examples/cli/package.json @@ -4,10 +4,10 @@ "private": true, "scripts": { "apibara:build": "apibara build", - "apibara:start": "jiti ./dist/main.mjs", + "apibara:start": "jiti ./.apibara/build/main.mjs", "apibara:prepare": "apibara prepare", "apibara:dev": "apibara dev", - "typecheck": "tsc --noEmit", + "typecheck": "pnpm apibara:prepare && tsc --noEmit", "lint": "biome check .", "lint:fix": "pnpm lint --write", "format": "biome format . --write" diff --git a/packages/cli/src/cli/commands/dev.ts b/packages/cli/src/cli/commands/dev.ts index 4a07a55..e6ce116 100644 --- a/packages/cli/src/cli/commands/dev.ts +++ b/packages/cli/src/cli/commands/dev.ts @@ -87,7 +87,7 @@ export default defineCommand({ } const childArgs = [ - resolve(apibara.options.outputDir || "./dist", "main.mjs"), + resolve(apibara.options.outputDir || "./.apibara/build", "main.mjs"), ...(args.indexers ? ["--indexers", args.indexers] : []), ...(args.preset ? ["--preset", args.preset] : []), ...(args.sink ? ["--sink", args.sink] : []), diff --git a/packages/cli/src/cli/commands/prepare.ts b/packages/cli/src/cli/commands/prepare.ts index 21f0233..d0c7816 100644 --- a/packages/cli/src/cli/commands/prepare.ts +++ b/packages/cli/src/cli/commands/prepare.ts @@ -14,7 +14,7 @@ export default defineCommand({ ...commonArgs, }, async run({ args }) { - consola.start("Prepairing Types"); + consola.start("Preparing Types"); const rootDir = resolve((args.dir || ".") as string); const apibara = await createApibara({ rootDir }); await writeTypes(apibara); diff --git a/packages/cli/src/core/config/defaults.ts b/packages/cli/src/core/config/defaults.ts index c3a4526..7c8673f 100644 --- a/packages/cli/src/core/config/defaults.ts +++ b/packages/cli/src/core/config/defaults.ts @@ -3,7 +3,7 @@ import type { ApibaraConfig } from "apibara/types"; export const ApibaraDefaults: ApibaraConfig = { rootDir: ".", - outputDir: "./dist", + outputDir: "./.apibara/build", runtimeConfig: {}, hooks: {}, diff --git a/packages/cli/src/rollup/config.ts b/packages/cli/src/rollup/config.ts index d588c02..1da6ba6 100644 --- a/packages/cli/src/rollup/config.ts +++ b/packages/cli/src/rollup/config.ts @@ -139,7 +139,7 @@ runMain(command); main: "virtual:main.ts", }, output: { - dir: join(apibara.options.outputDir || "dist"), + dir: join(apibara.options.outputDir || "./.apibara/build"), format: "esm", exports: "auto", entryFileNames: "[name].mjs", @@ -177,6 +177,12 @@ runMain(command); json(), typescript({ tsconfig: join("./tsconfig.json"), + compilerOptions: { + outDir: join(apibara.options.outputDir || "./.apibara/build"), + declarationDir: join(apibara.options.outputDir || "./.apibara/build"), + noEmit: false, + types: ["node"], + }, }), ], onwarn(warning, rollupWarn) { diff --git a/turbo.json b/turbo.json index a7458e6..6732b07 100644 --- a/turbo.json +++ b/turbo.json @@ -12,6 +12,7 @@ "dependsOn": ["build"] }, "typecheck": { + "dependsOn": ["build"], "cache": false }, "lint": {