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
69 lines
1.6 KiB
PHP
69 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace System\Console\Asset\Npm;
|
|
|
|
use System\Console\Asset\Npm\NpmCommand;
|
|
use Winter\Storm\Exception\SystemException;
|
|
|
|
class NpmUpdate extends NpmCommand
|
|
{
|
|
/**
|
|
* @var string|null The default command name for lazy loading.
|
|
*/
|
|
protected static $defaultName = 'npm:update';
|
|
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
protected $description = 'Update Node.js dependencies required for mixed assets';
|
|
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
protected $signature = 'npm:update
|
|
{package? : The package name to add configuration for.}
|
|
{npmArgs?* : Arguments to pass through to the "npm" binary.}
|
|
{--npm= : Defines a custom path to the "npm" binary.}
|
|
{--a|save : Tell npm to update package.json.}
|
|
{--s|silent : Silent mode.}
|
|
{--disable-tty : Disable tty mode}';
|
|
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
public $replaces = [
|
|
'mix:update'
|
|
];
|
|
|
|
/**
|
|
* Execute the console command.
|
|
*/
|
|
public function handle(): int
|
|
{
|
|
$command = ($this->argument('npmArgs')) ?? [];
|
|
|
|
try {
|
|
[$package, $packageJson] = $this->getPackage();
|
|
} catch (SystemException $e) {
|
|
if (!str_contains($e->getMessage(), 'is not a registered package.')) {
|
|
throw $e;
|
|
}
|
|
array_unshift($command, $this->argument('package'));
|
|
}
|
|
|
|
$args = ['npm', 'update'];
|
|
|
|
if ($this->option('save')) {
|
|
$args[] = '--save';
|
|
}
|
|
|
|
if (count($command)) {
|
|
$args[] = '--';
|
|
}
|
|
|
|
array_unshift($command, ...$args);
|
|
|
|
return $this->npmRun($command, $package['path'] ?? '');
|
|
}
|
|
}
|