-
-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tailwind theme create improvements (#1255)
- Loading branch information
Showing
7 changed files
with
131 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 0 additions & 3 deletions
3
modules/cms/console/scaffold/theme/tailwind/assets/src/css/base.stub
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
modules/cms/console/scaffold/theme/tailwind/assets/src/css/custom.stub
This file was deleted.
Oops, something went wrong.
2 changes: 0 additions & 2 deletions
2
modules/cms/console/scaffold/theme/tailwind/assets/src/css/theme.stub
This file was deleted.
Oops, something went wrong.
33 changes: 0 additions & 33 deletions
33
modules/cms/console/scaffold/theme/tailwind/assets/src/js/theme.stub
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<?php | ||
|
||
namespace System\Console\Asset\Npm; | ||
|
||
use Symfony\Component\Process\Process; | ||
use System\Console\Asset\Npm\NpmCommand; | ||
|
||
class NpmVersion extends NpmCommand | ||
{ | ||
const NPM_MINIMUM_SUPPORTED_VERSION = '7.0'; | ||
|
||
/** | ||
* @var string|null The default command name for lazy loading. | ||
*/ | ||
protected static $defaultName = 'npm:version'; | ||
|
||
/** | ||
* @var string The name and signature of this command. | ||
*/ | ||
protected $signature = 'npm:version | ||
{--c|compatible : Report compatible version via exit code.} | ||
{--s|silent : Silent mode.} | ||
{--disable-tty : Disable tty mode}'; | ||
|
||
/** | ||
* @var string The console command description. | ||
*/ | ||
protected $description = 'Runs a script in a given package.'; | ||
|
||
/** | ||
* Execute the console command. | ||
*/ | ||
public function handle(): int | ||
{ | ||
$process = new Process( | ||
['npm', '--version'], | ||
base_path(), | ||
['NODE_ENV' => $this->getNodeEnv()], | ||
null, | ||
null | ||
); | ||
|
||
$output = ''; | ||
|
||
$exit = $process->run(function ($status, $stdout) use (&$output) { | ||
$output .= $stdout; | ||
}); | ||
|
||
$output = trim($output); | ||
|
||
// Npm failed for some reason, report to user | ||
if ($exit !== 0) { | ||
$this->error('NPM exited with error: ' . $output); | ||
return $exit; | ||
} | ||
|
||
// Report the version to user | ||
if (!$this->option('silent')) { | ||
$this->info($output); | ||
} | ||
|
||
// If the user has not requested a compatibility check, then return 0 | ||
if (!$this->option('compatible')) { | ||
return 0; | ||
} | ||
|
||
// If the version of npm is less than the required minimum, then return fail | ||
if (version_compare($output, static::NPM_MINIMUM_SUPPORTED_VERSION, '<')) { | ||
return 1; | ||
} | ||
|
||
return 0; | ||
} | ||
} |