diff --git a/src/commands/add/index.js b/src/commands/add/index.js index b6af8bd2..fd60f6f5 100644 --- a/src/commands/add/index.js +++ b/src/commands/add/index.js @@ -34,11 +34,13 @@ export default async (deps, { dev }) => { const { isConfigured, template, packageManager } = fetchProjectConfig(); + const templateIsNuxt = template === 'Nuxt.js'; + // Do not proceed if the deps were not supplied + // Nuxt.js template is the only exception if ( !deps.length && - (templateDir === 'server' || - (templateDir === 'client' && template !== 'Nuxt.js')) + (templateDir === 'server' || (templateDir === 'client' && !templateIsNuxt)) ) { logger.warn(' Please specify the dependencies to install'); process.exit(1); @@ -61,11 +63,12 @@ export default async (deps, { dev }) => { ); } - // No need for further config - if (dev) return; + // No need for further config with the case of dev dependencies + // or the Nuxt.js template with dependencies supplied + if (dev || (templateIsNuxt && deps.length)) return; // Nuxt.js modules are installed via multiselect prompt - if (template === 'Nuxt.js' && !deps.length) { + if (templateIsNuxt) { // Holds reference to the project specific config (.mevnrc) const projectConfig = fetchProjectConfig();