## Before <img width="391" height="188" alt="image" src="https://github.com/user-attachments/assets/78a0139f-d992-49cb-98ff-531bdbadc64b" /> ## After <img width="419" height="773" alt="image" src="https://github.com/user-attachments/assets/da9b36a4-74e0-4445-b8c5-7a2329eb4f46" />
25 lines
643 B
TypeScript
25 lines
643 B
TypeScript
import chalk from 'chalk';
|
|
import { promisify } from 'util';
|
|
import { exec } from 'child_process';
|
|
|
|
const execPromise = promisify(exec);
|
|
|
|
export const install = async (
|
|
root: string,
|
|
onProgress?: (message: string) => void,
|
|
) => {
|
|
onProgress?.('Enabling corepack');
|
|
try {
|
|
await execPromise('corepack enable', { cwd: root });
|
|
} catch (error: any) {
|
|
console.warn(chalk.yellow('corepack enable failed:'), error.stderr);
|
|
}
|
|
|
|
onProgress?.('Running yarn install');
|
|
try {
|
|
await execPromise('yarn install', { cwd: root });
|
|
} catch (error: any) {
|
|
console.warn(chalk.yellow('yarn install failed:'), error.stdout);
|
|
}
|
|
};
|