From 29d2058bca7cde890bec7f548fcb8a086a8aa649 Mon Sep 17 00:00:00 2001 From: Antonio Sonis Date: Thu, 7 Dec 2023 11:00:14 +0100 Subject: [PATCH 1/2] feat: send info in case exist already a node_modules installed globally or on upper folder Signed-off-by: Antonio Sonis --- src/main/lib/import-or-local.mjs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/lib/import-or-local.mjs b/src/main/lib/import-or-local.mjs index ea78636d..0f8e394b 100644 --- a/src/main/lib/import-or-local.mjs +++ b/src/main/lib/import-or-local.mjs @@ -6,7 +6,10 @@ import { runCommand } from './run-command.mjs' async function importOrLocal ({ pkgManager, projectDir, pkg, logger }) { try { - return await import(pkg) + logger.info(`Installing ${pkg} on ${projectDir}...`) + await import(pkg) + logger.info(`During installation we found that there are upper folders with node_modules installed or there is a global installation.`) + return null } catch (err) { // This file does not need to exists, will be created automatically const pkgJsonPath = path.join(projectDir, 'package.json') @@ -17,8 +20,6 @@ async function importOrLocal ({ pkgManager, projectDir, pkg, logger }) { return await import(pathToFileURL(fileToImport)) } catch (err) {} - logger.info(`Installing ${pkg} on ${projectDir}...`) - const child = runCommand(pkgManager, ['install', pkg], { cwd: projectDir }) child.stdout.pipe(split()).on('data', (line) => { From 5983fa27070962ed559b2c3e21149c623e4d4b85 Mon Sep 17 00:00:00 2001 From: Antonio Sonis Date: Thu, 7 Dec 2023 11:07:37 +0100 Subject: [PATCH 2/2] fix: correction linting Signed-off-by: Antonio Sonis --- src/main/lib/import-or-local.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/lib/import-or-local.mjs b/src/main/lib/import-or-local.mjs index 0f8e394b..4abb14c7 100644 --- a/src/main/lib/import-or-local.mjs +++ b/src/main/lib/import-or-local.mjs @@ -8,7 +8,7 @@ async function importOrLocal ({ pkgManager, projectDir, pkg, logger }) { try { logger.info(`Installing ${pkg} on ${projectDir}...`) await import(pkg) - logger.info(`During installation we found that there are upper folders with node_modules installed or there is a global installation.`) + logger.info('During installation we found that there are upper folders with node_modules installed or there is a global installation.') return null } catch (err) { // This file does not need to exists, will be created automatically