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
56 lines
1.5 KiB
PHP
56 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace System\Console\Asset\Npm;
|
|
|
|
use System\Console\Asset\Npm\NpmCommand;
|
|
use Winter\Storm\Exception\SystemException;
|
|
|
|
class NpmInstall extends NpmCommand
|
|
{
|
|
/**
|
|
* @var string|null The default command name for lazy loading.
|
|
*/
|
|
protected static $defaultName = 'npm:install';
|
|
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
protected $description = 'Install Node.js dependencies for a package';
|
|
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
protected $signature = 'npm:install
|
|
{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}
|
|
{--d|dev : Install packages in devDependencies}
|
|
{--s|silent : Silent mode.}
|
|
{--disable-tty : Disable tty mode}';
|
|
|
|
/**
|
|
* 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'));
|
|
}
|
|
|
|
array_unshift($command, 'npm', 'install');
|
|
|
|
if ($this->option('dev')) {
|
|
$command[] = '--save-dev';
|
|
}
|
|
|
|
return $this->npmRun($command, $package['path'] ?? '');
|
|
}
|
|
}
|