Skip to content

Commit 37942e0

Browse files
nipunn1313Convex, Inc.
authored andcommitted
Allow for an autocomplete search with project selection (#24315)
Useful if you have >5 projects - you can just start typing to narrow the list. GitOrigin-RevId: 2b31700ee0ce33744b91cea5b55713dda22c8979
1 parent a415fdc commit 37942e0

File tree

7 files changed

+150
-3
lines changed

7 files changed

+150
-3
lines changed

npm-packages/common/config/rush/pnpm-lock.yaml

Lines changed: 139 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

npm-packages/convex/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@
236236
"find-up": "^6.3.0",
237237
"http-proxy": "~1.18.1",
238238
"inquirer": "^9.1.4",
239+
"inquirer-search-list": "~1.2.6",
239240
"jest": "^29.5.0",
240241
"jest-environment-jsdom": "^29.5.0",
241242
"jwt-encode": "~1.0.1",

npm-packages/convex/scripts/test-esm.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ for (const dir of fs.readdirSync(path.join(__dirname, "../dist/esm"))) {
2424

2525
// ts-node-esm requires respects Node.js import urls (requires .js extensions)
2626
child_process.execFileSync("node_modules/.bin/ts-node-esm", [
27+
"--files",
2728
"src/cli/index.ts",
2829
"--version",
2930
]);

npm-packages/convex/src/cli/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ import { networkTest } from "./network_test.js";
2727
import { convexExport } from "./convexExport.js";
2828
import { env } from "./env.js";
2929
import { data } from "./data.js";
30+
import inquirer from "inquirer";
31+
import inquirerSearchList from "inquirer-search-list";
3032

3133
const MINIMUM_MAJOR_VERSION = 16;
3234
const MINIMUM_MINOR_VERSION = 15;
@@ -51,6 +53,8 @@ async function main() {
5153
});
5254
}
5355

56+
inquirer.registerPrompt("search-list", inquirerSearchList);
57+
5458
const nodeVersion = process.versions.node;
5559
const majorVersion = parseInt(nodeVersion.split(".")[0], 10);
5660
const minorVersion = parseInt(nodeVersion.split(".")[1], 10);

npm-packages/convex/src/cli/lib/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ export async function validateOrSelectProject(
479479
{
480480
name: "project",
481481
message: multiProjectPrompt,
482-
type: "list",
482+
type: "search-list",
483483
choices: nonDemoProjects.map((project: Project) => ({
484484
name: `${project.name} (${project.slug})`,
485485
value: project.slug,

npm-packages/convex/src/types.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
declare module "inquirer-search-list" {
2+
const mod: import("inquirer").prompts.PromptConstructor;
3+
export = mod;
4+
}

npm-packages/convex/tsconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
{
22
"include": ["src", ".eslintrc.cjs"],
3-
/* src/cli uses a different tsconfig.json and .test.ts files should not be compiled */
43
"compileOnSave": true,
54
"compilerOptions": {
65
/* Basic Options */

0 commit comments

Comments
 (0)