mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-04 21:23:07 +00:00
fix(init): improve Playwright installation error handling
Updated the Playwright browser installation process to capture and log the exit code, providing feedback on success or failure. If the installation fails, a warning message is displayed, enhancing user awareness during setup.
This commit is contained in:
17
init.mjs
17
init.mjs
@@ -291,17 +291,26 @@ async function main() {
|
|||||||
// Install Playwright browsers from apps/ui where @playwright/test is installed
|
// Install Playwright browsers from apps/ui where @playwright/test is installed
|
||||||
log('Checking Playwright browsers...', 'yellow');
|
log('Checking Playwright browsers...', 'yellow');
|
||||||
try {
|
try {
|
||||||
await new Promise((resolve) => {
|
const exitCode = await new Promise((resolve) => {
|
||||||
const playwright = crossSpawn(
|
const playwright = crossSpawn(
|
||||||
'npx',
|
'npx',
|
||||||
['playwright', 'install', 'chromium'],
|
['playwright', 'install', 'chromium'],
|
||||||
{ stdio: 'inherit', cwd: path.join(__dirname, 'apps', 'ui') }
|
{ stdio: 'inherit', cwd: path.join(__dirname, 'apps', 'ui') }
|
||||||
);
|
);
|
||||||
playwright.on('close', () => resolve());
|
playwright.on('close', (code) => resolve(code));
|
||||||
playwright.on('error', () => resolve());
|
playwright.on('error', () => resolve(1));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (exitCode === 0) {
|
||||||
|
log('Playwright browsers ready', 'green');
|
||||||
|
} else {
|
||||||
|
log(
|
||||||
|
'Playwright installation failed (browser automation may not work)',
|
||||||
|
'yellow'
|
||||||
|
);
|
||||||
|
}
|
||||||
} catch {
|
} catch {
|
||||||
// Ignore errors - Playwright install is optional
|
log('Playwright installation skipped', 'yellow');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Kill any existing processes on required ports
|
// Kill any existing processes on required ports
|
||||||
|
|||||||
Reference in New Issue
Block a user