feat: VivesPOS landing on Winter CMS 1.2 — theme + plugin + Dockerfile
Some checks are pending
Module sub-split / Sub-split (push) Waiting to run
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
This commit is contained in:
79
modules/system/console/asset/vite/ViteCompile.php
Normal file
79
modules/system/console/asset/vite/ViteCompile.php
Normal file
@@ -0,0 +1,79 @@
|
||||
<?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()),
|
||||
];
|
||||
}
|
||||
}
|
||||
64
modules/system/console/asset/vite/ViteCreate.php
Normal file
64
modules/system/console/asset/vite/ViteCreate.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace System\Console\Asset\Vite;
|
||||
|
||||
use System\Console\Asset\AssetCreate;
|
||||
|
||||
class ViteCreate extends AssetCreate
|
||||
{
|
||||
/**
|
||||
* @var string|null The default command name for lazy loading.
|
||||
*/
|
||||
protected static $defaultName = 'vite:create';
|
||||
|
||||
/**
|
||||
* @var string The name and signature of this command.
|
||||
*/
|
||||
protected $signature = 'vite:create
|
||||
{packageName : The package name to add configuration for}
|
||||
{--no-stubs : Disable stub file generation}
|
||||
{--s|silent : Enables silent mode, no output will be shown.}
|
||||
{--f|force : Force file overwrites}';
|
||||
|
||||
/**
|
||||
* @var array List of commands that this command replaces (aliases)
|
||||
*/
|
||||
protected $replaces = [
|
||||
'vite:config',
|
||||
];
|
||||
|
||||
/**
|
||||
* The type of compilable to configure
|
||||
*/
|
||||
protected string $assetType = 'vite';
|
||||
|
||||
/**
|
||||
* The name of the config file
|
||||
*/
|
||||
protected string $configFile = 'vite.config.mjs';
|
||||
|
||||
/**
|
||||
* Output a helpful message with the twig code to set up vite after config generation is complete
|
||||
*/
|
||||
public function afterExecution(): void
|
||||
{
|
||||
if ($this->option('silent')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$packageName = $this->makePackageName($this->argument('packageName'));
|
||||
$this->output->writeln('');
|
||||
$this->info('Add the following to your twig to enable asset loading:');
|
||||
if ($this->option('react')) {
|
||||
$this->output->writeln(sprintf(
|
||||
'<fg=blue>{{ viteReactRefresh(\'%1$s\') }}</>',
|
||||
strtolower($this->argument('packageName'))
|
||||
));
|
||||
}
|
||||
$this->output->writeln(sprintf(
|
||||
'<fg=blue>{{ vite([\'assets/src/css/%1$s.css\', \'assets/src/js/%1$s.js\'], \'%2$s\') }}</>',
|
||||
$packageName,
|
||||
strtolower($this->argument('packageName'))
|
||||
));
|
||||
}
|
||||
}
|
||||
47
modules/system/console/asset/vite/ViteInstall.php
Normal file
47
modules/system/console/asset/vite/ViteInstall.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace System\Console\Asset\Vite;
|
||||
|
||||
use System\Console\Asset\AssetInstall;
|
||||
|
||||
class ViteInstall extends AssetInstall
|
||||
{
|
||||
/**
|
||||
* @var string|null The default command name for lazy loading.
|
||||
*/
|
||||
protected static $defaultName = 'vite:install';
|
||||
|
||||
/**
|
||||
* @var string The name and signature of this command.
|
||||
*/
|
||||
protected $signature = 'vite:install
|
||||
{assetPackage?* : The asset package name to install.}
|
||||
{--no-install : Tells Winter not to run npm install after config update.}
|
||||
{--npm= : Defines a custom path to the "npm" binary.}
|
||||
{--d|disable-tty : Disable tty mode.}
|
||||
{--s|silent : Enables silent mode, no output will be shown.}
|
||||
{--p|package-json= : Defines a custom path to "package.json" file. Must be above the workspace path.}';
|
||||
|
||||
/**
|
||||
* @var string The console command description.
|
||||
*/
|
||||
protected $description = 'Install Node.js dependencies required for vite assets';
|
||||
|
||||
/**
|
||||
* The type of compilable to configure
|
||||
*/
|
||||
protected string $assetType = 'vite';
|
||||
|
||||
/**
|
||||
* The asset config file
|
||||
*/
|
||||
protected string $configFile = 'vite.config.mjs';
|
||||
|
||||
/**
|
||||
* The required packages for this compiler
|
||||
*/
|
||||
protected array $requiredDependencies = [
|
||||
'vite' => '^6.0.0',
|
||||
'laravel-vite-plugin' => '^1.1.0',
|
||||
];
|
||||
}
|
||||
29
modules/system/console/asset/vite/ViteList.php
Normal file
29
modules/system/console/asset/vite/ViteList.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace System\Console\Asset\Vite;
|
||||
|
||||
use System\Console\Asset\AssetList;
|
||||
|
||||
class ViteList extends AssetList
|
||||
{
|
||||
/**
|
||||
* @var string|null The default command name for lazy loading.
|
||||
*/
|
||||
protected static $defaultName = 'vite:list';
|
||||
|
||||
/**
|
||||
* @var string The name and signature of this command.
|
||||
*/
|
||||
protected $signature = 'vite:list
|
||||
{--json : Output as JSON}';
|
||||
|
||||
/**
|
||||
* @var string The console command description.
|
||||
*/
|
||||
protected $description = 'List all registered Vite packages in this project.';
|
||||
|
||||
/**
|
||||
* The asset compiler being used
|
||||
*/
|
||||
protected string $assetType = 'vite';
|
||||
}
|
||||
72
modules/system/console/asset/vite/ViteWatch.php
Normal file
72
modules/system/console/asset/vite/ViteWatch.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace System\Console\Asset\Vite;
|
||||
|
||||
use Winter\Storm\Support\Facades\File;
|
||||
|
||||
class ViteWatch extends ViteCompile
|
||||
{
|
||||
/**
|
||||
* @var string|null The default command name for lazy loading.
|
||||
*/
|
||||
protected static $defaultName = 'vite:watch';
|
||||
|
||||
/**
|
||||
* @var string The name and signature of this command.
|
||||
*/
|
||||
protected $signature = 'vite:watch
|
||||
{package : The package to watch for changes (ex. author.plugin, theme-code, etc)}
|
||||
{viteArgs?* : Arguments to pass through to the Webpack CLI}
|
||||
{--f|production : Runs compilation in "production" mode}
|
||||
{--m|manifest= : Defines package.json to use for compile}
|
||||
{--s|silent : Enables silent mode, no output will be shown.}
|
||||
{--d|disable-tty : Disable tty mode}
|
||||
{--no-progress : Do not show mix progress}';
|
||||
|
||||
/**
|
||||
* @var string The console command description.
|
||||
*/
|
||||
protected $description = 'Vite and compile assets on-the-fly as changes are made.';
|
||||
|
||||
/**
|
||||
* @var array List of commands that this command replaces (aliases)
|
||||
*/
|
||||
protected $replaces = [
|
||||
'vite:dev'
|
||||
];
|
||||
|
||||
/**
|
||||
* Call the AssetCompile::watchHandle with the vite type
|
||||
*/
|
||||
public function handle(): int
|
||||
{
|
||||
return $this->watchHandle('vite');
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the command array to create a Process object with
|
||||
*/
|
||||
protected function createCommand(string $configPath): array
|
||||
{
|
||||
$command = parent::createCommand($configPath);
|
||||
$key = array_search('build', $command);
|
||||
unset($command[$key]);
|
||||
|
||||
$command[] = '--host';
|
||||
|
||||
return array_values($command);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the cleanup of this command if a termination signal is received
|
||||
*/
|
||||
public function handleCleanup(): void
|
||||
{
|
||||
$this->newLine();
|
||||
$this->info('Running compile to ensure files exist after exit');
|
||||
|
||||
$this->call('vite:compile', [
|
||||
'--package' => $this->argument('package'),
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user