We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The code is nothing super special:
export const selectSpec = async (args: { spec: string }) => { if (Bun.stringWidth(args.spec) > 0) { return args.spec; } const specs = [...new Glob(join(dirname(Bun.main), "specs/[^_]*.json")).scanSync()]; const fuse = new Fuse(specs, {}); return await search({ message: "Select a spec", source: (input) => { if (!input) { return []; } const results = fuse.search(input).map((result) => basename(result.item)); return results.map((spec) => ({ name: spec, value: spec, })); }, }).catch(() => { process.exit(0); }); };
The text was updated successfully, but these errors were encountered:
Did you test with Node.js?
Sorry, something went wrong.
Slightly modifed code to remove Bun dependencies, and when ran with npx tsx test.ts the following file works just fine, but hangs when using Bun:
npx tsx test.ts
import { search } from "@inquirer/prompts"; import Fuse from "fuse.js"; import { readdirSync } from "node:fs"; import { basename } from "node:path"; export const selectSpec = async (args: { spec: string }) => { if (args.spec.length > 0) { return args.spec; } const specs = readdirSync("specs"); const fuse = new Fuse(specs, {}); return await search({ message: "Select a spec", source: (input) => { if (!input) { return []; } const results = fuse.search(input).map((result) => basename(result.item)); return results.map((spec) => ({ name: spec, value: spec, })); }, }).catch(() => { process.exit(0); }); }; await selectSpec({ spec: "" });
I raised an issue on the Bun repo: oven-sh/bun#17636
No branches or pull requests
Code_eJKx3V92sC.mp4
The code is nothing super special:
The text was updated successfully, but these errors were encountered: