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
67 lines
1.9 KiB
PHP
67 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace System\Console\Asset\Npm;
|
|
|
|
use System\Console\Asset\Npm\NpmCommand;
|
|
|
|
class NpmRun extends NpmCommand
|
|
{
|
|
/**
|
|
* @var string|null The default command name for lazy loading.
|
|
*/
|
|
protected static $defaultName = 'npm:run';
|
|
|
|
/**
|
|
* @var string The name and signature of this command.
|
|
*/
|
|
protected $signature = 'npm:run
|
|
{package : Defines the package where the script is located.}
|
|
{script : The name of the script to run, as defined in the package.json "scripts" config.}
|
|
{additionalArgs?* : Arguments to pass through to the script being run.}
|
|
{--f|production : Runs the script in "production" mode.}
|
|
{--s|silent : Silent mode.}
|
|
{--disable-tty : Disable tty mode}';
|
|
|
|
/**
|
|
* @var string The console command description.
|
|
*/
|
|
protected $description = 'Runs a script in a given package.';
|
|
|
|
/**
|
|
* @var array List of commands that this command replaces (aliases)
|
|
*/
|
|
protected $replaces = [
|
|
'mix:run'
|
|
];
|
|
|
|
/**
|
|
* Execute the console command.
|
|
*/
|
|
public function handle(): int
|
|
{
|
|
[$package, $packageJson] = $this->getPackage();
|
|
|
|
$script = $this->argument('script');
|
|
|
|
if (!$packageJson->hasScript($script)) {
|
|
$this->error(
|
|
sprintf('Script "%s" is not defined in package "%s".', $script, $this->argument('package'))
|
|
);
|
|
return 1;
|
|
}
|
|
|
|
if (!$this->option('silent')) {
|
|
$this->info(sprintf('Running script "%s" in package "%s"', $script, $this->argument('package')));
|
|
}
|
|
|
|
$command = ($this->argument('additionalArgs')) ?? [];
|
|
if (count($command)) {
|
|
array_unshift($command, 'npm', 'run', $script, '--');
|
|
} else {
|
|
array_unshift($command, 'npm', 'run', $script);
|
|
}
|
|
|
|
return $this->npmRun($command, $package['path']);
|
|
}
|
|
}
|