diff --git a/packages/generators/generators/lib/plops/prompts/get-destination-prompts.js b/packages/generators/generators/lib/plops/prompts/get-destination-prompts.js index 9eb4934bcc..c2e04822c8 100644 --- a/packages/generators/generators/lib/plops/prompts/get-destination-prompts.js +++ b/packages/generators/generators/lib/plops/prompts/get-destination-prompts.js @@ -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' }, ], diff --git a/packages/generators/generators/lib/plops/utils/get-file-path.js b/packages/generators/generators/lib/plops/utils/get-file-path.js index c870b08661..5ed52be112 100644 --- a/packages/generators/generators/lib/plops/utils/get-file-path.js +++ b/packages/generators/generators/lib/plops/utils/get-file-path.js @@ -9,5 +9,9 @@ module.exports = destination => { return `plugins/{{ plugin }}/server`; } + if (destination === 'root') { + return './'; + } + return `api/{{ id }}`; };