mirror of
https://github.com/strapi/strapi.git
synced 2025-12-27 23:24:03 +00:00
Merge pull request #17135 from boazpoolman/feature/list-components-cli
This commit is contained in:
commit
19ea3a3934
@ -0,0 +1,23 @@
|
||||
'use strict';
|
||||
|
||||
const CLITable = require('cli-table3');
|
||||
const chalk = require('chalk');
|
||||
|
||||
const strapi = require('../../../../index');
|
||||
|
||||
module.exports = async () => {
|
||||
const appContext = await strapi.compile();
|
||||
const app = await strapi(appContext).register();
|
||||
|
||||
const list = Object.keys(app.components);
|
||||
|
||||
const infoTable = new CLITable({
|
||||
head: [chalk.blue('Name')],
|
||||
});
|
||||
|
||||
list.forEach((name) => infoTable.push([name]));
|
||||
|
||||
console.log(infoTable.toString());
|
||||
|
||||
await app.destroy();
|
||||
};
|
||||
@ -0,0 +1,14 @@
|
||||
'use strict';
|
||||
|
||||
const { getLocalScript } = require('../../../utils/helpers');
|
||||
|
||||
/**
|
||||
* `$ strapi components:list`
|
||||
* @param {import('../../../../types/core/commands').AddCommandOptions} options
|
||||
*/
|
||||
module.exports = ({ command }) => {
|
||||
command
|
||||
.command('components:list')
|
||||
.description('List all the application components')
|
||||
.action(getLocalScript('components/list'));
|
||||
};
|
||||
@ -6,6 +6,7 @@ const strapiCommands = {
|
||||
'admin/create-user': require('./actions/admin/create-user/command'),
|
||||
'admin/reset-user-password': require('./actions/admin/reset-user-password/command'),
|
||||
build: require('./actions/build-command/command'), // in 'build-command' to avoid problems with 'build' being commonly ignored
|
||||
'components/list': require('./actions/components/list/command'),
|
||||
'configuration/dump': require('./actions/configuration/dump/command'),
|
||||
'configuration/restore': require('./actions/configuration/restore/command'),
|
||||
console: require('./actions/console/command'),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user