mirror of
https://github.com/strapi/strapi.git
synced 2025-09-25 16:29:34 +00:00
refactor(CLI-Generate): ♻️ add root path support for middlewares & policies
This commit is contained in:
parent
e1375a80e1
commit
621c75ea27
@ -9,10 +9,13 @@ module.exports = (action, basePath, { rootFolder = false } = {}) => {
|
||||
name: 'destination',
|
||||
message: `Where do you want to add this ${action}?`,
|
||||
choices: [
|
||||
{
|
||||
name: `Add ${action} to ${rootFolder ? 'root of project' : 'new API'}`,
|
||||
value: 'new',
|
||||
},
|
||||
...rootFolder ? [{
|
||||
name: `Add ${action} to root of project`,
|
||||
value: 'root'
|
||||
}] : [{
|
||||
name: `Add ${action} to new API`,
|
||||
value: 'new'
|
||||
}],
|
||||
{ name: `Add ${action} to an existing API`, value: 'api' },
|
||||
{ name: `Add ${action} to an existing plugin`, value: 'plugin' },
|
||||
],
|
||||
|
@ -9,5 +9,9 @@ module.exports = destination => {
|
||||
return `plugins/{{ plugin }}/server`;
|
||||
}
|
||||
|
||||
if (destination === 'root') {
|
||||
return './';
|
||||
}
|
||||
|
||||
return `api/{{ id }}`;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user