convex
Version:
Client for the Convex Cloud
153 lines (146 loc) • 4.77 kB
JavaScript
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var clientConfig_exports = {};
__export(clientConfig_exports, {
LOCALHOST_PORT: () => LOCALHOST_PORT,
devDeploymentConfig: () => devDeploymentConfig,
prodDeploymentConfig: () => prodDeploymentConfig
});
module.exports = __toCommonJS(clientConfig_exports);
var import_common = require("./common");
const LOCALHOST_PORT = 8187;
const devDeploymentConfigJS = `
${(0, import_common.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 = `
${(0, import_common.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;
`;
const devDeploymentConfig = {
JS: devDeploymentConfigJS,
DTS: devDeploymentConfigDTS
};
const prodDeploymentConfigDTS = `
${(0, import_common.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;
`;
function prodDeploymentConfig(config) {
const prodDeploymentConfigJS = `
${(0, import_common.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