Some checks are pending
Module sub-split / Sub-split (push) Waiting to run
- Base: wintercms/winter branch 1.2 (full framework) - Theme vivespos: Canvas 7 + Bootstrap 5 CDN, custom CSS - Layout: deferred GTM/GA4 tracking, JSON-LD SoftwareApplication - Partials: hero (offline-first), features, modes (offline/nube toggle), screenshots, pricing (3 planes), comparison, FAQ, CTA - Plugin VivesPOS.Site with ContactForm - Dockerfile: PHP 8.2 Apache, port 80, healthcheck - Added winter/wn-pages, blog, sitemap, seo plugins - Active theme set to vivespos
80 lines
2.1 KiB
PHP
80 lines
2.1 KiB
PHP
<?php
|
|
|
|
namespace System\Console\Asset\Vite;
|
|
|
|
use System\Console\Asset\AssetCompile;
|
|
use Winter\Storm\Support\Str;
|
|
|
|
class ViteCompile extends AssetCompile
|
|
{
|
|
/**
|
|
* @var string|null The default command name for lazy loading.
|
|
*/
|
|
protected static $defaultName = 'vite:compile';
|
|
|
|
/**
|
|
* @var string The name and signature of this command.
|
|
*/
|
|
protected $signature = 'vite:compile
|
|
{viteArgs?* : Arguments to pass through to the Vite CLI}
|
|
{--f|production : Runs compilation in "production" mode}
|
|
{--s|silent : Enables silent mode, no output will be shown.}
|
|
{--d|disable-tty : Disable tty mode}
|
|
{--e|stop-on-error : Exit once an error is encountered}
|
|
{--m|manifest= : Defines package.json to use for compile}
|
|
{--p|package=* : Defines one or more packages to compile}
|
|
';
|
|
|
|
/**
|
|
* @var string The console command description.
|
|
*/
|
|
protected $description = 'Vite and compile assets';
|
|
|
|
/**
|
|
* @var array List of commands that this command replaces (aliases)
|
|
*/
|
|
protected $replaces = [
|
|
'vite:build'
|
|
];
|
|
|
|
/**
|
|
* Name of config file i.e. mix.webpack.js, vite.config.js
|
|
*/
|
|
protected string $configFile = 'vite.config.mjs';
|
|
|
|
/**
|
|
* Call the AssetCompile::compileHandle with the vite type
|
|
*/
|
|
public function handle(): int
|
|
{
|
|
return $this->compileHandle('vite');
|
|
}
|
|
|
|
/**
|
|
* Create the command array to create a Process object with
|
|
*/
|
|
protected function createCommand(string $configPath): array
|
|
{
|
|
$basePath = base_path();
|
|
$command = $this->argument('viteArgs') ?? [];
|
|
array_unshift(
|
|
$command,
|
|
$basePath . sprintf('%1$snode_modules%1$s.bin%1$svite', DIRECTORY_SEPARATOR),
|
|
'build',
|
|
$this->option('silent') ? '--logLevel=silent' : '',
|
|
);
|
|
|
|
return $command;
|
|
}
|
|
|
|
/**
|
|
* Return values to append to the command env
|
|
*/
|
|
protected function createCommandEnv(string $configPath): array
|
|
{
|
|
return [
|
|
'VITE_BASE' => Str::after($this->getPackagePath($configPath), base_path()),
|
|
];
|
|
}
|
|
}
|