Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/adding-info-in-case-import-works #71

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/main/lib/import-or-local.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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) => {
Expand Down