mirror of
https://github.com/strapi/strapi.git
synced 2025-07-29 11:58:29 +00:00
move all scripts and commands
This commit is contained in:
parent
5728db43f2
commit
a1be2e4c19
@ -33,7 +33,7 @@ jest.mock('../../index', () => {
|
||||
});
|
||||
|
||||
const inquirer = require('inquirer');
|
||||
const createAdminCommand = require('../scripts/admin-create');
|
||||
const createAdminCommand = require('../actions/admin/create-user/action');
|
||||
|
||||
describe('admin:create command', () => {
|
||||
beforeEach(() => {
|
||||
|
@ -24,7 +24,7 @@ jest.mock('../../index', () => {
|
||||
});
|
||||
|
||||
const inquirer = require('inquirer');
|
||||
const resetAdminPasswordCommand = require('../scripts/admin-reset');
|
||||
const resetAdminPasswordCommand = require('../actions/admin/reset-user-password/action');
|
||||
|
||||
describe('admin:reset-password command', () => {
|
||||
beforeEach(() => {
|
||||
|
@ -3,7 +3,7 @@
|
||||
const { yup } = require('@strapi/utils');
|
||||
const _ = require('lodash');
|
||||
const inquirer = require('inquirer');
|
||||
const strapi = require('../../index');
|
||||
const strapi = require('../../../../index');
|
||||
|
||||
const emailValidator = yup.string().email('Invalid email address').lowercase();
|
||||
|
@ -0,0 +1,15 @@
|
||||
'use strict';
|
||||
|
||||
const { getLocalScript } = require('../../../utils/helpers');
|
||||
|
||||
module.exports = ({ command /* , argv */ }) => {
|
||||
command
|
||||
.command('admin:create-user')
|
||||
.alias('admin:create')
|
||||
.description('Create a new admin')
|
||||
.option('-e, --email <email>', 'Email of the new admin')
|
||||
.option('-p, --password <password>', 'Password of the new admin')
|
||||
.option('-f, --firstname <first name>', 'First name of the new admin')
|
||||
.option('-l, --lastname <last name>', 'Last name of the new admin')
|
||||
.action(getLocalScript('admin/create-user'));
|
||||
};
|
@ -2,7 +2,7 @@
|
||||
|
||||
const _ = require('lodash');
|
||||
const inquirer = require('inquirer');
|
||||
const strapi = require('../../index');
|
||||
const strapi = require('../../../../index');
|
||||
|
||||
const promptQuestions = [
|
||||
{ type: 'input', name: 'email', message: 'User email?' },
|
@ -0,0 +1,13 @@
|
||||
'use strict';
|
||||
|
||||
const { getLocalScript } = require('../../../utils/helpers');
|
||||
|
||||
module.exports = ({ command /* , argv */ }) => {
|
||||
command
|
||||
.command('admin:reset-user-password')
|
||||
.alias('admin:reset-password')
|
||||
.description("Reset an admin user's password")
|
||||
.option('-e, --email <email>', 'The user email')
|
||||
.option('-p, --password <password>', 'New password for the user')
|
||||
.action(getLocalScript('admin/reset-user-password'));
|
||||
};
|
@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
const strapi = require('../..');
|
||||
const { buildAdmin } = require('../builders');
|
||||
const strapi = require('../../..');
|
||||
const { buildAdmin } = require('../../builders');
|
||||
|
||||
/**
|
||||
* `$ strapi build`
|
@ -1,13 +1,12 @@
|
||||
'use strict';
|
||||
|
||||
const { loadProjectScript } = require('../../scripts/utils/helpers');
|
||||
const { getLocalScript } = require('../../utils/helpers');
|
||||
|
||||
// TODO: fix gitignore so that this folder can be called build
|
||||
module.exports = ({ command /* , argv */ }) => {
|
||||
// `$ strapi build`
|
||||
command
|
||||
.command('build')
|
||||
.option('--no-optimization', 'Build the admin app without optimizing assets')
|
||||
.description('Build the strapi admin app')
|
||||
.action(loadProjectScript('build'));
|
||||
.action(getLocalScript('build-action')); // TODO: fix gitignore so that this folder can be called build
|
||||
};
|
||||
|
@ -1,7 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
const strapi = require('../../index');
|
||||
const strapi = require('../../../../index');
|
||||
|
||||
const CHUNK_SIZE = 100;
|
||||
|
@ -0,0 +1,13 @@
|
||||
'use strict';
|
||||
|
||||
const { getLocalScript } = require('../../../utils/helpers');
|
||||
|
||||
module.exports = ({ command /* , argv */ }) => {
|
||||
command
|
||||
.command('configuration:dump')
|
||||
.alias('config:dump')
|
||||
.description('Dump configurations of your application')
|
||||
.option('-f, --file <file>', 'Output file, default output is stdout')
|
||||
.option('-p, --pretty', 'Format the output JSON with indentation and line breaks', false)
|
||||
.action(getLocalScript('configuration/dump'));
|
||||
};
|
@ -3,7 +3,7 @@
|
||||
const fs = require('fs');
|
||||
const _ = require('lodash');
|
||||
|
||||
const strapi = require('../../index');
|
||||
const strapi = require('../../../../index');
|
||||
|
||||
/**
|
||||
* Will restore configurations. It reads from a file or stdin
|
@ -0,0 +1,13 @@
|
||||
'use strict';
|
||||
|
||||
const { getLocalScript } = require('../../../utils/helpers');
|
||||
|
||||
module.exports = ({ command /* , argv */ }) => {
|
||||
command
|
||||
.command('configuration:restore')
|
||||
.alias('config:restore')
|
||||
.description('Restore configurations of your application')
|
||||
.option('-f, --file <file>', 'Input file, default input is stdin')
|
||||
.option('-s, --strategy <strategy>', 'Strategy name, one of: "replace", "merge", "keep"')
|
||||
.action(getLocalScript('configuration/restore'));
|
||||
};
|
@ -0,0 +1,11 @@
|
||||
'use strict';
|
||||
|
||||
const { loadProjectScript } = require('../../utils/helpers');
|
||||
|
||||
module.exports = ({ command /* , argv */ }) => {
|
||||
// `$ strapi console`
|
||||
command
|
||||
.command('console')
|
||||
.description('Open the Strapi framework console')
|
||||
.action(loadProjectScript('console'));
|
||||
};
|
@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
const { getLocalScript } = require('../../scripts/utils/helpers');
|
||||
const { getLocalScript } = require('../../utils/helpers');
|
||||
|
||||
module.exports = ({ command /* , argv */ }) => {
|
||||
// `$ strapi console`
|
||||
|
@ -0,0 +1,10 @@
|
||||
'use strict';
|
||||
|
||||
const { getLocalScript } = require('../../../utils/helpers');
|
||||
|
||||
module.exports = ({ command /* , argv */ }) => {
|
||||
command
|
||||
.command('content-types:list')
|
||||
.description('List all the application content-types')
|
||||
.action(getLocalScript('content-types/list'));
|
||||
};
|
@ -0,0 +1,10 @@
|
||||
'use strict';
|
||||
|
||||
const { getLocalScript } = require('../../../utils/helpers');
|
||||
|
||||
module.exports = ({ command /* , argv */ }) => {
|
||||
command
|
||||
.command('controllers:list')
|
||||
.description('List all the application controllers')
|
||||
.action(getLocalScript('controllers/list'));
|
||||
};
|
@ -0,0 +1,16 @@
|
||||
'use strict';
|
||||
|
||||
const { loadProjectScript } = require('../../utils/helpers');
|
||||
|
||||
module.exports = ({ command /* , argv */ }) => {
|
||||
// `$ strapi develop`
|
||||
command
|
||||
.command('develop')
|
||||
.alias('dev')
|
||||
.option('--no-build', 'Disable build')
|
||||
.option('--watch-admin', 'Enable watch', false)
|
||||
.option('--polling', 'Watch for file changes in network directories', false)
|
||||
.option('--browser <name>', 'Open the browser', true)
|
||||
.description('Start your Strapi application in development mode')
|
||||
.action(loadProjectScript('develop'));
|
||||
};
|
@ -9,9 +9,9 @@ const { getOr } = require('lodash/fp');
|
||||
const { joinBy } = require('@strapi/utils');
|
||||
const tsUtils = require('@strapi/typescript-utils');
|
||||
|
||||
const loadConfiguration = require('../../core/app-configuration');
|
||||
const strapi = require('../../index');
|
||||
const { buildTypeScript, buildAdmin } = require('../builders');
|
||||
const loadConfiguration = require('../../../core/app-configuration');
|
||||
const strapi = require('../../../index');
|
||||
const { buildTypeScript, buildAdmin } = require('../../builders');
|
||||
|
||||
/**
|
||||
* `$ strapi develop`
|
@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
const { getLocalScript } = require('../../scripts/utils/helpers');
|
||||
const { getLocalScript } = require('../../utils/helpers');
|
||||
|
||||
module.exports = ({ command /* , argv */ }) => {
|
||||
// `$ strapi develop`
|
||||
|
@ -24,8 +24,8 @@ const {
|
||||
loadersFactory,
|
||||
exitMessageText,
|
||||
abortTransfer,
|
||||
} = require('../../scripts/transfer/utils');
|
||||
const { exitWith } = require('../../scripts/utils/helpers');
|
||||
} = require('../../utils/data-transfer');
|
||||
const { exitWith } = require('../../utils/helpers');
|
||||
/**
|
||||
* @typedef ExportCommandOptions Options given to the CLI import command
|
||||
*
|
||||
|
@ -6,9 +6,9 @@ const {
|
||||
onlyOption,
|
||||
throttleOption,
|
||||
validateExcludeOnly,
|
||||
} = require('../../scripts/transfer/utils');
|
||||
const { promptEncryptionKey } = require('../../scripts/utils/commander');
|
||||
const { getLocalScript } = require('../../scripts/utils/helpers');
|
||||
} = require('../../utils/data-transfer');
|
||||
const { promptEncryptionKey } = require('../../utils/commander');
|
||||
const { getLocalScript } = require('../../utils/helpers');
|
||||
|
||||
module.exports = (commandContext) => {
|
||||
const { command } = commandContext;
|
||||
|
@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
const { assertCwdContainsStrapiProject } = require('../../scripts/utils/helpers');
|
||||
const { assertCwdContainsStrapiProject } = require('../../utils/helpers');
|
||||
|
||||
module.exports = ({ command, argv }) => {
|
||||
// $ strapi generate
|
||||
|
@ -0,0 +1,11 @@
|
||||
'use strict';
|
||||
|
||||
const { getLocalScript } = require('../../../utils/helpers');
|
||||
|
||||
module.exports = ({ command }) => {
|
||||
// `$ strapi generate:template <directory>`
|
||||
command
|
||||
.command('templates:generate <directory>')
|
||||
.description('Generate template from Strapi project')
|
||||
.action(getLocalScript('template/generate'));
|
||||
};
|
@ -0,0 +1,10 @@
|
||||
'use strict';
|
||||
|
||||
const { getLocalScript } = require('../../../utils/helpers');
|
||||
|
||||
module.exports = ({ command /* , argv */ }) => {
|
||||
command
|
||||
.command('hooks:list')
|
||||
.description('List all the application hooks')
|
||||
.action(getLocalScript('hooks/list'));
|
||||
};
|
@ -20,8 +20,8 @@ const {
|
||||
loadersFactory,
|
||||
exitMessageText,
|
||||
abortTransfer,
|
||||
} = require('../../scripts/transfer/utils');
|
||||
const { exitWith } = require('../../scripts/utils/helpers');
|
||||
} = require('../../utils/data-transfer');
|
||||
const { exitWith } = require('../../utils/helpers');
|
||||
|
||||
/**
|
||||
* @typedef {import('@strapi/data-transfer/src/file/providers').ILocalFileSourceProviderOptions} ILocalFileSourceProviderOptions
|
||||
|
@ -8,9 +8,9 @@ const {
|
||||
onlyOption,
|
||||
throttleOption,
|
||||
validateExcludeOnly,
|
||||
} = require('../../scripts/transfer/utils');
|
||||
const { confirmMessage, forceOption } = require('../../scripts/utils/commander');
|
||||
const { getLocalScript, exitWith } = require('../../scripts/utils/helpers');
|
||||
} = require('../../utils/data-transfer');
|
||||
const { confirmMessage, forceOption } = require('../../utils/commander');
|
||||
const { getLocalScript, exitWith } = require('../../utils/helpers');
|
||||
|
||||
module.exports = (commandContext) => {
|
||||
const { command } = commandContext;
|
||||
|
@ -0,0 +1,11 @@
|
||||
'use strict';
|
||||
|
||||
const { getLocalScript } = require('../../utils/helpers');
|
||||
|
||||
module.exports = ({ command /* , argv */ }) => {
|
||||
// `$ strapi install`
|
||||
command
|
||||
.command('install [plugins...]')
|
||||
.description('Install a Strapi plugin')
|
||||
.action(getLocalScript('install'));
|
||||
};
|
@ -4,7 +4,7 @@ const { join } = require('path');
|
||||
const { existsSync } = require('fs-extra');
|
||||
const ora = require('ora');
|
||||
const execa = require('execa');
|
||||
const findPackagePath = require('../../load/package-path');
|
||||
const findPackagePath = require('../../../load/package-path');
|
||||
|
||||
module.exports = async (plugins) => {
|
||||
const loader = ora();
|
@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
const { getLocalScript } = require('../../scripts/utils/helpers');
|
||||
const { getLocalScript } = require('../../utils/helpers');
|
||||
|
||||
module.exports = ({ command /* , argv */ }) => {
|
||||
// `$ strapi install`
|
||||
|
@ -0,0 +1,10 @@
|
||||
'use strict';
|
||||
|
||||
const { getLocalScript } = require('../../../utils/helpers');
|
||||
|
||||
module.exports = ({ command /* , argv */ }) => {
|
||||
command
|
||||
.command('middlewares:list')
|
||||
.description('List all the application middlewares')
|
||||
.action(getLocalScript('middlewares/list'));
|
||||
};
|
@ -0,0 +1,10 @@
|
||||
'use strict';
|
||||
|
||||
const { getLocalScript } = require('../../../utils/helpers');
|
||||
|
||||
module.exports = ({ command /* , argv */ }) => {
|
||||
command
|
||||
.command('policies:list')
|
||||
.description('List all the application policies')
|
||||
.action(getLocalScript('policies/list'));
|
||||
};
|
@ -0,0 +1,10 @@
|
||||
'use strict';
|
||||
|
||||
const { getLocalScript } = require('../../../utils/helpers');
|
||||
|
||||
module.exports = ({ command /* , argv */ }) => {
|
||||
command
|
||||
.command('routes:list')
|
||||
.description('List all the application routes')
|
||||
.action(getLocalScript('routes/list'));
|
||||
};
|
@ -0,0 +1,10 @@
|
||||
'use strict';
|
||||
|
||||
const { getLocalScript } = require('../../../utils/helpers');
|
||||
|
||||
module.exports = ({ command /* , argv */ }) => {
|
||||
command
|
||||
.command('services:list')
|
||||
.description('List all the application services')
|
||||
.action(getLocalScript('services/list'));
|
||||
};
|
@ -3,7 +3,7 @@
|
||||
const CLITable = require('cli-table3');
|
||||
const chalk = require('chalk');
|
||||
|
||||
const strapi = require('../../../index');
|
||||
const strapi = require('../../../../index');
|
||||
|
||||
module.exports = async function () {
|
||||
const appContext = await strapi.compile();
|
@ -1,11 +1,11 @@
|
||||
'use strict';
|
||||
|
||||
const { loadProjectScript } = require('../../scripts/utils/helpers');
|
||||
const { getLocalScript } = require('../../utils/helpers');
|
||||
|
||||
module.exports = ({ command /* , argv */ }) => {
|
||||
// `$ strapi start`
|
||||
command
|
||||
.command('start')
|
||||
.description('Start your Strapi application')
|
||||
.action(loadProjectScript('start'));
|
||||
.action(getLocalScript('start'));
|
||||
};
|
||||
|
@ -4,7 +4,7 @@ const { resolve } = require('path');
|
||||
const fse = require('fs-extra');
|
||||
const chalk = require('chalk');
|
||||
const fetch = require('node-fetch');
|
||||
const machineID = require('../../utils/machine-id');
|
||||
const machineID = require('../../../../utils/machine-id');
|
||||
|
||||
const readPackageJSON = async (path) => {
|
||||
try {
|
@ -0,0 +1,11 @@
|
||||
'use strict';
|
||||
|
||||
const { getLocalScript } = require('../../../utils/helpers');
|
||||
|
||||
module.exports = ({ command /* , argv */ }) => {
|
||||
// `$ strapi opt-out-telemetry`
|
||||
command
|
||||
.command('telemetry:disable')
|
||||
.description('Disable anonymous telemetry and metadata sending to Strapi analytics')
|
||||
.action(getLocalScript('telemetry/disable'));
|
||||
};
|
@ -5,7 +5,7 @@ const fse = require('fs-extra');
|
||||
const chalk = require('chalk');
|
||||
const fetch = require('node-fetch');
|
||||
const { v4: uuidv4 } = require('uuid');
|
||||
const machineID = require('../../utils/machine-id');
|
||||
const machineID = require('../../../../utils/machine-id');
|
||||
|
||||
const readPackageJSON = async (path) => {
|
||||
try {
|
@ -0,0 +1,11 @@
|
||||
'use strict';
|
||||
|
||||
const { getLocalScript } = require('../../../utils/helpers');
|
||||
|
||||
module.exports = ({ command /* , argv */ }) => {
|
||||
// `$ strapi opt-in-telemetry`
|
||||
command
|
||||
.command('telemetry:enable')
|
||||
.description('Enable anonymous telemetry and metadata sending to Strapi analytics')
|
||||
.action(getLocalScript('telemetry/enable'));
|
||||
};
|
@ -0,0 +1,11 @@
|
||||
'use strict';
|
||||
|
||||
const { getLocalScript } = require('../../../utils/helpers');
|
||||
|
||||
module.exports = ({ command /* , argv */ }) => {
|
||||
// `$ strapi generate:template <directory>`
|
||||
command
|
||||
.command('templates:generate <directory>')
|
||||
.description('Generate template from Strapi project')
|
||||
.action(getLocalScript('templates/generate'));
|
||||
};
|
@ -21,8 +21,8 @@ const {
|
||||
loadersFactory,
|
||||
exitMessageText,
|
||||
abortTransfer,
|
||||
} = require('../../scripts/transfer/utils');
|
||||
const { exitWith } = require('../../scripts/utils/helpers');
|
||||
} = require('../../utils/data-transfer');
|
||||
const { exitWith } = require('../../utils/helpers');
|
||||
|
||||
/**
|
||||
* @typedef TransferCommandOptions Options given to the CLI transfer command
|
||||
|
@ -2,19 +2,19 @@
|
||||
|
||||
const inquirer = require('inquirer');
|
||||
const { Option } = require('commander');
|
||||
const { confirmMessage, forceOption, parseURL } = require('../../scripts/utils/commander');
|
||||
const { confirmMessage, forceOption, parseURL } = require('../../utils/commander');
|
||||
const {
|
||||
getLocalScript,
|
||||
exitWith,
|
||||
assertUrlHasProtocol,
|
||||
ifOptions,
|
||||
} = require('../../scripts/utils/helpers');
|
||||
} = require('../../utils/helpers');
|
||||
const {
|
||||
excludeOption,
|
||||
onlyOption,
|
||||
throttleOption,
|
||||
validateExcludeOnly,
|
||||
} = require('../../scripts/transfer/utils');
|
||||
} = require('../../utils/data-transfer');
|
||||
|
||||
module.exports = ({ command /* , argv */ }) => {
|
||||
// `$ strapi transfer`
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
const tsUtils = require('@strapi/typescript-utils');
|
||||
|
||||
const strapi = require('../../index');
|
||||
const strapi = require('../../../../index');
|
||||
|
||||
module.exports = async function ({ outDir, file, verbose, silent }) {
|
||||
if (verbose && silent) {
|
@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
const { getLocalScript } = require('../../../utils/helpers');
|
||||
|
||||
module.exports = ({ command /* , argv */ }) => {
|
||||
// `$ strapi ts:generate-types`
|
||||
command
|
||||
.command('ts:generate-types')
|
||||
.description(`Generate TypeScript typings for your schemas`)
|
||||
.option(
|
||||
'-o, --out-dir <outDir>',
|
||||
'Specify a relative directory in which the schemas definitions will be generated'
|
||||
)
|
||||
.option('-f, --file <file>', 'Specify a filename to store the schemas definitions')
|
||||
.option('--verbose', `Display more information about the types generation`, false)
|
||||
.option('-s, --silent', `Run the generation silently, without any output`, false)
|
||||
.action(getLocalScript('ts/generate-types'));
|
||||
};
|
@ -0,0 +1,12 @@
|
||||
'use strict';
|
||||
|
||||
const { getLocalScript } = require('../../utils/helpers');
|
||||
|
||||
module.exports = ({ command /* , argv */ }) => {
|
||||
// `$ strapi uninstall`
|
||||
command
|
||||
.command('uninstall [plugins...]')
|
||||
.description('Uninstall a Strapi plugin')
|
||||
.option('-d, --delete-files', 'Delete files', false)
|
||||
.action(getLocalScript('uninstall'));
|
||||
};
|
@ -5,7 +5,7 @@ const { existsSync, removeSync } = require('fs-extra');
|
||||
const ora = require('ora');
|
||||
const execa = require('execa');
|
||||
const inquirer = require('inquirer');
|
||||
const findPackagePath = require('../../load/package-path');
|
||||
const findPackagePath = require('../../../load/package-path');
|
||||
|
||||
module.exports = async (plugins, { deleteFiles }) => {
|
||||
const answers = await inquirer.prompt([
|
@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
const { getLocalScript } = require('../../scripts/utils/helpers');
|
||||
const { getLocalScript } = require('../../utils/helpers');
|
||||
|
||||
module.exports = ({ command /* , argv */ }) => {
|
||||
// `$ strapi uninstall`
|
||||
|
@ -3,9 +3,9 @@
|
||||
const strapiAdmin = require('@strapi/admin');
|
||||
const { getConfigUrls, getAbsoluteServerUrl } = require('@strapi/utils');
|
||||
|
||||
const getEnabledPlugins = require('../../core/loaders/plugins/get-enabled-plugins');
|
||||
const addSlash = require('../../utils/addSlash');
|
||||
const strapi = require('../../index');
|
||||
const getEnabledPlugins = require('../../../core/loaders/plugins/get-enabled-plugins');
|
||||
const addSlash = require('../../../utils/addSlash');
|
||||
const strapi = require('../../../index');
|
||||
|
||||
module.exports = async function ({ browser }) {
|
||||
const appContext = await strapi.compile();
|
@ -1,6 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
const { getLocalScript } = require('../../scripts/utils/helpers');
|
||||
const { getLocalScript } = require('../../utils/helpers');
|
||||
|
||||
module.exports = ({ command /* , argv */ }) => {
|
||||
// `$ strapi watch-admin`
|
||||
@ -8,5 +8,5 @@ module.exports = ({ command /* , argv */ }) => {
|
||||
.command('watch-admin')
|
||||
.option('--browser <name>', 'Open the browser', true)
|
||||
.description('Start the admin development server')
|
||||
.action(getLocalScript('watchAdmin'));
|
||||
.action(getLocalScript('watch-admin'));
|
||||
};
|
||||
|
@ -2,7 +2,37 @@
|
||||
|
||||
const { Command } = require('commander');
|
||||
|
||||
const availableCommands = ['version', 'console', 'new', 'export', 'import'];
|
||||
const availableCommands = [
|
||||
'admin/create-user',
|
||||
'admin/reset-user-password',
|
||||
'build-action', // TODO: this should be 'build' but that is ignored
|
||||
'configuration/dump',
|
||||
'configuration/restore',
|
||||
'console',
|
||||
'content-types/list',
|
||||
'controllers/list',
|
||||
'develop',
|
||||
'export',
|
||||
'generate',
|
||||
'generate/template',
|
||||
'hooks/list',
|
||||
'import',
|
||||
'install',
|
||||
'middlewares/list',
|
||||
'new',
|
||||
'policies/list',
|
||||
'routes/list',
|
||||
'services/list',
|
||||
'start',
|
||||
'telemetry/disable',
|
||||
'telemetry/enable',
|
||||
'templates/generate',
|
||||
'transfer',
|
||||
'ts/generate-types',
|
||||
'uninstall',
|
||||
'version',
|
||||
'watch-admin',
|
||||
];
|
||||
|
||||
const buildStrapiCommand = (argv, command = new Command()) => {
|
||||
// Initial program setup
|
||||
@ -20,112 +50,6 @@ const buildStrapiCommand = (argv, command = new Command()) => {
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
|
||||
|
||||
// `$ strapi generate:template <directory>`
|
||||
command
|
||||
.command('templates:generate <directory>')
|
||||
.description('Generate template from Strapi project')
|
||||
.action(getLocalScript('generate-template'));
|
||||
|
||||
|
||||
command
|
||||
.command('configuration:dump')
|
||||
.alias('config:dump')
|
||||
.description('Dump configurations of your application')
|
||||
.option('-f, --file <file>', 'Output file, default output is stdout')
|
||||
.option('-p, --pretty', 'Format the output JSON with indentation and line breaks', false)
|
||||
.action(getLocalScript('configurationDump'));
|
||||
|
||||
command
|
||||
.command('configuration:restore')
|
||||
.alias('config:restore')
|
||||
.description('Restore configurations of your application')
|
||||
.option('-f, --file <file>', 'Input file, default input is stdin')
|
||||
.option('-s, --strategy <strategy>', 'Strategy name, one of: "replace", "merge", "keep"')
|
||||
.action(getLocalScript('configurationRestore'));
|
||||
|
||||
// Admin
|
||||
command
|
||||
.command('admin:create-user')
|
||||
.alias('admin:create')
|
||||
.description('Create a new admin')
|
||||
.option('-e, --email <email>', 'Email of the new admin')
|
||||
.option('-p, --password <password>', 'Password of the new admin')
|
||||
.option('-f, --firstname <first name>', 'First name of the new admin')
|
||||
.option('-l, --lastname <last name>', 'Last name of the new admin')
|
||||
.action(getLocalScript('admin-create'));
|
||||
|
||||
command
|
||||
.command('admin:reset-user-password')
|
||||
.alias('admin:reset-password')
|
||||
.description("Reset an admin user's password")
|
||||
.option('-e, --email <email>', 'The user email')
|
||||
.option('-p, --password <password>', 'New password for the user')
|
||||
.action(getLocalScript('admin-reset'));
|
||||
|
||||
command
|
||||
.command('routes:list')
|
||||
.description('List all the application routes')
|
||||
.action(getLocalScript('routes/list'));
|
||||
|
||||
command
|
||||
.command('middlewares:list')
|
||||
.description('List all the application middlewares')
|
||||
.action(getLocalScript('middlewares/list'));
|
||||
|
||||
command
|
||||
.command('policies:list')
|
||||
.description('List all the application policies')
|
||||
.action(getLocalScript('policies/list'));
|
||||
|
||||
command
|
||||
.command('content-types:list')
|
||||
.description('List all the application content-types')
|
||||
.action(getLocalScript('content-types/list'));
|
||||
|
||||
command
|
||||
.command('hooks:list')
|
||||
.description('List all the application hooks')
|
||||
.action(getLocalScript('hooks/list'));
|
||||
|
||||
command
|
||||
.command('services:list')
|
||||
.description('List all the application services')
|
||||
.action(getLocalScript('services/list'));
|
||||
|
||||
command
|
||||
.command('controllers:list')
|
||||
.description('List all the application controllers')
|
||||
.action(getLocalScript('controllers/list'));
|
||||
|
||||
// `$ strapi opt-out-telemetry`
|
||||
command
|
||||
.command('telemetry:disable')
|
||||
.description('Disable anonymous telemetry and metadata sending to Strapi analytics')
|
||||
.action(getLocalScript('opt-out-telemetry'));
|
||||
|
||||
// `$ strapi opt-in-telemetry`
|
||||
command
|
||||
.command('telemetry:enable')
|
||||
.description('Enable anonymous telemetry and metadata sending to Strapi analytics')
|
||||
.action(getLocalScript('opt-in-telemetry'));
|
||||
|
||||
command
|
||||
.command('ts:generate-types')
|
||||
.description(`Generate TypeScript typings for your schemas`)
|
||||
.option(
|
||||
'-o, --out-dir <outDir>',
|
||||
'Specify a relative directory in which the schemas definitions will be generated'
|
||||
)
|
||||
.option('-f, --file <file>', 'Specify a filename to store the schemas definitions')
|
||||
.option('--verbose', `Display more information about the types generation`, false)
|
||||
.option('-s, --silent', `Run the generation silently, without any output`, false)
|
||||
.action(getLocalScript('ts/generate-types'));
|
||||
|
||||
*/
|
||||
|
||||
return command;
|
||||
};
|
||||
|
||||
|
@ -12,9 +12,9 @@ const {
|
||||
createLogger,
|
||||
} = require('@strapi/logger');
|
||||
const ora = require('ora');
|
||||
const { readableBytes, exitWith } = require('../utils/helpers');
|
||||
const strapi = require('../../../index');
|
||||
const { getParseListWithChoices, parseInteger } = require('../utils/commander');
|
||||
const { readableBytes, exitWith } = require('./helpers');
|
||||
const strapi = require('../../index');
|
||||
const { getParseListWithChoices, parseInteger } = require('./commander');
|
||||
|
||||
const exitMessageText = (process, error = false) => {
|
||||
const processCapitalized = process[0].toUpperCase() + process.slice(1);
|
@ -133,7 +133,7 @@ const getLocalScript =
|
||||
(name) =>
|
||||
(...args) => {
|
||||
assertCwdContainsStrapiProject(name);
|
||||
console.log('getLocalScript', name);
|
||||
|
||||
const cmdPath = resolveCwd.silent(`@strapi/strapi/lib/commands/actions/${name}/action`);
|
||||
if (!cmdPath) {
|
||||
console.log(
|
Loading…
x
Reference in New Issue
Block a user