playwright-ng-schematics
Version:
Playwright Angular schematics
27 lines (26 loc) • 838 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getPackageManagerExecCommand = getPackageManagerExecCommand;
exports.default = installBrowsers;
const node_child_process_1 = require("node:child_process");
function getPackageManagerExecCommand() {
const env = process.env.npm_config_user_agent || '';
if (env.includes('yarn')) {
return 'yarn';
}
if (env.includes('pnpm')) {
return 'pnpm exec';
}
return 'npx';
}
function installBrowsers() {
return (tree, context) => {
context.logger.info('Installing browsers...');
(0, node_child_process_1.spawnSync)(`${getPackageManagerExecCommand()} playwright install`, [], {
cwd: process.cwd(),
stdio: 'inherit',
shell: true,
});
return tree;
};
}