| 117 | } |
| 118 | |
| 119 | export function runInstallation( |
| 120 | packageManager: PackageManager, |
| 121 | options: { cwd: string } |
| 122 | ) { |
| 123 | try { |
| 124 | execa.sync(packageManager, ['install'], { |
| 125 | cwd: options.cwd, |
| 126 | env: { |
| 127 | ...process.env, |
| 128 | // In case NODE_ENV=production is set, we still want dev dependencies to |
| 129 | // be installed. Otherwise we won't be able to check for peer dependencies. |
| 130 | // --production=false is not implemented by every package manager. |
| 131 | NODE_ENV: 'development', |
| 132 | }, |
| 133 | stdio: 'inherit', |
| 134 | shell: true, |
| 135 | }) |
| 136 | } catch (error) { |
| 137 | throw new Error('Failed to install dependencies', { cause: error }) |
| 138 | } |
| 139 | } |
| 140 | |
| 141 | export function addPackageDependency( |
| 142 | packageJson: Record<string, any>, |