Skip to content

Commit

Permalink
fix: prevent errors when supplying dependencies for Nuxt.js template
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesgeorge007 committed Sep 20, 2023
1 parent 2444491 commit b1cdf41
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/commands/add/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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();

Expand Down

0 comments on commit b1cdf41

Please sign in to comment.