Skip to content

Commit

Permalink
Removed the current working directory from a package manager command …
Browse files Browse the repository at this point in the history
…when installing dependencies. A new process is already spawned in the directory. Hence, there is no need for duplicating the path.
  • Loading branch information
pomek committed Jul 4, 2023
1 parent af82dd8 commit 044e836
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ function installPackages( directoryPath, packageManager, verbose, dev ) {

if ( packageManager === 'npm' ) {
const npmArguments = [
'install',
'--prefix',
directoryPath
'install'
];

// Flag required for npm 8 to install linked packages' dependencies
Expand All @@ -64,12 +62,7 @@ function installPackages( directoryPath, packageManager, verbose, dev ) {

installTask = spawn( 'npm', npmArguments, spawnOptions );
} else {
const yarnArguments = [
'--cwd',
directoryPath
];

installTask = spawn( 'yarnpkg', yarnArguments, spawnOptions );
installTask = spawn( 'yarnpkg', [], spawnOptions );
}

installTask.on( 'close', exitCode => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,7 @@ describe( 'lib/utils/install-dependencies', () => {
expect( stubs.childProcess.spawn.callCount ).to.equal( 1 );
expect( stubs.childProcess.spawn.getCall( 0 ).args ).to.deep.equal( [
'yarnpkg',
[
'--cwd',
defaultDirectoryPath
],
[],
{
encoding: 'utf8',
shell: true,
Expand All @@ -98,10 +95,7 @@ describe( 'lib/utils/install-dependencies', () => {
expect( stubs.childProcess.spawn.callCount ).to.equal( 1 );
expect( stubs.childProcess.spawn.getCall( 0 ).args ).to.deep.equal( [
'yarnpkg',
[
'--cwd',
defaultDirectoryPath
],
[],
{
encoding: 'utf8',
shell: true,
Expand All @@ -119,9 +113,7 @@ describe( 'lib/utils/install-dependencies', () => {
expect( stubs.childProcess.spawn.getCall( 0 ).args ).to.deep.equal( [
'npm',
[
'install',
'--prefix',
defaultDirectoryPath
'install'
],
{
encoding: 'utf8',
Expand All @@ -139,9 +131,7 @@ describe( 'lib/utils/install-dependencies', () => {
expect( stubs.childProcess.spawn.getCall( 0 ).args ).to.deep.equal( [
'npm',
[
'install',
'--prefix',
defaultDirectoryPath
'install'
],
{
encoding: 'utf8',
Expand Down

0 comments on commit 044e836

Please sign in to comment.