@strapi/strapi
Version:
An open source headless CMS solution to create and manage your own API. It provides a powerful dashboard and features to make your life easier. Databases supported: MySQL, MariaDB, PostgreSQL, SQLite
1 lines • 2.51 kB
Source Map (JSON)
{"version":3,"file":"list.mjs","sources":["../../../../../src/cli/commands/routes/list.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport CLITable from 'cli-table3';\nimport chalk from 'chalk';\nimport { toUpper } from 'lodash/fp';\n\nimport { createStrapi, compileStrapi } from '@strapi/core';\n\nimport type { StrapiCommand } from '../../types';\nimport { runAction } from '../../utils/helpers';\n\nconst action = async () => {\n const appContext = await compileStrapi();\n const app = await createStrapi(appContext).load();\n\n const list = app.server.mount().listRoutes();\n\n const infoTable = new CLITable({\n head: [chalk.blue('Method'), chalk.blue('Path')],\n colWidths: [20],\n });\n\n list\n .filter((route) => route.methods.length)\n .forEach((route) => {\n infoTable.push([route.methods.map(toUpper).join('|'), route.path]);\n });\n\n console.log(infoTable.toString());\n\n await app.destroy();\n};\n\n/**\n * `$ strapi routes:list``\n */\nconst command: StrapiCommand = () => {\n return createCommand('routes:list')\n .description('List all the application routes')\n .action(runAction('routes:list', action));\n};\n\nexport { action, command };\n"],"names":["action","appContext","compileStrapi","app","createStrapi","load","list","server","mount","listRoutes","infoTable","CLITable","head","chalk","blue","colWidths","filter","route","methods","length","forEach","push","map","toUpper","join","path","console","log","toString","destroy","command","createCommand","description","runAction"],"mappings":";;;;;;;AAUA,MAAMA,MAAS,GAAA,UAAA;AACb,IAAA,MAAMC,aAAa,MAAMC,aAAAA,EAAAA;AACzB,IAAA,MAAMC,GAAM,GAAA,MAAMC,YAAaH,CAAAA,UAAAA,CAAAA,CAAYI,IAAI,EAAA;AAE/C,IAAA,MAAMC,OAAOH,GAAII,CAAAA,MAAM,CAACC,KAAK,GAAGC,UAAU,EAAA;IAE1C,MAAMC,SAAAA,GAAY,IAAIC,QAAS,CAAA;QAC7BC,IAAM,EAAA;AAACC,YAAAA,KAAAA,CAAMC,IAAI,CAAC,QAAA,CAAA;AAAWD,YAAAA,KAAAA,CAAMC,IAAI,CAAC,MAAA;AAAQ,SAAA;QAChDC,SAAW,EAAA;AAAC,YAAA;AAAG;AACjB,KAAA,CAAA;IAEAT,IACGU,CAAAA,MAAM,CAAC,CAACC,KAAUA,GAAAA,KAAAA,CAAMC,OAAO,CAACC,MAAM,CAAA,CACtCC,OAAO,CAAC,CAACH,KAAAA,GAAAA;AACRP,QAAAA,SAAAA,CAAUW,IAAI,CAAC;AAACJ,YAAAA,KAAAA,CAAMC,OAAO,CAACI,GAAG,CAACC,OAAAA,CAAAA,CAASC,IAAI,CAAC,GAAA,CAAA;AAAMP,YAAAA,KAAAA,CAAMQ;AAAK,SAAA,CAAA;AACnE,KAAA,CAAA;IAEFC,OAAQC,CAAAA,GAAG,CAACjB,SAAAA,CAAUkB,QAAQ,EAAA,CAAA;AAE9B,IAAA,MAAMzB,IAAI0B,OAAO,EAAA;AACnB;AAEA;;AAEC,UACKC,OAAyB,GAAA,IAAA;IAC7B,OAAOC,aAAAA,CAAc,eAClBC,WAAW,CAAC,mCACZhC,MAAM,CAACiC,UAAU,aAAejC,EAAAA,MAAAA,CAAAA,CAAAA;AACrC;;;;"}