From 03dedbdafaf1e3450a7f920a94f5fcaeff132770 Mon Sep 17 00:00:00 2001 From: Ian Macartney Date: Wed, 15 Oct 2025 23:05:44 -0700 Subject: [PATCH 1/5] static api codegen --- template-component/convex.json | 6 ++- .../example/convex/_generated/api.d.ts | 38 +++++++++---------- template-component/src/client/index.ts | 4 +- .../src/component/_generated/api.d.ts | 36 ++++++------------ 4 files changed, 37 insertions(+), 47 deletions(-) diff --git a/template-component/convex.json b/template-component/convex.json index 1704a04d..07199a61 100644 --- a/template-component/convex.json +++ b/template-component/convex.json @@ -1,3 +1,7 @@ { - "functions": "example/convex" + "$schema": "https://raw.githubusercontent.com/get-convex/convex-backend/refs/heads/main/npm-packages/convex/schemas/convex.schema.json", + "functions": "example/convex", + "codegen": { + "staticApi": true + } } diff --git a/template-component/example/convex/_generated/api.d.ts b/template-component/example/convex/_generated/api.d.ts index 2f1979a4..9918c619 100644 --- a/template-component/example/convex/_generated/api.d.ts +++ b/template-component/example/convex/_generated/api.d.ts @@ -8,35 +8,33 @@ * @module */ -import type * as example from "../example.js"; - -import type { - ApiFromModules, - FilterApi, - FunctionReference, -} from "convex/server"; +import type { FunctionReference } from "convex/server"; /** - * A utility for referencing Convex functions in your app's API. + * A utility for referencing Convex functions in your app's public API. * * Usage: * ```js * const myFunctionReference = api.myModule.myFunction; * ``` */ -declare const fullApi: ApiFromModules<{ - example: typeof example; -}>; -declare const fullApiWithMounts: typeof fullApi; +export declare const api: { + example: { + addOne: FunctionReference<"mutation", "public", {}, any>; + add: FunctionReference<"mutation", "public", { name: string }, any>; + count: FunctionReference<"query", "public", { name: string }, any>; + }; +}; -export declare const api: FilterApi< - typeof fullApiWithMounts, - FunctionReference ->; -export declare const internal: FilterApi< - typeof fullApiWithMounts, - FunctionReference ->; +/** + * A utility for referencing Convex functions in your app's internal API. + * + * Usage: + * ```js + * const myFunctionReference = internal.myModule.myFunction; + * ``` + */ +export declare const internal: {}; export declare const components: { shardedCounter: { diff --git a/template-component/src/client/index.ts b/template-component/src/client/index.ts index 24d30368..d43137ca 100644 --- a/template-component/src/client/index.ts +++ b/template-component/src/client/index.ts @@ -1,12 +1,12 @@ import { mutationGeneric, queryGeneric } from "convex/server"; import { v } from "convex/values"; -import type { Mounts } from "../component/_generated/api.js"; +import type { api } from "../component/_generated/api.js"; import type { UseApi, RunMutationCtx, RunQueryCtx } from "./types.js"; // UseApi is an alternative that has jump-to-definition but is // less stable and reliant on types within the component files, which can cause // issues where passing `components.foo` doesn't match the argument -export type ShardedCounterComponent = UseApi; +export type ShardedCounterComponent = UseApi; export class ShardedCounter> { constructor( diff --git a/template-component/src/component/_generated/api.d.ts b/template-component/src/component/_generated/api.d.ts index 38b1ff9c..b3716e20 100644 --- a/template-component/src/component/_generated/api.d.ts +++ b/template-component/src/component/_generated/api.d.ts @@ -8,26 +8,17 @@ * @module */ -import type * as lib from "../lib.js"; - -import type { - ApiFromModules, - FilterApi, - FunctionReference, -} from "convex/server"; +import type { FunctionReference } from "convex/server"; /** - * A utility for referencing Convex functions in your app's API. + * A utility for referencing Convex functions in your app's public API. * * Usage: * ```js * const myFunctionReference = api.myModule.myFunction; * ``` */ -declare const fullApi: ApiFromModules<{ - lib: typeof lib; -}>; -export type Mounts = { +export declare const api: { lib: { add: FunctionReference< "mutation", @@ -38,18 +29,15 @@ export type Mounts = { count: FunctionReference<"query", "public", { name: string }, number>; }; }; -// For now fullApiWithMounts is only fullApi which provides -// jump-to-definition in component client code. -// Use Mounts for the same type without the inference. -declare const fullApiWithMounts: typeof fullApi; -export declare const api: FilterApi< - typeof fullApiWithMounts, - FunctionReference ->; -export declare const internal: FilterApi< - typeof fullApiWithMounts, - FunctionReference ->; +/** + * A utility for referencing Convex functions in your app's internal API. + * + * Usage: + * ```js + * const myFunctionReference = internal.myModule.myFunction; + * ``` + */ +export declare const internal: {}; export declare const components: {}; From 493a6d53caeb4a3ab021e91d5a5818f76ccaf52c Mon Sep 17 00:00:00 2001 From: Ian Macartney Date: Fri, 24 Oct 2025 17:45:20 -0700 Subject: [PATCH 2/5] lint --- .../example/convex/example.test.ts | 4 +- template-component/example/convex/example.ts | 4 +- template-component/example/src/App.tsx | 2 +- template-component/example/src/main.tsx | 2 +- template-component/package-lock.json | 138 +++--------------- template-component/package.json | 2 +- template-component/tsconfig.json | 2 +- 7 files changed, 27 insertions(+), 127 deletions(-) diff --git a/template-component/example/convex/example.test.ts b/template-component/example/convex/example.test.ts index 79cb340c..6cd84ce4 100644 --- a/template-component/example/convex/example.test.ts +++ b/template-component/example/convex/example.test.ts @@ -1,6 +1,6 @@ import { afterEach, beforeEach, describe, test, vi } from "vitest"; -import { initConvexTest } from "./setup.test"; -import { api } from "./_generated/api"; +import { initConvexTest } from "./setup.test.js"; +import { api } from "./_generated/api.js"; describe("example", () => { beforeEach(async () => { diff --git a/template-component/example/convex/example.ts b/template-component/example/convex/example.ts index 5ddaddfd..125a89b1 100644 --- a/template-component/example/convex/example.ts +++ b/template-component/example/convex/example.ts @@ -1,5 +1,5 @@ -import { mutation } from "./_generated/server"; -import { components } from "./_generated/api"; +import { mutation } from "./_generated/server.js"; +import { components } from "./_generated/api.js"; import { ShardedCounter } from "@example/sharded-counter"; const shardedCounter = new ShardedCounter(components.shardedCounter, {}); diff --git a/template-component/example/src/App.tsx b/template-component/example/src/App.tsx index 52ce503e..6e9866e0 100644 --- a/template-component/example/src/App.tsx +++ b/template-component/example/src/App.tsx @@ -1,6 +1,6 @@ import "./App.css"; import { useMutation, useQuery } from "convex/react"; -import { api } from "../convex/_generated/api"; +import { api } from "../convex/_generated/api.js"; function App() { const count = useQuery(api.example.count, { name: "accomplishments" }); diff --git a/template-component/example/src/main.tsx b/template-component/example/src/main.tsx index 2669e617..075b50a3 100644 --- a/template-component/example/src/main.tsx +++ b/template-component/example/src/main.tsx @@ -1,7 +1,7 @@ import { StrictMode } from "react"; import { createRoot } from "react-dom/client"; import { ConvexProvider, ConvexReactClient } from "convex/react"; -import App from "./App.tsx"; +import App from "./App.jsx"; import "./index.css"; const address = import.meta.env.VITE_CONVEX_URL; diff --git a/template-component/package-lock.json b/template-component/package-lock.json index e3e2da18..2012f041 100644 --- a/template-component/package-lock.json +++ b/template-component/package-lock.json @@ -31,7 +31,7 @@ "prettier": "3.6.2", "react": "^18.3.1", "react-dom": "^18.3.1", - "typescript": "5.5.4", + "typescript": "5.8.3", "typescript-eslint": "8.46.2", "vite": "^7.1.5", "vitest": "^3.2.4" @@ -180,6 +180,7 @@ "integrity": "sha512-2BCOP7TN8M+gVDj7/ht3hsaO/B/n5oDbiAyyvnRlNOs+u1o+JWNYTQrmpuNp1/Wq2gcFrI01JAW+paEKDMx/CA==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@babel/code-frame": "^7.27.1", "@babel/generator": "^7.28.3", @@ -673,6 +674,7 @@ "integrity": "sha512-NKBGBSIKUG584qrS1tyxVpX/AKJKQw5HgjYEnPLC0QsTw79JrGn+qUr8CXFb955Iy7GUdiiUv1rJ6JBGvaKb6w==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@edge-runtime/primitives": "6.0.0" }, @@ -1493,6 +1495,7 @@ "integrity": "sha512-/g2d4sW9nUDJOMz3mabVQvOGhVa4e/BN/Um7yca9Bb2XTzPPnfTWHWQg+IsEYO7M3Vx+EXvaM/I2pJWIMun1bg==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@octokit/auth-token": "^4.0.0", "@octokit/graphql": "^7.1.0", @@ -2095,6 +2098,7 @@ "integrity": "sha512-2Q7WS25j4pS1cS8yw3d6buNCVJukOTeQ39bAnwR6sOJbaxvyCGebzTMypDFN82CxBLnl+lSWVdCCWbRY6y9yZQ==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "undici-types": "~6.21.0" } @@ -2112,6 +2116,7 @@ "integrity": "sha512-RFA/bURkcKzx/X9oumPG9Vp3D3JUgus/d0b67KB0t5S/raciymilkOa66olh78MUI92QLbEJevO7rvqU/kjwKA==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@types/prop-types": "*", "csstype": "^3.0.2" @@ -2127,71 +2132,6 @@ "@types/react": "^18.0.0" } }, - "node_modules/@typescript-eslint/eslint-plugin": { - "version": "8.46.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.46.2.tgz", - "integrity": "sha512-ZGBMToy857/NIPaaCucIUQgqueOiq7HeAKkhlvqVV4lm089zUFW6ikRySx2v+cAhKeUCPuWVHeimyk6Dw1iY3w==", - "dev": true, - "license": "MIT", - "dependencies": { - "@eslint-community/regexpp": "^4.10.0", - "@typescript-eslint/scope-manager": "8.46.2", - "@typescript-eslint/type-utils": "8.46.2", - "@typescript-eslint/utils": "8.46.2", - "@typescript-eslint/visitor-keys": "8.46.2", - "graphemer": "^1.4.0", - "ignore": "^7.0.0", - "natural-compare": "^1.4.0", - "ts-api-utils": "^2.1.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "@typescript-eslint/parser": "^8.46.2", - "eslint": "^8.57.0 || ^9.0.0", - "typescript": ">=4.8.4 <6.0.0" - } - }, - "node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": { - "version": "7.0.5", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz", - "integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 4" - } - }, - "node_modules/@typescript-eslint/parser": { - "version": "8.46.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.46.2.tgz", - "integrity": "sha512-BnOroVl1SgrPLywqxyqdJ4l3S2MsKVLDVxZvjI1Eoe8ev2r3kGDo+PcMihNmDE+6/KjkTubSJnmqGZZjQSBq/g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@typescript-eslint/scope-manager": "8.46.2", - "@typescript-eslint/types": "8.46.2", - "@typescript-eslint/typescript-estree": "8.46.2", - "@typescript-eslint/visitor-keys": "8.46.2", - "debug": "^4.3.4" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^8.57.0 || ^9.0.0", - "typescript": ">=4.8.4 <6.0.0" - } - }, "node_modules/@typescript-eslint/project-service": { "version": "8.46.2", "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.46.2.tgz", @@ -2249,31 +2189,6 @@ "typescript": ">=4.8.4 <6.0.0" } }, - "node_modules/@typescript-eslint/type-utils": { - "version": "8.46.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.46.2.tgz", - "integrity": "sha512-HbPM4LbaAAt/DjxXaG9yiS9brOOz6fabal4uvUmaUYe6l3K1phQDMQKBRUrr06BQkxkvIZVVHttqiybM9nJsLA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@typescript-eslint/types": "8.46.2", - "@typescript-eslint/typescript-estree": "8.46.2", - "@typescript-eslint/utils": "8.46.2", - "debug": "^4.3.4", - "ts-api-utils": "^2.1.0" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^8.57.0 || ^9.0.0", - "typescript": ">=4.8.4 <6.0.0" - } - }, "node_modules/@typescript-eslint/types": { "version": "8.46.2", "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.46.2.tgz", @@ -2343,30 +2258,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/@typescript-eslint/utils": { - "version": "8.46.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.46.2.tgz", - "integrity": "sha512-sExxzucx0Tud5tE0XqR0lT0psBQvEpnpiul9XbGUB1QwpWJJAps1O/Z7hJxLGiZLBKMCutjTzDgmd1muEhBnVg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@eslint-community/eslint-utils": "^4.7.0", - "@typescript-eslint/scope-manager": "8.46.2", - "@typescript-eslint/types": "8.46.2", - "@typescript-eslint/typescript-estree": "8.46.2" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/typescript-eslint" - }, - "peerDependencies": { - "eslint": "^8.57.0 || ^9.0.0", - "typescript": ">=4.8.4 <6.0.0" - } - }, "node_modules/@typescript-eslint/visitor-keys": { "version": "8.46.2", "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.46.2.tgz", @@ -2527,6 +2418,7 @@ "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", "dev": true, "license": "MIT", + "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -2883,6 +2775,7 @@ } ], "license": "MIT", + "peer": true, "dependencies": { "baseline-browser-mapping": "^2.8.9", "caniuse-lite": "^1.0.30001746", @@ -3405,7 +3298,6 @@ "resolved": "https://registry.npmjs.org/convex/-/convex-1.28.0.tgz", "integrity": "sha512-40FgeJ/LxP9TxnkDDztU/A5gcGTdq1klcTT5mM0Ak+kSlQiDktMpjNX1TfkWLxXaE3lI4qvawKH95v2RiYgFxA==", "license": "Apache-2.0", - "peer": true, "dependencies": { "esbuild": "0.25.4", "prettier": "^3.0.0" @@ -3988,6 +3880,7 @@ "integrity": "sha512-XyLmROnACWqSxiGYArdef1fItQd47weqB7iwtfr9JHwRrqIXZdcFMvvEcL9xHCmL0SNsOvF0c42lWyM1U5dgig==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.8.0", "@eslint-community/regexpp": "^4.12.1", @@ -5440,6 +5333,7 @@ "integrity": "sha512-jcByLnIFkd5gSXZmjNvS1TlmRhCXZjIzHYlaGkPlLIekG55JDR2Z4va9tZwCiP+/RDERiNhMOFu01xd6O5ct1Q==", "dev": true, "license": "MIT", + "peer": true, "bin": { "marked": "bin/marked.js" }, @@ -6199,6 +6093,7 @@ "version": "3.6.2", "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.6.2.tgz", "integrity": "sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==", + "dev": true, "license": "MIT", "bin": { "prettier": "bin/prettier.cjs" @@ -6307,6 +6202,7 @@ "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==", "devOptional": true, "license": "MIT", + "peer": true, "dependencies": { "loose-envify": "^1.1.0" }, @@ -7141,6 +7037,7 @@ "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": ">=12" }, @@ -7314,11 +7211,12 @@ } }, "node_modules/typescript": { - "version": "5.5.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.4.tgz", - "integrity": "sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q==", + "version": "5.8.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz", + "integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==", "dev": true, "license": "Apache-2.0", + "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -7494,6 +7392,7 @@ "integrity": "sha512-uzcxnSDVjAopEUjljkWh8EIrg6tlzrjFUfMcR1EVsRDGwf/ccef0qQPRyOrROwhrTDaApueq+ja+KLPlzR/zdg==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "esbuild": "^0.25.0", "fdir": "^6.5.0", @@ -7610,6 +7509,7 @@ "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": ">=12" }, diff --git a/template-component/package.json b/template-component/package.json index 70262465..1f9ba7dc 100644 --- a/template-component/package.json +++ b/template-component/package.json @@ -85,7 +85,7 @@ "prettier": "3.6.2", "react": "^18.3.1", "react-dom": "^18.3.1", - "typescript": "5.5.4", + "typescript": "5.8.3", "typescript-eslint": "8.46.2", "vite": "^7.1.5", "vitest": "^3.2.4" diff --git a/template-component/tsconfig.json b/template-component/tsconfig.json index 9f957706..bafcec2d 100644 --- a/template-component/tsconfig.json +++ b/template-component/tsconfig.json @@ -23,5 +23,5 @@ "verbatimModuleSyntax": true, "skipLibCheck": true }, - "include": ["./src/**/*"] + "include": ["./src"] } From 89a343e22a77d1303778acd6a6a3a036e9b21890 Mon Sep 17 00:00:00 2001 From: Ian Macartney Date: Fri, 24 Oct 2025 18:12:18 -0700 Subject: [PATCH 3/5] drop live sources --- template-component/example/convex/tsconfig.json | 9 --------- template-component/example/tsconfig.json | 8 -------- template-component/example/vite.config.ts | 3 --- template-component/package.json | 5 +---- 4 files changed, 1 insertion(+), 24 deletions(-) diff --git a/template-component/example/convex/tsconfig.json b/template-component/example/convex/tsconfig.json index a0917ff7..4bfd29bf 100644 --- a/template-component/example/convex/tsconfig.json +++ b/template-component/example/convex/tsconfig.json @@ -19,15 +19,6 @@ "moduleResolution": "Bundler", "isolatedModules": true, "noEmit": true - - /* This should only be used in this example. Real apps should not attempt - * to compile TypeScript because differences between tsconfig.json files can - * cause the code to be compiled differently. - */ - // Un-comment this to get instant types between your component and example. - // However, if you're willing to wait for a build before the types update, - // it's better to leave this commented out to catch build errors faster. - // "customConditions": ["@convex-dev/component-source"] }, "include": ["./**/*"], "exclude": ["./_generated"] diff --git a/template-component/example/tsconfig.json b/template-component/example/tsconfig.json index f866d56d..20f8c63d 100644 --- a/template-component/example/tsconfig.json +++ b/template-component/example/tsconfig.json @@ -13,14 +13,6 @@ "isolatedModules": true, "allowImportingTsExtensions": true, "jsx": "react-jsx", - /* This should only be used in this example. Real apps should not attempt - * to compile TypeScript because differences between tsconfig.json files can - * cause the code to be compiled differently. - * Note: To most reliably test your component as a library, comment this - * out and remove --live-component-sources from the package.json scripts. - * This will require you to be re-building your component - */ - "customConditions": ["@convex-dev/component-source"], "noEmit": true }, "include": ["./src", "vite.config.ts"] diff --git a/template-component/example/vite.config.ts b/template-component/example/vite.config.ts index 8bd1a85a..13f5b0f5 100644 --- a/template-component/example/vite.config.ts +++ b/template-component/example/vite.config.ts @@ -5,7 +5,4 @@ import react from "@vitejs/plugin-react"; export default defineConfig({ envDir: "../", plugins: [react()], - resolve: { - conditions: ["@convex-dev/component-source"], - }, }); diff --git a/template-component/package.json b/template-component/package.json index 1f9ba7dc..fc2ceeca 100644 --- a/template-component/package.json +++ b/template-component/package.json @@ -15,7 +15,7 @@ "type": "module", "scripts": { "dev": "run-p -r 'dev:backend' 'dev:frontend' 'build:watch'", - "dev:backend": "convex dev --live-component-sources --typecheck-components", + "dev:backend": "convex dev --typecheck-components", "dev:frontend": "cd example && vite --clearScreen false", "predev": "npm run dev:backend -- --until-success", "clean": "rm -rf dist tsconfig.build.tsbuildinfo", @@ -42,18 +42,15 @@ "exports": { "./package.json": "./package.json", ".": { - "@convex-dev/component-source": "./src/client/index.ts", "types": "./dist/client/index.d.ts", "default": "./dist/client/index.js" }, "./react": { - "@convex-dev/component-source": "./src/react/index.ts", "types": "./dist/react/index.d.ts", "default": "./dist/react/index.js" }, "./test": "./src/test.ts", "./convex.config": { - "@convex-dev/component-source": "./src/component/convex.config.ts", "types": "./dist/component/convex.config.d.ts", "default": "./dist/component/convex.config.js" } From d69ca6323249f0d8b07aa904e8bedf858ee287b4 Mon Sep 17 00:00:00 2001 From: Ian Macartney Date: Fri, 24 Oct 2025 18:12:27 -0700 Subject: [PATCH 4/5] codegen as part of build loop --- template-component/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template-component/package.json b/template-component/package.json index fc2ceeca..8feee9a2 100644 --- a/template-component/package.json +++ b/template-component/package.json @@ -21,7 +21,7 @@ "clean": "rm -rf dist tsconfig.build.tsbuildinfo", "build": "tsc --project ./tsconfig.build.json && npm run copy:dts", "copy:dts": "rsync -a --include='*/' --include='*.d.ts' --exclude='*' src/ dist/ || cpy 'src/**/*.d.ts' 'dist/' --parents", - "build:watch": "npx chokidar 'tsconfig*.json' 'src/**/*.ts' -i '**/*.test.ts' -c 'npm run build' --initial", + "build:watch": "npx chokidar 'tsconfig*.json' 'src/**/*.ts' -i '**/*.test.ts' -c 'npx convex codegen && npm run build' --initial", "typecheck": "tsc --noEmit && tsc -p example/convex", "lint": "eslint src && eslint example/convex", "all": "run-p -r 'dev:backend' 'dev:frontend' 'build:watch' 'test:watch'", From 264e7f133cc49d74c14364faf73445873ddb0414 Mon Sep 17 00:00:00 2001 From: Ian Macartney Date: Mon, 27 Oct 2025 21:37:10 -0700 Subject: [PATCH 5/5] install sibling --- .../example/convex/_generated/api.d.ts | 17 +++++++++++++++++ .../example/convex/convex.config.ts | 2 ++ template-component/example/convex/tsconfig.json | 3 +-- 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/template-component/example/convex/_generated/api.d.ts b/template-component/example/convex/_generated/api.d.ts index 9918c619..8f99545e 100644 --- a/template-component/example/convex/_generated/api.d.ts +++ b/template-component/example/convex/_generated/api.d.ts @@ -38,6 +38,23 @@ export declare const internal: {}; export declare const components: { shardedCounter: { + lib: { + add: FunctionReference< + "mutation", + "internal", + { + count: number; + foo: number; + foo2: number; + name: string; + shards?: number; + }, + null + >; + count: FunctionReference<"query", "internal", { name: string }, number>; + }; + }; + sibling: { lib: { add: FunctionReference< "mutation", diff --git a/template-component/example/convex/convex.config.ts b/template-component/example/convex/convex.config.ts index c9144235..344d5611 100644 --- a/template-component/example/convex/convex.config.ts +++ b/template-component/example/convex/convex.config.ts @@ -1,7 +1,9 @@ import { defineApp } from "convex/server"; import shardedCounter from "@example/sharded-counter/convex.config"; +import sibling from "../../src/component/convex.config.js"; const app = defineApp(); app.use(shardedCounter); +app.use(sibling, { name: "sibling" }); export default app; diff --git a/template-component/example/convex/tsconfig.json b/template-component/example/convex/tsconfig.json index 4bfd29bf..7dbd9fb5 100644 --- a/template-component/example/convex/tsconfig.json +++ b/template-component/example/convex/tsconfig.json @@ -20,6 +20,5 @@ "isolatedModules": true, "noEmit": true }, - "include": ["./**/*"], - "exclude": ["./_generated"] + "include": ["."] }