{"version":3,"file":"report.mjs","sources":["../../../../src/cli/commands/report.ts"],"sourcesContent":["import { createCommand } from 'commander';\nimport { EOL } from 'os';\nimport { createStrapi, compileStrapi } from '@strapi/core';\nimport type { StrapiCommand } from '../types';\nimport { runAction } from '../utils/helpers';\n\ninterface CmdOptions {\n uuid: boolean;\n dependencies: boolean;\n all: boolean;\n}\n\nconst action = async ({ uuid, dependencies, all }: CmdOptions) => {\n const config = {\n reportUUID: Boolean(all || uuid),\n reportDependencies: Boolean(all || dependencies),\n };\n\n const appContext = await compileStrapi();\n const app = await createStrapi(appContext).register();\n\n let debugInfo = `Launched In: ${Date.now() - app.config.launchedAt} ms\nEnvironment: ${app.config.environment}\nOS: ${process.platform}-${process.arch}\nStrapi Version: ${app.config.info.strapi}\nNode/Yarn Version: ${process.env.npm_config_user_agent}\nEdition: ${app.EE ? 'Enterprise' : 'Community'}\nDatabase: ${app?.config?.database?.connection?.client ?? 'unknown'}`;\n\n if (config.reportUUID) {\n debugInfo += `${EOL}UUID: ${app.config.uuid}`;\n }\n\n if (config.reportDependencies) {\n debugInfo += `${EOL}Dependencies: ${JSON.stringify(app.config.info.dependencies, null, 2)}\nDev Dependencies: ${JSON.stringify(app.config.info.devDependencies, null, 2)}`;\n }\n\n console.log(debugInfo);\n\n await app.destroy();\n};\n\n/**\n * `$ strapi report`\n */\nconst command: StrapiCommand = () => {\n return createCommand('report')\n .description('Get system stats for debugging and submitting issues')\n .option('-u, --uuid', 'Include Project UUID')\n .option('-d, --dependencies', 'Include Project Dependencies')\n .option('--all', 'Include All Information')\n .action(runAction('report', action));\n};\n\nexport { command };\n"],"names":["action","uuid","dependencies","all","config","reportUUID","Boolean","reportDependencies","appContext","compileStrapi","app","createStrapi","register","debugInfo","Date","now","launchedAt","environment","process","platform","arch","info","strapi","env","npm_config_user_agent","EE","database","connection","client","EOL","JSON","stringify","devDependencies","console","log","destroy","command","createCommand","description","option","runAction"],"mappings":";;;;;AAYA,MAAMA,MAAAA,GAAS,OAAO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