UNPKG

convex

Version:

Client for the Convex Cloud

129 lines (122 loc) 3.66 kB
"use strict"; import { header } from "./common"; export const LOCALHOST_PORT = 8187; const devDeploymentConfigJS = ` ${header("Generated development client configuration.")} /** * The DEV Convex client configuration. * * This configuration connects your client to your dev Convex deployment * when \`npx convex dev\` is running. * * To generate the production version, run \`npx convex deploy\`. * * Usage: * * \`\`\`ts * import clientConfig from "../convex/_generated/clientConfig"; * * const convex = new ConvexReactClient(clientConfig); * \`\`\` */ const clientConfig = { address: "http://localhost:${LOCALHOST_PORT}" }; export default clientConfig; `; const devDeploymentConfigDTS = ` ${header("Generated development client configuration.")} import type { ClientConfiguration } from "convex/browser"; /** * The DEV Convex client configuration. * * This configuration connects your client to your dev Convex deployment * when \`npx convex dev\` is running. * * To generate the production version, run \`npx convex deploy\`. * * Usage: * * \`\`\`ts * import clientConfig from "../convex/_generated/clientConfig"; * * const convex = new ConvexReactClient(clientConfig); * \`\`\` */ declare const clientConfig: ClientConfiguration; export default clientConfig; `; export const devDeploymentConfig = { JS: devDeploymentConfigJS, DTS: devDeploymentConfigDTS }; const prodDeploymentConfigDTS = ` ${header("Generated production client configuration.")} import type { ClientConfiguration } from "convex/browser"; /** * NOCOMMIT * * We recommend not committing this config into your main branch, because it * references your production deployment. Instead: * 1. Run \`npx convex codegen\` to generate your dev config and check * that in. * 2. When you want to deploy, run \`npx convex deploy\` first. This will * generate your production config. Then run your bundler. */ /** * The PRODUCTION Convex client configuration. * * This configuration connects your client to your production Convex deployment. * * To generate the dev version, run \`npx convex dev\` or \`npx convex codegen\`. * * Usage: * * \`\`\`ts * import clientConfig from "../convex/_generated/clientConfig"; * * const convex = new ConvexReactClient(clientConfig); * \`\`\` */ declare const clientConfig: ClientConfiguration; export default clientConfig; `; export function prodDeploymentConfig(config) { const prodDeploymentConfigJS = ` ${header("Generated production client configuration.")} /** * NOCOMMIT * * We recommend not committing this config into your main branch, because it * references your production deployment. Instead: * 1. Run \`npx convex codegen\` to generate your dev config and check * that in. * 2. When you want to deploy, run \`npx convex deploy\` first. This will * generate your production config. Then run your bundler. */ /** * The PRODUCTION Convex client configuration. * * This configuration connects your client to your production Convex deployment. * * To generate the dev version, run \`npx convex dev\` or \`npx convex codegen\`. * * Usage: * * \`\`\`ts * import clientConfig from "../convex/_generated/clientConfig"; * * const convex = new ConvexReactClient(clientConfig); * \`\`\` */ const clientConfig = { address: "${config.prodUrl}" }; export default clientConfig; `; return { JS: prodDeploymentConfigJS, DTS: prodDeploymentConfigDTS }; } //# sourceMappingURL=clientConfig.js.map