UNPKG

@visulima/api-platform

Version:

Visulima API platform is a set of tools to build and consume web APIs

1 lines 3.08 kB
{"version":3,"sources":["../../../../src/framework/cli/commander/command/list-command.ts"],"names":["listCommand","program","commandName","description","options","list_command_default","error","exit"],"mappings":"2GAMA,IAAMA,EAAc,CAChBC,CAAAA,CACAC,EAAc,MACdC,CAAAA,CAAAA,CAAc,iGACP,CACPF,CAAAA,CACK,QAAQC,CAAW,CAAA,CACnB,YAAYC,CAAW,CAAA,CACvB,MAAO,CAAA,yBAAA,CAA2B,oEAAoE,CAAA,CACtG,OAAO,mBAAqB,CAAA,KAAK,EACjC,MAAO,CAAA,gBAAA,CAAkB,qCAAqC,CAC9D,CAAA,MAAA,CAAO,wBAAyB,mFAAqF,CAAA,EAAE,CACvH,CAAA,MAAA,CAAO,wBAAyB,8EAAgF,CAAA,EAAE,CAClH,CAAA,MAAA,CAAO,eAAiB,CAAA,iBAAA,CAAmB,KAAK,CAAA,CAChD,OACG,MAAOC,CAAAA,EAOD,CACF,GAAI,CACA,MAAMC,CAAQD,CAAAA,CAAAA,CAAQ,UAAWA,CAAQ,CAAA,IAAA,CAAM,CAC3C,YAAcA,CAAAA,CAAAA,CAAQ,cAAgB,EAAC,CACvC,MAAOA,CAAQ,CAAA,KAAA,CACf,YAAcA,CAAAA,CAAAA,CAAQ,WAAe,EAAA,GACrC,OAASA,CAAAA,CAAAA,CAAQ,OACrB,CAAC,EACL,OAASE,CAAY,CAAA,CAEjB,QAAQ,GAAI,EAAA,CAEZ,QAAQ,KAAMA,CAAAA,CAAK,EACnBC,IAAK,CAAA,CAAC,EACV,CACJ,CACJ,EACR,CAAA,CAEOF,CAAQL,CAAAA","file":"index.mjs","sourcesContent":["import { exit } from \"node:process\";\n\nimport type { Command } from \"commander\";\n\nimport command from \"../../command/list/list-command\";\n\nconst listCommand = (\n program: Command,\n commandName = \"list\",\n description = \"List all available API routes; Supported frameworks are next, express, koa, hapi and fastify\",\n): void => {\n program\n .command(commandName)\n .description(description)\n .option(\"--framework <framework>\", \"Framework to use, choose from next, express, koa, hapi and fastify\")\n .option(\"-p, --path [path]\", \"...\")\n .option(\"--group [type]\", \"Groups routes. Supported: path, tag\")\n .option(\"--include-path [path]\", \"Includes only routes which contain a given path element. (comma-separated values)\", [])\n .option(\"--exclude-path [path]\", \"Excludes routes which contain a given path element. (comma-separated values)\", [])\n .option(\"-v, --verbose\", \"Verbose output.\", false)\n .action(\n async (options: {\n excludePaths?: string[];\n framework: \"express\" | \"fastify\" | \"hapi\" | \"koa\" | \"next\";\n group?: string;\n includePath?: string[];\n path: string;\n verbose?: boolean;\n }) => {\n try {\n await command(options.framework, options.path, {\n excludePaths: options.excludePaths ?? [],\n group: options.group,\n includePaths: options.includePath ?? [],\n verbose: options.verbose as boolean | undefined,\n });\n } catch (error: any) {\n // eslint-disable-next-line no-console\n console.log();\n // eslint-disable-next-line no-console\n console.error(error);\n exit(1);\n }\n },\n );\n};\n\nexport default listCommand;\n"]}