convex 1.40.0 → 1.41.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/browser.bundle.js +1 -1
- package/dist/browser.bundle.js.map +1 -1
- package/dist/cjs/cli/aiFiles.js +2 -2
- package/dist/cjs/cli/aiFiles.js.map +1 -1
- package/dist/cjs/cli/configure.js +1 -4
- package/dist/cjs/cli/configure.js.map +2 -2
- package/dist/cjs/cli/convexExport.js +3 -3
- package/dist/cjs/cli/convexExport.js.map +1 -1
- package/dist/cjs/cli/convexImport.js +2 -2
- package/dist/cjs/cli/convexImport.js.map +1 -1
- package/dist/cjs/cli/dashboard.js +19 -6
- package/dist/cjs/cli/dashboard.js.map +3 -3
- package/dist/cjs/cli/data.js +2 -2
- package/dist/cjs/cli/data.js.map +1 -1
- package/dist/cjs/cli/deploy.js +5 -5
- package/dist/cjs/cli/deploy.js.map +2 -2
- package/dist/cjs/cli/deploymentCreate.js +11 -5
- package/dist/cjs/cli/deploymentCreate.js.map +2 -2
- package/dist/cjs/cli/deploymentSelect.js +5 -5
- package/dist/cjs/cli/deploymentSelect.js.map +1 -1
- package/dist/cjs/cli/deploymentTokenCreate.js +5 -13
- package/dist/cjs/cli/deploymentTokenCreate.js.map +2 -2
- package/dist/cjs/cli/deploymentTokenDelete.js +4 -11
- package/dist/cjs/cli/deploymentTokenDelete.js.map +2 -2
- package/dist/cjs/cli/dev.js +6 -5
- package/dist/cjs/cli/dev.js.map +2 -2
- package/dist/cjs/cli/env.js +16 -16
- package/dist/cjs/cli/env.js.map +2 -2
- package/dist/cjs/cli/envDefault.js +10 -10
- package/dist/cjs/cli/envDefault.js.map +1 -1
- package/dist/cjs/cli/insights.js +3 -3
- package/dist/cjs/cli/insights.js.map +1 -1
- package/dist/cjs/cli/lib/aiFiles/skills.js +2 -2
- package/dist/cjs/cli/lib/aiFiles/skills.js.map +2 -2
- package/dist/cjs/cli/lib/command.js +1 -1
- package/dist/cjs/cli/lib/command.js.map +1 -1
- package/dist/cjs/cli/lib/deployment.js.map +1 -1
- package/dist/cjs/cli/lib/deploymentSelection.js +39 -0
- package/dist/cjs/cli/lib/deploymentSelection.js.map +2 -2
- package/dist/cjs/cli/lib/dev.js +31 -0
- package/dist/cjs/cli/lib/dev.js.map +2 -2
- package/dist/cjs/cli/lib/generateDocs.js +256 -0
- package/dist/cjs/cli/lib/generateDocs.js.map +7 -0
- package/dist/cjs/cli/lib/localDeployment/anonymous.js +24 -49
- package/dist/cjs/cli/lib/localDeployment/anonymous.js.map +3 -3
- package/dist/cjs/cli/lib/localDeployment/bigBrain.js +0 -9
- package/dist/cjs/cli/lib/localDeployment/bigBrain.js.map +2 -2
- package/dist/cjs/cli/lib/localDeployment/dashboard.js +30 -68
- package/dist/cjs/cli/lib/localDeployment/dashboard.js.map +2 -2
- package/dist/cjs/cli/lib/localDeployment/download.js +14 -1
- package/dist/cjs/cli/lib/localDeployment/download.js.map +2 -2
- package/dist/cjs/cli/lib/localDeployment/filePaths.js +33 -4
- package/dist/cjs/cli/lib/localDeployment/filePaths.js.map +2 -2
- package/dist/cjs/cli/lib/localDeployment/localDeployment.js +37 -126
- package/dist/cjs/cli/lib/localDeployment/localDeployment.js.map +3 -3
- package/dist/cjs/cli/lib/localDeployment/secrets.js +91 -0
- package/dist/cjs/cli/lib/localDeployment/secrets.js.map +7 -0
- package/dist/cjs/cli/lib/localDeployment/upgrade.js +43 -28
- package/dist/cjs/cli/lib/localDeployment/upgrade.js.map +3 -3
- package/dist/cjs/cli/lib/localDeployment/utils.js +0 -19
- package/dist/cjs/cli/lib/localDeployment/utils.js.map +3 -3
- package/dist/cjs/cli/lib/runTestFunction.js +3 -3
- package/dist/cjs/cli/lib/runTestFunction.js.map +1 -1
- package/dist/cjs/cli/run.js +5 -5
- package/dist/cjs/cli/run.js.map +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/server/impl/registration_impl.js +0 -1
- package/dist/cjs/server/impl/registration_impl.js.map +2 -2
- package/dist/cjs/server/index.js.map +2 -2
- package/dist/cjs/server/meta.js.map +1 -1
- package/dist/cjs/server/registration.js.map +1 -1
- package/dist/cjs-types/cli/configure.d.ts +3 -2
- package/dist/cjs-types/cli/configure.d.ts.map +1 -1
- package/dist/cjs-types/cli/dashboard.d.ts.map +1 -1
- package/dist/cjs-types/cli/deploymentCreate.d.ts.map +1 -1
- package/dist/cjs-types/cli/deploymentTokenCreate.d.ts.map +1 -1
- package/dist/cjs-types/cli/deploymentTokenDelete.d.ts.map +1 -1
- package/dist/cjs-types/cli/dev.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/deployApi/definitionConfig.d.ts +4 -4
- package/dist/cjs-types/cli/lib/deployApi/startPush.d.ts +16 -16
- package/dist/cjs-types/cli/lib/deployment.d.ts +0 -2
- package/dist/cjs-types/cli/lib/deployment.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/deploymentSelection.d.ts +7 -0
- package/dist/cjs-types/cli/lib/deploymentSelection.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/dev.d.ts +2 -1
- package/dist/cjs-types/cli/lib/dev.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/generateDocs.d.ts +20 -0
- package/dist/cjs-types/cli/lib/generateDocs.d.ts.map +1 -0
- package/dist/cjs-types/cli/lib/generateDocs.test.d.ts +2 -0
- package/dist/cjs-types/cli/lib/generateDocs.test.d.ts.map +1 -0
- package/dist/cjs-types/cli/lib/localDeployment/anonymous.d.ts +1 -1
- package/dist/cjs-types/cli/lib/localDeployment/anonymous.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/localDeployment/bigBrain.d.ts +2 -4
- package/dist/cjs-types/cli/lib/localDeployment/bigBrain.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/localDeployment/dashboard.d.ts +9 -4
- package/dist/cjs-types/cli/lib/localDeployment/dashboard.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/localDeployment/download.d.ts +11 -1
- package/dist/cjs-types/cli/lib/localDeployment/download.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/localDeployment/filePaths.d.ts +16 -5
- package/dist/cjs-types/cli/lib/localDeployment/filePaths.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/localDeployment/localDeployment.d.ts +1 -9
- package/dist/cjs-types/cli/lib/localDeployment/localDeployment.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/localDeployment/secrets.d.ts +31 -0
- package/dist/cjs-types/cli/lib/localDeployment/secrets.d.ts.map +1 -0
- package/dist/cjs-types/cli/lib/localDeployment/secrets.test.d.ts +2 -0
- package/dist/cjs-types/cli/lib/localDeployment/secrets.test.d.ts.map +1 -0
- package/dist/cjs-types/cli/lib/localDeployment/upgrade.d.ts +6 -3
- package/dist/cjs-types/cli/lib/localDeployment/upgrade.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/localDeployment/utils.d.ts +0 -2
- package/dist/cjs-types/cli/lib/localDeployment/utils.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/versionApi.d.ts +2 -2
- package/dist/cjs-types/index.d.ts +1 -1
- package/dist/cjs-types/server/impl/registration_impl.d.ts.map +1 -1
- package/dist/cjs-types/server/index.d.ts +1 -1
- package/dist/cjs-types/server/index.d.ts.map +1 -1
- package/dist/cjs-types/server/meta.d.ts +16 -0
- package/dist/cjs-types/server/meta.d.ts.map +1 -1
- package/dist/cjs-types/server/registration.d.ts +11 -5
- package/dist/cjs-types/server/registration.d.ts.map +1 -1
- package/dist/cli.bundle.cjs +66405 -67923
- package/dist/cli.bundle.cjs.map +4 -4
- package/dist/esm/cli/aiFiles.js +2 -2
- package/dist/esm/cli/aiFiles.js.map +1 -1
- package/dist/esm/cli/configure.js +1 -4
- package/dist/esm/cli/configure.js.map +2 -2
- package/dist/esm/cli/convexExport.js +3 -3
- package/dist/esm/cli/convexExport.js.map +1 -1
- package/dist/esm/cli/convexImport.js +2 -2
- package/dist/esm/cli/convexImport.js.map +1 -1
- package/dist/esm/cli/dashboard.js +16 -3
- package/dist/esm/cli/dashboard.js.map +2 -2
- package/dist/esm/cli/data.js +2 -2
- package/dist/esm/cli/data.js.map +1 -1
- package/dist/esm/cli/deploy.js +5 -5
- package/dist/esm/cli/deploy.js.map +2 -2
- package/dist/esm/cli/deploymentCreate.js +13 -9
- package/dist/esm/cli/deploymentCreate.js.map +2 -2
- package/dist/esm/cli/deploymentSelect.js +5 -5
- package/dist/esm/cli/deploymentSelect.js.map +1 -1
- package/dist/esm/cli/deploymentTokenCreate.js +9 -15
- package/dist/esm/cli/deploymentTokenCreate.js.map +2 -2
- package/dist/esm/cli/deploymentTokenDelete.js +8 -16
- package/dist/esm/cli/deploymentTokenDelete.js.map +2 -2
- package/dist/esm/cli/dev.js +6 -5
- package/dist/esm/cli/dev.js.map +2 -2
- package/dist/esm/cli/env.js +16 -16
- package/dist/esm/cli/env.js.map +2 -2
- package/dist/esm/cli/envDefault.js +10 -10
- package/dist/esm/cli/envDefault.js.map +1 -1
- package/dist/esm/cli/insights.js +3 -3
- package/dist/esm/cli/insights.js.map +1 -1
- package/dist/esm/cli/lib/aiFiles/skills.js +2 -2
- package/dist/esm/cli/lib/aiFiles/skills.js.map +2 -2
- package/dist/esm/cli/lib/command.js +1 -1
- package/dist/esm/cli/lib/command.js.map +1 -1
- package/dist/esm/cli/lib/deployment.js.map +1 -1
- package/dist/esm/cli/lib/deploymentSelection.js +38 -0
- package/dist/esm/cli/lib/deploymentSelection.js.map +2 -2
- package/dist/esm/cli/lib/dev.js +31 -0
- package/dist/esm/cli/lib/dev.js.map +2 -2
- package/dist/esm/cli/lib/generateDocs.js +233 -0
- package/dist/esm/cli/lib/generateDocs.js.map +7 -0
- package/dist/esm/cli/lib/localDeployment/anonymous.js +30 -61
- package/dist/esm/cli/lib/localDeployment/anonymous.js.map +3 -3
- package/dist/esm/cli/lib/localDeployment/bigBrain.js +0 -8
- package/dist/esm/cli/lib/localDeployment/bigBrain.js.map +2 -2
- package/dist/esm/cli/lib/localDeployment/dashboard.js +36 -69
- package/dist/esm/cli/lib/localDeployment/dashboard.js.map +2 -2
- package/dist/esm/cli/lib/localDeployment/download.js +15 -2
- package/dist/esm/cli/lib/localDeployment/download.js.map +2 -2
- package/dist/esm/cli/lib/localDeployment/filePaths.js +29 -2
- package/dist/esm/cli/lib/localDeployment/filePaths.js.map +2 -2
- package/dist/esm/cli/lib/localDeployment/localDeployment.js +40 -134
- package/dist/esm/cli/lib/localDeployment/localDeployment.js.map +3 -3
- package/dist/esm/cli/lib/localDeployment/secrets.js +57 -0
- package/dist/esm/cli/lib/localDeployment/secrets.js.map +7 -0
- package/dist/esm/cli/lib/localDeployment/upgrade.js +45 -28
- package/dist/esm/cli/lib/localDeployment/upgrade.js.map +3 -3
- package/dist/esm/cli/lib/localDeployment/utils.js +0 -7
- package/dist/esm/cli/lib/localDeployment/utils.js.map +2 -2
- package/dist/esm/cli/lib/runTestFunction.js +3 -3
- package/dist/esm/cli/lib/runTestFunction.js.map +1 -1
- package/dist/esm/cli/run.js +5 -5
- package/dist/esm/cli/run.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/server/impl/registration_impl.js +0 -1
- package/dist/esm/server/impl/registration_impl.js.map +2 -2
- package/dist/esm/server/index.js.map +2 -2
- package/dist/esm-types/cli/configure.d.ts +3 -2
- package/dist/esm-types/cli/configure.d.ts.map +1 -1
- package/dist/esm-types/cli/dashboard.d.ts.map +1 -1
- package/dist/esm-types/cli/deploymentCreate.d.ts.map +1 -1
- package/dist/esm-types/cli/deploymentTokenCreate.d.ts.map +1 -1
- package/dist/esm-types/cli/deploymentTokenDelete.d.ts.map +1 -1
- package/dist/esm-types/cli/dev.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/deployApi/definitionConfig.d.ts +4 -4
- package/dist/esm-types/cli/lib/deployApi/startPush.d.ts +16 -16
- package/dist/esm-types/cli/lib/deployment.d.ts +0 -2
- package/dist/esm-types/cli/lib/deployment.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/deploymentSelection.d.ts +7 -0
- package/dist/esm-types/cli/lib/deploymentSelection.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/dev.d.ts +2 -1
- package/dist/esm-types/cli/lib/dev.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/generateDocs.d.ts +20 -0
- package/dist/esm-types/cli/lib/generateDocs.d.ts.map +1 -0
- package/dist/esm-types/cli/lib/generateDocs.test.d.ts +2 -0
- package/dist/esm-types/cli/lib/generateDocs.test.d.ts.map +1 -0
- package/dist/esm-types/cli/lib/localDeployment/anonymous.d.ts +1 -1
- package/dist/esm-types/cli/lib/localDeployment/anonymous.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/localDeployment/bigBrain.d.ts +2 -4
- package/dist/esm-types/cli/lib/localDeployment/bigBrain.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/localDeployment/dashboard.d.ts +9 -4
- package/dist/esm-types/cli/lib/localDeployment/dashboard.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/localDeployment/download.d.ts +11 -1
- package/dist/esm-types/cli/lib/localDeployment/download.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/localDeployment/filePaths.d.ts +16 -5
- package/dist/esm-types/cli/lib/localDeployment/filePaths.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/localDeployment/localDeployment.d.ts +1 -9
- package/dist/esm-types/cli/lib/localDeployment/localDeployment.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/localDeployment/secrets.d.ts +31 -0
- package/dist/esm-types/cli/lib/localDeployment/secrets.d.ts.map +1 -0
- package/dist/esm-types/cli/lib/localDeployment/secrets.test.d.ts +2 -0
- package/dist/esm-types/cli/lib/localDeployment/secrets.test.d.ts.map +1 -0
- package/dist/esm-types/cli/lib/localDeployment/upgrade.d.ts +6 -3
- package/dist/esm-types/cli/lib/localDeployment/upgrade.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/localDeployment/utils.d.ts +0 -2
- package/dist/esm-types/cli/lib/localDeployment/utils.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/versionApi.d.ts +2 -2
- package/dist/esm-types/index.d.ts +1 -1
- package/dist/esm-types/server/impl/registration_impl.d.ts.map +1 -1
- package/dist/esm-types/server/index.d.ts +1 -1
- package/dist/esm-types/server/index.d.ts.map +1 -1
- package/dist/esm-types/server/meta.d.ts +16 -0
- package/dist/esm-types/server/meta.d.ts.map +1 -1
- package/dist/esm-types/server/registration.d.ts +11 -5
- package/dist/esm-types/server/registration.d.ts.map +1 -1
- package/dist/react.bundle.js +1 -1
- package/dist/react.bundle.js.map +1 -1
- package/package.json +4 -2
- package/src/browser/sync/request_manager.test.ts +2 -2
- package/src/cli/aiFiles.ts +2 -2
- package/src/cli/configure.ts +4 -6
- package/src/cli/convexExport.ts +3 -3
- package/src/cli/convexImport.ts +2 -2
- package/src/cli/dashboard.ts +29 -3
- package/src/cli/data.ts +2 -2
- package/src/cli/deploy.ts +5 -5
- package/src/cli/deploymentCreate.test.ts +151 -24
- package/src/cli/deploymentCreate.ts +21 -11
- package/src/cli/deploymentSelect.ts +5 -5
- package/src/cli/deploymentSelection.test.ts +0 -3
- package/src/cli/deploymentToken.test.ts +34 -23
- package/src/cli/deploymentTokenCreate.ts +9 -21
- package/src/cli/deploymentTokenDelete.ts +8 -23
- package/src/cli/dev.ts +5 -4
- package/src/cli/env.ts +16 -16
- package/src/cli/envDefault.ts +10 -10
- package/src/cli/insights.ts +3 -3
- package/src/cli/lib/aiFiles/integration.test.ts +2 -0
- package/src/cli/lib/aiFiles/skills.ts +3 -3
- package/src/cli/lib/command.ts +2 -2
- package/src/cli/lib/deployment.ts +0 -5
- package/src/cli/lib/deploymentSelection.ts +67 -0
- package/src/cli/lib/dev.ts +39 -0
- package/src/cli/lib/generateDocs.test.ts +326 -0
- package/src/cli/lib/generateDocs.ts +393 -0
- package/src/cli/lib/localDeployment/anonymous.ts +48 -72
- package/src/cli/lib/localDeployment/bigBrain.ts +7 -15
- package/src/cli/lib/localDeployment/dashboard.ts +48 -80
- package/src/cli/lib/localDeployment/download.ts +34 -3
- package/src/cli/lib/localDeployment/filePaths.ts +66 -6
- package/src/cli/lib/localDeployment/localDeployment.ts +46 -184
- package/src/cli/lib/localDeployment/run.test.ts +6 -6
- package/src/cli/lib/localDeployment/secrets.test.ts +53 -0
- package/src/cli/lib/localDeployment/secrets.ts +93 -0
- package/src/cli/lib/localDeployment/tests/keygenFailure.mjs +9 -0
- package/src/cli/lib/localDeployment/tests/keygenSuccess.mjs +31 -0
- package/src/cli/lib/localDeployment/upgrade.ts +52 -38
- package/src/cli/lib/localDeployment/utils.ts +0 -10
- package/src/cli/lib/runTestFunction.ts +3 -3
- package/src/cli/run.ts +5 -5
- package/src/index.ts +1 -1
- package/src/server/impl/registration_impl.ts +0 -2
- package/src/server/index.ts +1 -0
- package/src/server/meta.ts +17 -0
- package/src/server/registration.test.ts +2 -35
- package/src/server/registration.ts +10 -19
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
import type { CommandUnknownOpts } from "@commander-js/extra-typings";
|
|
2
|
+
|
|
3
|
+
export type GeneratedDocs = Record<string, string>;
|
|
4
|
+
|
|
5
|
+
type CommandInfo = {
|
|
6
|
+
command: CommandUnknownOpts;
|
|
7
|
+
// Full path of command names from the root, e.g. ["convex", "env", "set"].
|
|
8
|
+
path: string[];
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Generate Markdown reference docs for a Commander main command.
|
|
13
|
+
*
|
|
14
|
+
* Returns a map of file paths (relative, e.g. `env.mdx`) to Markdown
|
|
15
|
+
* contents. One file is generated for each visible main command (a direct
|
|
16
|
+
* child of the root); the root itself gets no page, so "Command Reference"
|
|
17
|
+
* is a sidebar section with no landing page. Descendant subcommands are
|
|
18
|
+
* rendered as sections inside their main command's file, with their heading
|
|
19
|
+
* level reflecting their depth: a direct subcommand (`env default`) is an
|
|
20
|
+
* `## h2`, a sub-subcommand (`env default set`) an `### h3`, and so on.
|
|
21
|
+
*
|
|
22
|
+
* Each page carries a `description` frontmatter equal to the command's
|
|
23
|
+
* summary; the `/cli` page reads these back via Docusaurus metadata to render
|
|
24
|
+
* the list of commands dynamically.
|
|
25
|
+
*/
|
|
26
|
+
export function generateDocs(root: CommandUnknownOpts): GeneratedDocs {
|
|
27
|
+
const docs: GeneratedDocs = {};
|
|
28
|
+
const all = collectCommands(root, [root.name()]);
|
|
29
|
+
|
|
30
|
+
let mainCommandPosition = 0;
|
|
31
|
+
for (const entry of all) {
|
|
32
|
+
// Skip the root command (no landing page) and any descendant beyond a
|
|
33
|
+
// main command (those are rendered inside their main command's file).
|
|
34
|
+
if (entry.path.length !== 2) continue;
|
|
35
|
+
const filePath = `${entry.path[1]}.mdx`;
|
|
36
|
+
const sidebarPosition = ++mainCommandPosition;
|
|
37
|
+
const summary =
|
|
38
|
+
entry.command.summary() || entry.command.description() || "";
|
|
39
|
+
// Collapse to a single line so it's a valid YAML frontmatter scalar, and
|
|
40
|
+
// quote it safely (summaries contain `[BETA]`, `:`, etc.).
|
|
41
|
+
const description = JSON.stringify(summary.replace(/\s+/g, " ").trim());
|
|
42
|
+
|
|
43
|
+
const lines: string[] = [];
|
|
44
|
+
const sidebarLabel = `npx ${entry.path.join(" ")}`;
|
|
45
|
+
lines.push("---");
|
|
46
|
+
lines.push(`sidebar_position: ${sidebarPosition}`);
|
|
47
|
+
// Set an explicit `title` so the Docusaurus <title> (and browser tab) reads
|
|
48
|
+
// the full command, e.g. `npx convex dev | …`. Without it Docusaurus
|
|
49
|
+
// derives the title from the doc id (the file name), which would be just
|
|
50
|
+
// `dev`.
|
|
51
|
+
lines.push(`title: "${sidebarLabel}"`);
|
|
52
|
+
lines.push(`sidebar_label: "${sidebarLabel}"`);
|
|
53
|
+
lines.push(`description: ${description}`);
|
|
54
|
+
lines.push("---");
|
|
55
|
+
lines.push("");
|
|
56
|
+
lines.push(
|
|
57
|
+
"{/* @generated from the command definitions, do not edit manually (run `just regenerate-cli-docs` to regenerate) */}",
|
|
58
|
+
);
|
|
59
|
+
lines.push("");
|
|
60
|
+
lines.push(renderCommand(entry, all, { headingLevel: 1 }));
|
|
61
|
+
|
|
62
|
+
const descendants = all.filter(
|
|
63
|
+
(e) =>
|
|
64
|
+
e.path.length > entry.path.length &&
|
|
65
|
+
entry.path.every((p, i) => e.path[i] === p),
|
|
66
|
+
);
|
|
67
|
+
for (const d of descendants) {
|
|
68
|
+
// Render the heading hierarchically by depth below the root: a direct
|
|
69
|
+
// subcommand (`env default`, path length 3) is an h2, a sub-subcommand
|
|
70
|
+
// (`env default set`, path length 4) is an h3, and so on. This nests
|
|
71
|
+
// sub-subcommands under their parent group instead of flattening every
|
|
72
|
+
// descendant to the same h2 level.
|
|
73
|
+
lines.push(
|
|
74
|
+
renderCommand(d, all, {
|
|
75
|
+
headingLevel: d.path.length - 1,
|
|
76
|
+
includeSubcommandsList: false,
|
|
77
|
+
}),
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
docs[filePath] = lines.join("\n");
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return docs;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function collectCommands(
|
|
88
|
+
command: CommandUnknownOpts,
|
|
89
|
+
path: string[],
|
|
90
|
+
): CommandInfo[] {
|
|
91
|
+
const result: CommandInfo[] = [{ command, path }];
|
|
92
|
+
for (const sub of command.commands) {
|
|
93
|
+
// Skip hidden commands and Commander's built-in help command.
|
|
94
|
+
if ((sub as any)._hidden) continue;
|
|
95
|
+
if (sub.name() === "help") continue;
|
|
96
|
+
result.push(...collectCommands(sub, [...path, sub.name()]));
|
|
97
|
+
}
|
|
98
|
+
return result;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function displayName(path: string[]): string {
|
|
102
|
+
return `npx ${path.join(" ")}`;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Build the usage suffix (everything after the command name) for the Usage
|
|
106
|
+
// code block. We derive the argument portion from the command's registered
|
|
107
|
+
// arguments rather than trusting a manual `.usage()` override, so the Usage
|
|
108
|
+
// line always agrees with the Arguments section below. For example `env set`
|
|
109
|
+
// overrides `.usage()` to show `<name> <value>` (pretending the args are
|
|
110
|
+
// required) for nicer `--help` output, even though it registers them as
|
|
111
|
+
// optional `[name] [value]`; reproducing the override verbatim would make the
|
|
112
|
+
// generated page contradict itself. Commands with no registered arguments keep
|
|
113
|
+
// their `.usage()` string verbatim (e.g. the root's `<command> [options]`).
|
|
114
|
+
function commandUsage(command: CommandUnknownOpts): string {
|
|
115
|
+
const args = (command as any).registeredArguments ?? [];
|
|
116
|
+
if (args.length === 0) {
|
|
117
|
+
return command.usage();
|
|
118
|
+
}
|
|
119
|
+
// Mirror Commander's default usage order: options, then a subcommand
|
|
120
|
+
// placeholder, then the positional arguments. `[options]` is always present
|
|
121
|
+
// because the built-in `--help` option is always registered.
|
|
122
|
+
const parts = ["[options]"];
|
|
123
|
+
if (command.commands.length > 0) {
|
|
124
|
+
parts.push("[command]");
|
|
125
|
+
}
|
|
126
|
+
for (const arg of args) {
|
|
127
|
+
const name = `${arg._name}${arg.variadic ? "..." : ""}`;
|
|
128
|
+
parts.push(arg.required ? `<${name}>` : `[${name}]`);
|
|
129
|
+
}
|
|
130
|
+
return parts.join(" ");
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// Anchor id for a descendant command rendered as an h2 section inside its
|
|
134
|
+
// main command's file. Built from the path segments below the main command,
|
|
135
|
+
// joined with `-`, so sub-subcommands stay unique. For example, both
|
|
136
|
+
// `deployment create` and `deployment token create` would collide on `#create`
|
|
137
|
+
// if we used only the leaf name; instead they become `#create` and
|
|
138
|
+
// `#token-create`.
|
|
139
|
+
function anchorSlug(path: string[]): string {
|
|
140
|
+
return path.slice(2).join("-");
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// Link target for a subcommand listed inside a command's "Subcommands"
|
|
144
|
+
// section. From the root index, main commands live in sibling files. From a
|
|
145
|
+
// main command page, descendants are rendered as h2 sections in the same
|
|
146
|
+
// file, anchored by their path below the main command.
|
|
147
|
+
function subcommandLink(parentPath: string[], subPath: string[]): string {
|
|
148
|
+
if (parentPath.length === 1) {
|
|
149
|
+
return `./${subPath[1]}`;
|
|
150
|
+
}
|
|
151
|
+
return `#${anchorSlug(subPath)}`;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function renderCommand(
|
|
155
|
+
entry: CommandInfo,
|
|
156
|
+
all: CommandInfo[],
|
|
157
|
+
options: { headingLevel: number; includeSubcommandsList?: boolean },
|
|
158
|
+
): string {
|
|
159
|
+
const { headingLevel, includeSubcommandsList = true } = options;
|
|
160
|
+
const h1 = "#".repeat(headingLevel);
|
|
161
|
+
const h2 = "#".repeat(headingLevel + 1);
|
|
162
|
+
|
|
163
|
+
const { command, path } = entry;
|
|
164
|
+
const display = displayName(path);
|
|
165
|
+
const description = renderCopyableCommands(
|
|
166
|
+
escapeMdx(
|
|
167
|
+
formatExampleLines(
|
|
168
|
+
replaceBullets(command.description() || command.summary() || ""),
|
|
169
|
+
),
|
|
170
|
+
),
|
|
171
|
+
);
|
|
172
|
+
|
|
173
|
+
const lines: string[] = [];
|
|
174
|
+
// For nested subcommand sections, pin the heading id to the path below the
|
|
175
|
+
// main command so anchors like `#set` and `#token-create` stay unique even
|
|
176
|
+
// when leaf names collide across different parents.
|
|
177
|
+
const headingSuffix = headingLevel > 1 ? ` \\{#${anchorSlug(path)}}` : "";
|
|
178
|
+
lines.push(`${h1} \`${display}\`${headingSuffix}`);
|
|
179
|
+
lines.push("");
|
|
180
|
+
if (description) {
|
|
181
|
+
lines.push(description);
|
|
182
|
+
lines.push("");
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
const usage = commandUsage(command);
|
|
186
|
+
lines.push(`${h2} Usage`);
|
|
187
|
+
lines.push("");
|
|
188
|
+
lines.push("```sh");
|
|
189
|
+
lines.push(`${display} ${usage}`.trim());
|
|
190
|
+
lines.push("```");
|
|
191
|
+
lines.push("");
|
|
192
|
+
|
|
193
|
+
const aliases = command.aliases();
|
|
194
|
+
if (aliases.length > 0) {
|
|
195
|
+
lines.push(`${h2} Aliases`);
|
|
196
|
+
lines.push("");
|
|
197
|
+
for (const alias of aliases) {
|
|
198
|
+
lines.push(`- \`${alias}\``);
|
|
199
|
+
}
|
|
200
|
+
lines.push("");
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
const args = (command as any).registeredArguments ?? [];
|
|
204
|
+
if (args.length > 0) {
|
|
205
|
+
lines.push(`${h2} Arguments`);
|
|
206
|
+
lines.push("");
|
|
207
|
+
lines.push("<dl>");
|
|
208
|
+
for (const arg of args) {
|
|
209
|
+
const name = arg.required ? `<${arg._name}>` : `[${arg._name}]`;
|
|
210
|
+
const desc = escapeMdx(replaceBullets(arg.description || ""));
|
|
211
|
+
lines.push(`<dt>\`${name}\`</dt>`);
|
|
212
|
+
lines.push(`<dd>`);
|
|
213
|
+
lines.push("");
|
|
214
|
+
lines.push(desc);
|
|
215
|
+
lines.push("");
|
|
216
|
+
lines.push(`</dd>`);
|
|
217
|
+
}
|
|
218
|
+
lines.push("</dl>");
|
|
219
|
+
lines.push("");
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
const opts = command.options.filter((o: any) => !o.hidden);
|
|
223
|
+
if (opts.length > 0) {
|
|
224
|
+
lines.push(`${h2} Options`);
|
|
225
|
+
lines.push("");
|
|
226
|
+
lines.push("<dl>");
|
|
227
|
+
for (const opt of opts) {
|
|
228
|
+
const flags = (opt as any).flags as string;
|
|
229
|
+
const desc = escapeMdx(replaceBullets(opt.description || ""));
|
|
230
|
+
lines.push(`<dt>\`${flags}\`</dt>`);
|
|
231
|
+
lines.push(`<dd>`);
|
|
232
|
+
lines.push("");
|
|
233
|
+
lines.push(desc);
|
|
234
|
+
lines.push("");
|
|
235
|
+
lines.push(`</dd>`);
|
|
236
|
+
}
|
|
237
|
+
lines.push("</dl>");
|
|
238
|
+
lines.push("");
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
if (includeSubcommandsList) {
|
|
242
|
+
const subEntries = all.filter(
|
|
243
|
+
(e) =>
|
|
244
|
+
e.path.length === path.length + 1 &&
|
|
245
|
+
path.every((p, i) => e.path[i] === p),
|
|
246
|
+
);
|
|
247
|
+
if (subEntries.length > 0) {
|
|
248
|
+
lines.push(`${h2} Subcommands`);
|
|
249
|
+
lines.push("");
|
|
250
|
+
for (const sub of subEntries) {
|
|
251
|
+
const subDisplay = displayName(sub.path);
|
|
252
|
+
const target = subcommandLink(path, sub.path);
|
|
253
|
+
const subDesc = indentContinuation(
|
|
254
|
+
escapeMdx(sub.command.summary() || sub.command.description() || ""),
|
|
255
|
+
);
|
|
256
|
+
lines.push(`- [\`${subDisplay}\`](${target}) — ${subDesc}`.trimEnd());
|
|
257
|
+
}
|
|
258
|
+
lines.push("");
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
return lines.join("\n");
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// Escape characters that MDX would otherwise parse as JSX. Backslash-escaping
|
|
266
|
+
// `<` and `{` keeps placeholder text like `<team_slug>` rendering as literal
|
|
267
|
+
// text instead of being interpreted as a tag or expression.
|
|
268
|
+
//
|
|
269
|
+
// MDX only parses `<` and `{` specially in prose — inside an inline code span
|
|
270
|
+
// (backticks) both are already literal, and a backslash there renders verbatim
|
|
271
|
+
// (e.g. `` `\<nameOrToken>` `` shows the backslash). So leave code spans
|
|
272
|
+
// untouched and escape only the surrounding prose.
|
|
273
|
+
function escapeMdx(text: string): string {
|
|
274
|
+
return text
|
|
275
|
+
.split(/(`[^`]*`)/)
|
|
276
|
+
.map((segment, i) =>
|
|
277
|
+
// Odd indices are the captured code spans; even indices are prose.
|
|
278
|
+
i % 2 === 1 ? segment : segment.replace(/[<{]/g, (c) => `\\${c}`),
|
|
279
|
+
)
|
|
280
|
+
.join("");
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
// Turn inline code spans that are full `npx convex ...` commands into a
|
|
284
|
+
// CodeWithCopyButton component so readers can copy them with one click. The
|
|
285
|
+
// component is registered globally in the docs site's MDXComponents, so no
|
|
286
|
+
// import is needed in the generated page. This runs after escapeMdx, which
|
|
287
|
+
// leaves code spans verbatim, so the command text inside the backticks is
|
|
288
|
+
// unescaped and drops straight into the `text` attribute.
|
|
289
|
+
//
|
|
290
|
+
// We pass the command as a JSX expression containing a JSON-encoded string
|
|
291
|
+
// (`text={"..."}`) rather than a plain attribute (`text="..."`) because
|
|
292
|
+
// commands routinely contain double quotes (e.g. JSON arguments like
|
|
293
|
+
// `'{"body": "hello"}'`), which would otherwise terminate the attribute value
|
|
294
|
+
// and produce invalid MDX. JSON.stringify escapes quotes and backslashes for
|
|
295
|
+
// us.
|
|
296
|
+
function renderCopyableCommands(text: string): string {
|
|
297
|
+
return text
|
|
298
|
+
.split("\n")
|
|
299
|
+
.map((line) =>
|
|
300
|
+
/^- /.test(line)
|
|
301
|
+
? line.replace(
|
|
302
|
+
/`(npx convex [^`]*)`/g,
|
|
303
|
+
(_, command) =>
|
|
304
|
+
`<CodeWithCopyButton text={${JSON.stringify(command)}} />`,
|
|
305
|
+
)
|
|
306
|
+
: line,
|
|
307
|
+
)
|
|
308
|
+
.join("\n");
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
// Replace "•" bullet points with markdown "-" bullet points. Every line that is
|
|
312
|
+
// (maybe leading spaces +) "• " becomes the same spaces + "- ". This runs before
|
|
313
|
+
// formatExampleLines and renderCopyableCommands so that `npx convex ...` commands
|
|
314
|
+
// in bulleted help text are recognized as list items and get a copy button.
|
|
315
|
+
export function replaceBullets(text: string): string {
|
|
316
|
+
return text.replace(/^( *)• /gm, "$1- ");
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
// Convert indented example lines (e.g., from CLI help text) into markdown lists
|
|
320
|
+
// so they render with proper line breaks instead of collapsing into one line.
|
|
321
|
+
// Consecutive indented lines are gathered into a block; any line indented by at
|
|
322
|
+
// least two spaces belongs to the block, regardless of how deeply it nests.
|
|
323
|
+
//
|
|
324
|
+
// How much the block is dedented depends on what precedes it:
|
|
325
|
+
// - When the block follows a list item, its indentation encodes real nesting
|
|
326
|
+
// (a sub-list under that item), so it is preserved verbatim. This keeps a
|
|
327
|
+
// 3-level list like the deploy command's preview-key description intact
|
|
328
|
+
// instead of flattening the 2-space sub-item to a top-level bullet.
|
|
329
|
+
// - When the block follows prose (or starts the text), the indentation is
|
|
330
|
+
// just help-text formatting, so the block is dedented by its smallest
|
|
331
|
+
// indent to the left margin. Otherwise an indented list wouldn't interrupt
|
|
332
|
+
// the preceding paragraph and would collapse into it.
|
|
333
|
+
function formatExampleLines(text: string): string {
|
|
334
|
+
const lines = text.split("\n");
|
|
335
|
+
const result: string[] = [];
|
|
336
|
+
let blockLines: string[] = [];
|
|
337
|
+
|
|
338
|
+
const flushBlock = () => {
|
|
339
|
+
if (blockLines.length === 0) {
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
const prev = result[result.length - 1];
|
|
343
|
+
const followsListItem = prev !== undefined && isListItem(prev);
|
|
344
|
+
const dedent = followsListItem
|
|
345
|
+
? 0
|
|
346
|
+
: Math.min(...blockLines.map(indentWidth));
|
|
347
|
+
for (const blockLine of blockLines) {
|
|
348
|
+
result.push(toListItem(blockLine.substring(dedent)));
|
|
349
|
+
}
|
|
350
|
+
blockLines = [];
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
for (const line of lines) {
|
|
354
|
+
// Any line indented by at least two spaces (and not blank) is part of an
|
|
355
|
+
// example block, regardless of nesting depth.
|
|
356
|
+
if (/^ {2,}\S/.test(line)) {
|
|
357
|
+
blockLines.push(line);
|
|
358
|
+
} else {
|
|
359
|
+
flushBlock();
|
|
360
|
+
result.push(line);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
flushBlock();
|
|
364
|
+
|
|
365
|
+
return result.join("\n");
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
function indentWidth(line: string): number {
|
|
369
|
+
return line.length - line.trimStart().length;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
function isListItem(line: string): boolean {
|
|
373
|
+
const content = line.trimStart();
|
|
374
|
+
return content.startsWith("- ") || /^\d+\.\s/.test(content);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
// Render an example line as a markdown list item, preserving any leading indent
|
|
378
|
+
// so nested items stay nested. Lines that are already list items — either a
|
|
379
|
+
// bullet (`- `) or an ordered-list item (`1. `) — are kept verbatim so they
|
|
380
|
+
// render as their intended list type. Prefixing an ordered-list item with `- `
|
|
381
|
+
// would nest it inside a bullet, which renders as roman numerals instead of the
|
|
382
|
+
// numbered steps.
|
|
383
|
+
function toListItem(line: string): string {
|
|
384
|
+
if (isListItem(line)) {
|
|
385
|
+
return line;
|
|
386
|
+
}
|
|
387
|
+
const indent = line.slice(0, indentWidth(line));
|
|
388
|
+
return `${indent}- ${line.trimStart()}`;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
function indentContinuation(text: string): string {
|
|
392
|
+
return text.replace(/\n/g, "\n ");
|
|
393
|
+
}
|
|
@@ -10,11 +10,7 @@ import {
|
|
|
10
10
|
logWarning,
|
|
11
11
|
} from "../../../bundler/log.js";
|
|
12
12
|
import { promptSearch, promptYesNo } from "../utils/prompts.js";
|
|
13
|
-
import {
|
|
14
|
-
bigBrainGenerateAdminKeyForAnonymousDeployment,
|
|
15
|
-
bigBrainPause,
|
|
16
|
-
bigBrainStart,
|
|
17
|
-
} from "./bigBrain.js";
|
|
13
|
+
import { bigBrainPause, bigBrainStart } from "./bigBrain.js";
|
|
18
14
|
import { LocalDeploymentError, printLocalDeploymentOnError } from "./errors.js";
|
|
19
15
|
import {
|
|
20
16
|
LocalDeploymentKind,
|
|
@@ -28,20 +24,12 @@ import {
|
|
|
28
24
|
} from "./filePaths.js";
|
|
29
25
|
import { rootDeploymentStateDir } from "./filePaths.js";
|
|
30
26
|
import { LocalDeploymentConfig } from "./filePaths.js";
|
|
31
|
-
import { DeploymentDetails } from "./localDeployment.js";
|
|
32
27
|
import { ensureBackendStopped, localDeploymentUrl } from "./run.js";
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
isOffline,
|
|
37
|
-
generateInstanceSecret,
|
|
38
|
-
chooseLocalBackendPorts,
|
|
39
|
-
LOCAL_BACKEND_INSTANCE_SECRET,
|
|
40
|
-
} from "./utils.js";
|
|
41
|
-
import { handleDashboard } from "./dashboard.js";
|
|
28
|
+
import { handlePotentialUpgradeAndStart } from "./upgrade.js";
|
|
29
|
+
import { chooseLocalBackendPorts } from "./utils.js";
|
|
42
30
|
import { recursivelyDelete, recursivelyCopy } from "../fsUtils.js";
|
|
43
31
|
import { ensureBackendBinaryDownloaded } from "./download.js";
|
|
44
|
-
import { isAnonymousDeployment } from "../deployment.js";
|
|
32
|
+
import { DeploymentDetails, isAnonymousDeployment } from "../deployment.js";
|
|
45
33
|
import { createProject } from "../api.js";
|
|
46
34
|
import { removeAnonymousPrefix } from "../deployment.js";
|
|
47
35
|
import { nodeFs } from "../../../bundler/fs.js";
|
|
@@ -49,6 +37,10 @@ import { doInitConvexFolder } from "../codegen.js";
|
|
|
49
37
|
import { readProjectConfig } from "../config.js";
|
|
50
38
|
import { functionsDir } from "../utils/utils.js";
|
|
51
39
|
import { attemptSetupAiFiles } from "../aiFiles/index.js";
|
|
40
|
+
import {
|
|
41
|
+
generateLocalDevSecretsWithLatestBinary,
|
|
42
|
+
LEGACY_LOCAL_BACKEND_INSTANCE_SECRET,
|
|
43
|
+
} from "./secrets.js";
|
|
52
44
|
|
|
53
45
|
export async function handleAnonymousDeployment(
|
|
54
46
|
ctx: Context,
|
|
@@ -64,14 +56,6 @@ export async function handleAnonymousDeployment(
|
|
|
64
56
|
chosenConfiguration: "new" | "existing" | "ask" | null;
|
|
65
57
|
},
|
|
66
58
|
): Promise<DeploymentDetails> {
|
|
67
|
-
if (await isOffline()) {
|
|
68
|
-
return await ctx.crash({
|
|
69
|
-
exitCode: 1,
|
|
70
|
-
errorType: "fatal",
|
|
71
|
-
printedMessage: "Cannot run a local deployment while offline",
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
|
|
75
59
|
const deployment = await chooseDeployment(ctx, {
|
|
76
60
|
deploymentName: options.deploymentName,
|
|
77
61
|
chosenConfiguration: options.chosenConfiguration,
|
|
@@ -118,13 +102,17 @@ export async function handleAnonymousDeployment(
|
|
|
118
102
|
}
|
|
119
103
|
: { kind: "version", version: options.backendVersion },
|
|
120
104
|
);
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
105
|
+
|
|
106
|
+
const existingCredentials =
|
|
107
|
+
deployment.kind === "existing"
|
|
108
|
+
? {
|
|
109
|
+
adminKey: deployment.config.adminKey,
|
|
110
|
+
instanceSecret:
|
|
111
|
+
deployment.config.instanceSecret ??
|
|
112
|
+
LEGACY_LOCAL_BACKEND_INSTANCE_SECRET,
|
|
113
|
+
}
|
|
114
|
+
: null;
|
|
124
115
|
if (deployment.kind === "existing") {
|
|
125
|
-
adminKey = deployment.config.adminKey;
|
|
126
|
-
instanceSecret =
|
|
127
|
-
deployment.config.instanceSecret ?? LOCAL_BACKEND_INSTANCE_SECRET;
|
|
128
116
|
// If it's still running for some reason, exit and tell the user to kill it.
|
|
129
117
|
// It's fine if a different backend is running on these ports though since we'll
|
|
130
118
|
// pick new ones.
|
|
@@ -136,13 +124,6 @@ export async function handleAnonymousDeployment(
|
|
|
136
124
|
deploymentName: deployment.deploymentName,
|
|
137
125
|
allowOtherDeployments: true,
|
|
138
126
|
});
|
|
139
|
-
} else {
|
|
140
|
-
instanceSecret = generateInstanceSecret();
|
|
141
|
-
const data = await bigBrainGenerateAdminKeyForAnonymousDeployment(ctx, {
|
|
142
|
-
instanceName: deployment.deploymentName,
|
|
143
|
-
instanceSecret,
|
|
144
|
-
});
|
|
145
|
-
adminKey = data.adminKey;
|
|
146
127
|
}
|
|
147
128
|
|
|
148
129
|
const { cloudPort, sitePort } = await chooseLocalBackendPorts(ctx, {
|
|
@@ -150,31 +131,25 @@ export async function handleAnonymousDeployment(
|
|
|
150
131
|
suggestedPorts:
|
|
151
132
|
deployment.kind === "existing" ? deployment.config.ports : undefined,
|
|
152
133
|
});
|
|
153
|
-
const onActivity = async (isOffline: boolean, _wasOffline: boolean) => {
|
|
154
|
-
await ensureBackendRunning(ctx, {
|
|
155
|
-
cloudPort,
|
|
156
|
-
deploymentName: deployment.deploymentName,
|
|
157
|
-
maxTimeSecs: 5,
|
|
158
|
-
});
|
|
159
|
-
if (isOffline) {
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
};
|
|
163
134
|
|
|
164
|
-
const { cleanupHandle } = await
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
135
|
+
const { cleanupHandle, adminKey } = await handlePotentialUpgradeAndStart(
|
|
136
|
+
ctx,
|
|
137
|
+
{
|
|
138
|
+
deploymentName: deployment.deploymentName,
|
|
139
|
+
deploymentKind: "anonymous",
|
|
140
|
+
oldVersion:
|
|
141
|
+
deployment.kind === "existing"
|
|
142
|
+
? deployment.config.backendVersion
|
|
143
|
+
: null,
|
|
144
|
+
newBinaryPath: binaryPath,
|
|
145
|
+
newVersion: version,
|
|
146
|
+
ports: { cloud: cloudPort, site: sitePort },
|
|
147
|
+
existingCredentials,
|
|
148
|
+
forceUpgrade: options.forceUpgrade,
|
|
149
|
+
// Anonymous deployments aren't registered against a cloud project.
|
|
150
|
+
cloudProjectId: undefined,
|
|
151
|
+
},
|
|
152
|
+
);
|
|
178
153
|
|
|
179
154
|
const cleanupFunc = ctx.removeCleanup(cleanupHandle);
|
|
180
155
|
ctx.registerCleanup(async (exitCode, err) => {
|
|
@@ -201,7 +176,6 @@ export async function handleAnonymousDeployment(
|
|
|
201
176
|
deploymentUrl: localDeploymentUrl(cloudPort),
|
|
202
177
|
reference: null,
|
|
203
178
|
isDefault: false,
|
|
204
|
-
onActivity,
|
|
205
179
|
};
|
|
206
180
|
}
|
|
207
181
|
|
|
@@ -469,16 +443,17 @@ export async function handleLinkToProject(
|
|
|
469
443
|
}
|
|
470
444
|
logVerbose(`Creating local deployment in project ${projectSlug}`);
|
|
471
445
|
// Register it in big brain
|
|
472
|
-
const {
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
446
|
+
const { deploymentName: localDeploymentName, projectId } =
|
|
447
|
+
await bigBrainStart(ctx, {
|
|
448
|
+
port: config.ports.cloud,
|
|
449
|
+
projectSlug,
|
|
450
|
+
teamSlug: args.teamSlug,
|
|
451
|
+
instanceName: null,
|
|
452
|
+
});
|
|
453
|
+
const { instanceSecret, adminKey } =
|
|
454
|
+
await generateLocalDevSecretsWithLatestBinary(ctx, {
|
|
455
|
+
deploymentName: localDeploymentName,
|
|
456
|
+
});
|
|
482
457
|
const localConfig = loadDeploymentConfig(ctx, "local", localDeploymentName);
|
|
483
458
|
if (localConfig !== null) {
|
|
484
459
|
return ctx.crash({
|
|
@@ -501,6 +476,7 @@ export async function handleLinkToProject(
|
|
|
501
476
|
);
|
|
502
477
|
logVerbose(`Saving deployment config for ${localDeploymentName}`);
|
|
503
478
|
saveDeploymentConfig(ctx, "local", localDeploymentName, {
|
|
479
|
+
instanceSecret,
|
|
504
480
|
adminKey,
|
|
505
481
|
backendVersion: config.backendVersion,
|
|
506
482
|
ports: config.ports,
|
|
@@ -10,7 +10,12 @@ export async function bigBrainStart(
|
|
|
10
10
|
teamSlug: string;
|
|
11
11
|
instanceName: string | null;
|
|
12
12
|
},
|
|
13
|
-
): Promise<{
|
|
13
|
+
): Promise<{
|
|
14
|
+
deploymentName: string;
|
|
15
|
+
/** @deprecated */
|
|
16
|
+
adminKey: string;
|
|
17
|
+
projectId: number;
|
|
18
|
+
}> {
|
|
14
19
|
return bigBrainAPI({
|
|
15
20
|
ctx,
|
|
16
21
|
method: "POST",
|
|
@@ -38,6 +43,7 @@ export async function bigBrainRecordActivity(
|
|
|
38
43
|
ctx: Context,
|
|
39
44
|
data: {
|
|
40
45
|
instanceName: string;
|
|
46
|
+
adminKey: string;
|
|
41
47
|
},
|
|
42
48
|
) {
|
|
43
49
|
return bigBrainAPI({
|
|
@@ -59,20 +65,6 @@ export async function bigBrainEnableFeatureMetadata(
|
|
|
59
65
|
});
|
|
60
66
|
}
|
|
61
67
|
|
|
62
|
-
export async function bigBrainGenerateAdminKeyForAnonymousDeployment(
|
|
63
|
-
ctx: Context,
|
|
64
|
-
data: {
|
|
65
|
-
instanceName: string;
|
|
66
|
-
instanceSecret: string;
|
|
67
|
-
},
|
|
68
|
-
) {
|
|
69
|
-
return bigBrainAPI({
|
|
70
|
-
ctx,
|
|
71
|
-
method: "POST",
|
|
72
|
-
path: "local_deployment/generate_admin_key",
|
|
73
|
-
data,
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
68
|
/** Whether a project already has a cloud dev deployment for this user. */
|
|
77
69
|
export async function projectHasExistingCloudDev(
|
|
78
70
|
ctx: Context,
|