From e662c17e577ce35c0ba498c97019c56aba9c2015 Mon Sep 17 00:00:00 2001 From: Yury Pikhtarev Date: Fri, 20 Jun 2025 23:02:38 +0400 Subject: [PATCH] feat(install): add developer prompt for dependency installation - Introduced a prompt during the installation process to ask users if they require development tools and dependencies. - Adjusted the dependency installation command to conditionally include or exclude development dependencies based on user input. - Added warnings for users with PHP versions below 8.2 when opting for development dependencies. This enhancement improves the installation experience by allowing developers to easily set up their environment while ensuring compatibility checks are in place. --- install.php | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/install.php b/install.php index 6ed06273c..79f88272c 100644 --- a/install.php +++ b/install.php @@ -117,6 +117,20 @@ chmod_r(BB_ROOT . 'internal_data', 0755, 0644); chmod_r(BB_ROOT . 'sitemap', 0755, 0644); out("- Permissions successfully applied!\n", 'success'); +// Ask if user is a developer before installing dependencies +$isDeveloper = false; +echo "\nAre you a developer who needs testing tools and dev dependencies? [y/N]: "; +if (str_starts_with(mb_strtolower(trim(readline())), 'y')) { + $isDeveloper = true; + if (!version_compare(PHP_VERSION, '8.2.0', '>=')) { + out("- Warning: Development dependencies require PHP 8.2+, your version is " . PHP_VERSION, 'warning'); + out("- Some testing tools may not work properly", 'warning'); + } + out("- Installing all dependencies including dev tools...", 'info'); +} else { + out("- Installing production dependencies only...\n", 'info'); +} + // Check composer installation if (!is_file(BB_ROOT . 'vendor/autoload.php')) { out('- Hmm, it seems there are no Composer dependencies', 'info'); @@ -147,7 +161,13 @@ if (!is_file(BB_ROOT . 'vendor/autoload.php')) { out('- Installing dependencies...', 'info'); runProcess('php ' . BB_ROOT . 'composer.phar update --no-install'); sleep(3); - runProcess('php ' . BB_ROOT . 'composer.phar install --no-interaction --no-ansi'); + + $composerFlags = '--no-interaction --no-ansi'; + if (!$isDeveloper) { + $composerFlags .= ' --no-dev'; + } + + runProcess('php ' . BB_ROOT . 'composer.phar install ' . $composerFlags); define('COMPOSER_COMPLETED', true); } else { out('- composer.phar not found. Please, download it (composer.phar) manually', 'error');