Skip to content

Commit

Permalink
Merge pull request #157 from ckeditor/i/156
Browse files Browse the repository at this point in the history
Fix (generator): Removed the current working directory from a package manager command when installing dependencies. A new process is already spawned in the directory. Hence, there is no need to duplicate the path. Thanks to that, a space in the path will not crash the generator while installing dependencies. Closes #156.
  • Loading branch information
psmyrek committed Jul 5, 2023
2 parents 40a9b62 + 63c8f59 commit 35442f4
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 35442f4

Please sign in to comment.