opcache-gui/build/build.php
Andrew Collington 06ddd7d007
Improved advanced jit output (#80)
* Use `DateTimeImmutable` rather than `date`
* A few minor tidy-ups
* Bump of version in preparation
* Expands on the JIT value
* Updated readme
2022-01-09 23:48:23 +00:00

37 lines
1 KiB
PHP

<?php
/**
* OPcache GUI - build script
*
* @author Andrew Collington, andy@amnuts.com
* @version 3.3.1
* @link https://github.com/amnuts/opcache-gui
* @license MIT, https://acollington.mit-license.org/
*/
$parentPath = dirname(__DIR__);
if (!file_exists($parentPath . '/node_modules')) {
echo "🐢 Installing node modules\n";
exec('npm install');
}
echo "🏗️ Building js and css\n";
chdir($parentPath);
exec('npm run compile-jsx');
exec('npm run compile-scss');
echo "🚀 Creating single build file\n";
$template = trim(file_get_contents(__DIR__ . '/template.phps'));
$jsOutput = trim(file_get_contents(__DIR__ . '/interface.js'));
$cssOutput = trim(file_get_contents(__DIR__ . '/interface.css'));
$phpOutput = trim(join('', array_slice(file($parentPath . '/src/Opcache/Service.php'), 3)));
$output = str_replace(
['{{JS_OUTPUT}}', '{{CSS_OUTPUT}}', '{{PHP_OUTPUT}}'],
[$jsOutput, $cssOutput, $phpOutput],
$template
);
file_put_contents($parentPath . '/index.php', $output);
echo "💯 Done!\n";