first commit
This commit is contained in:
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
|
||||
namespace Laravel\Roster\Scanners;
|
||||
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Laravel\Roster\Approach;
|
||||
use Laravel\Roster\Enums\Approaches;
|
||||
use Laravel\Roster\Enums\Packages;
|
||||
use Laravel\Roster\Package;
|
||||
|
||||
abstract class BasePackageScanner
|
||||
{
|
||||
/**
|
||||
* Map of package names to enums
|
||||
*
|
||||
* @var array<string, Packages|Approaches|array<int, Packages|Approaches>>
|
||||
*/
|
||||
protected array $map = [
|
||||
'alpinejs' => Packages::ALPINEJS,
|
||||
'eslint' => Packages::ESLINT,
|
||||
'@inertiajs/react' => [Packages::INERTIA, Packages::INERTIA_REACT],
|
||||
'@inertiajs/svelte' => [Packages::INERTIA, Packages::INERTIA_SVELTE],
|
||||
'@inertiajs/vue3' => [Packages::INERTIA, Packages::INERTIA_VUE],
|
||||
'laravel-echo' => Packages::ECHO,
|
||||
'@laravel/vite-plugin-wayfinder' => [Packages::WAYFINDER, Packages::WAYFINDER_VITE],
|
||||
'prettier' => Packages::PRETTIER,
|
||||
'react' => Packages::REACT,
|
||||
'tailwindcss' => [Packages::TAILWINDCSS],
|
||||
'vue' => Packages::VUE,
|
||||
];
|
||||
|
||||
public function __construct(protected string $path) {}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Support\Collection<int, \Laravel\Roster\Package|\Laravel\Roster\Approach>
|
||||
*/
|
||||
abstract public function scan(): Collection;
|
||||
|
||||
/**
|
||||
* Check if the scanner can handle the given path
|
||||
*/
|
||||
abstract public function canScan(): bool;
|
||||
|
||||
/**
|
||||
* Process dependencies and add them to the mapped items collection
|
||||
*
|
||||
* @param array<string, string> $dependencies
|
||||
* @param Collection<int, Package|Approach> $mappedItems
|
||||
* @param ?callable $versionCb - callback to override version
|
||||
*/
|
||||
protected function processDependencies(array $dependencies, Collection $mappedItems, bool $isDev, ?callable $versionCb = null): void
|
||||
{
|
||||
foreach ($dependencies as $packageName => $version) {
|
||||
$mappedPackage = $this->map[$packageName] ?? null;
|
||||
if (is_null($mappedPackage)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (! is_array($mappedPackage)) {
|
||||
$mappedPackage = [$mappedPackage];
|
||||
}
|
||||
|
||||
if (! is_null($versionCb)) {
|
||||
$version = $versionCb($packageName, $version);
|
||||
}
|
||||
|
||||
foreach ($mappedPackage as $mapped) {
|
||||
$niceVersion = preg_replace('/[^0-9.]/', '', $version) ?? '';
|
||||
$mappedItems->push(match (get_class($mapped)) {
|
||||
Packages::class => new Package($mapped, $packageName, $niceVersion, $isDev),
|
||||
Approaches::class => new Approach($mapped),
|
||||
default => throw new \InvalidArgumentException('Unsupported mapping')
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Common file validation logic
|
||||
*/
|
||||
protected function validateFile(string $path, string $type = 'Package'): ?string
|
||||
{
|
||||
if (! file_exists($path)) {
|
||||
Log::warning("Failed to scan $type: $path");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! is_readable($path)) {
|
||||
Log::warning("File not readable: $path");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
$contents = file_get_contents($path);
|
||||
if ($contents === false) {
|
||||
Log::warning("Failed to read $type: $path");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
return $contents;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
namespace Laravel\Roster\Scanners;
|
||||
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class BunPackageLock extends BasePackageScanner
|
||||
{
|
||||
/**
|
||||
* @return \Illuminate\Support\Collection<int, \Laravel\Roster\Package|\Laravel\Roster\Approach>
|
||||
*/
|
||||
public function scan(): Collection
|
||||
{
|
||||
$mappedItems = collect();
|
||||
$lockFilePath = $this->path.'bun.lock';
|
||||
|
||||
$contents = $this->validateFile($lockFilePath);
|
||||
if ($contents === null) {
|
||||
return $mappedItems;
|
||||
}
|
||||
|
||||
// Remove trailing commas before decoding
|
||||
/** @var string $contents */
|
||||
$contents = preg_replace('/,\s*([]}])/m', '$1', $contents);
|
||||
$json = json_decode($contents, true);
|
||||
if (json_last_error() !== JSON_ERROR_NONE || ! is_array($json)) {
|
||||
Log::warning('Failed to decode Package: '.$lockFilePath.'. '.json_last_error_msg());
|
||||
|
||||
return $mappedItems;
|
||||
}
|
||||
|
||||
/** @var array<string, array<string, mixed>> $json */
|
||||
if (! isset($json['workspaces']['']) || ! isset($json['packages'])) {
|
||||
Log::warning('Malformed bun.lock');
|
||||
|
||||
return $mappedItems;
|
||||
}
|
||||
|
||||
/** @var array<string, mixed> $workspace */
|
||||
$workspace = $json['workspaces'][''];
|
||||
|
||||
/** @var array<string, string> $dependencies */
|
||||
$dependencies = $workspace['dependencies'] ?? [];
|
||||
/** @var array<string, string> $devDependencies */
|
||||
$devDependencies = $workspace['devDependencies'] ?? [];
|
||||
|
||||
$this->processDependencies($dependencies, $mappedItems, false);
|
||||
$this->processDependencies($devDependencies, $mappedItems, true);
|
||||
|
||||
return $mappedItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the scanner can handle the given path
|
||||
*/
|
||||
public function canScan(): bool
|
||||
{
|
||||
return file_exists($this->path.'bun.lock');
|
||||
}
|
||||
}
|
||||
+196
@@ -0,0 +1,196 @@
|
||||
<?php
|
||||
|
||||
namespace Laravel\Roster\Scanners;
|
||||
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Laravel\Roster\Approach;
|
||||
use Laravel\Roster\Enums\Approaches;
|
||||
use Laravel\Roster\Enums\Packages;
|
||||
use Laravel\Roster\Package;
|
||||
|
||||
class Composer
|
||||
{
|
||||
/**
|
||||
* Map of composer package names to enums
|
||||
*
|
||||
* @var array<string, Packages|Approaches|array<int, Packages|Approaches>|null>
|
||||
*/
|
||||
protected array $map = [
|
||||
'filament/filament' => Packages::FILAMENT,
|
||||
'inertiajs/inertia-laravel' => [Packages::INERTIA, Packages::INERTIA_LARAVEL],
|
||||
'larastan/larastan' => Packages::LARASTAN,
|
||||
'laravel/breeze' => Packages::BREEZE,
|
||||
'laravel/cashier' => Packages::CASHIER,
|
||||
'laravel/dusk' => Packages::DUSK,
|
||||
'laravel/envoy' => Packages::ENVOY,
|
||||
'laravel/folio' => Packages::FOLIO,
|
||||
'laravel/fortify' => Packages::FORTIFY,
|
||||
'laravel/framework' => Packages::LARAVEL,
|
||||
'laravel/horizon' => Packages::HORIZON,
|
||||
'laravel/mcp' => Packages::MCP,
|
||||
'laravel/nightwatch' => Packages::NIGHTWATCH,
|
||||
'laravel/nova' => Packages::NOVA,
|
||||
'laravel/octane' => Packages::OCTANE,
|
||||
'laravel/passport' => Packages::PASSPORT,
|
||||
'laravel/pennant' => Packages::PENNANT,
|
||||
'laravel/pint' => Packages::PINT,
|
||||
'laravel/prompts' => Packages::PROMPTS,
|
||||
'laravel/pulse' => Packages::PULSE,
|
||||
'laravel/reverb' => Packages::REVERB,
|
||||
'laravel/sail' => Packages::SAIL,
|
||||
'laravel/sanctum' => Packages::SANCTUM,
|
||||
'laravel/scout' => Packages::SCOUT,
|
||||
'laravel/socialite' => Packages::SOCIALITE,
|
||||
'laravel/telescope' => Packages::TELESCOPE,
|
||||
'laravel/wayfinder' => [Packages::WAYFINDER, Packages::WAYFINDER_LARAVEL],
|
||||
'livewire/flux' => Packages::FLUXUI_FREE,
|
||||
'livewire/flux-pro' => Packages::FLUXUI_PRO,
|
||||
'livewire/livewire' => Packages::LIVEWIRE,
|
||||
'livewire/volt' => Packages::VOLT,
|
||||
'pestphp/pest' => Packages::PEST,
|
||||
'phpunit/phpunit' => Packages::PHPUNIT,
|
||||
'rector/rector' => Packages::RECTOR,
|
||||
'statamic/cms' => Packages::STATAMIC,
|
||||
'tightenco/ziggy' => Packages::ZIGGY,
|
||||
];
|
||||
|
||||
/** @var array<string, array{constraint: string, isDev: bool}> */
|
||||
protected array $directPackages = [];
|
||||
|
||||
/**
|
||||
* @param string $path - composer.lock
|
||||
*/
|
||||
public function __construct(protected string $path) {}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Support\Collection<int, \Laravel\Roster\Package|\Laravel\Roster\Approach>
|
||||
*/
|
||||
public function scan(): Collection
|
||||
{
|
||||
$mappedItems = collect([]);
|
||||
|
||||
if (! file_exists($this->path)) {
|
||||
Log::warning('Failed to scan Composer: '.$this->path);
|
||||
|
||||
return $mappedItems;
|
||||
}
|
||||
|
||||
if (! is_readable($this->path)) {
|
||||
Log::warning('File not readable: '.$this->path);
|
||||
|
||||
return $mappedItems;
|
||||
}
|
||||
|
||||
$contents = file_get_contents($this->path);
|
||||
if ($contents === false) {
|
||||
Log::warning('Failed to read Composer: '.$this->path);
|
||||
|
||||
return $mappedItems;
|
||||
}
|
||||
|
||||
$json = json_decode($contents, true);
|
||||
if (json_last_error() !== JSON_ERROR_NONE || ! is_array($json)) {
|
||||
Log::warning('Failed to decode Composer: '.$this->path.'. '.json_last_error_msg());
|
||||
|
||||
return $mappedItems;
|
||||
}
|
||||
|
||||
if (! array_key_exists('packages', $json)) {
|
||||
Log::warning('Malformed composer.lock');
|
||||
|
||||
return $mappedItems;
|
||||
}
|
||||
|
||||
$this->directPackages = $this->direct();
|
||||
$packages = $json['packages'] ?? [];
|
||||
$devPackages = $json['packages-dev'] ?? [];
|
||||
|
||||
$this->processPackages($packages, $mappedItems, false);
|
||||
$this->processPackages($devPackages, $mappedItems, true);
|
||||
|
||||
return $mappedItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns direct dependencies as defined in composer.json
|
||||
*
|
||||
* @return array<string, array{constraint: string, isDev: bool}>
|
||||
* */
|
||||
protected function direct(): array
|
||||
{
|
||||
$packages = [];
|
||||
$filename = realpath(dirname($this->path)).DIRECTORY_SEPARATOR.'composer.json';
|
||||
if (file_exists($filename) === false || is_readable($filename) === false) {
|
||||
return $packages;
|
||||
}
|
||||
|
||||
$json = file_get_contents($filename);
|
||||
if ($json === false) {
|
||||
return $packages;
|
||||
}
|
||||
|
||||
$json = json_decode($json, true);
|
||||
if (json_last_error() !== JSON_ERROR_NONE || ! is_array($json)) {
|
||||
return $packages;
|
||||
}
|
||||
|
||||
foreach (($json['require'] ?? []) as $name => $constraint) {
|
||||
$packages[$name] = [
|
||||
'constraint' => $constraint,
|
||||
'isDev' => false,
|
||||
];
|
||||
}
|
||||
|
||||
foreach (($json['require-dev'] ?? []) as $name => $constraint) {
|
||||
$packages[$name] = [
|
||||
'constraint' => $constraint,
|
||||
'isDev' => true,
|
||||
];
|
||||
}
|
||||
|
||||
return $packages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Process packages and add them to the mapped items collection
|
||||
*
|
||||
* @param array<int, array<string, string>> $packages
|
||||
* @param Collection<int, Package|Approach> $mappedItems
|
||||
* @return Collection<int, Package|Approach>
|
||||
*/
|
||||
private function processPackages(array $packages, Collection $mappedItems, bool $isDev): Collection
|
||||
{
|
||||
foreach ($packages as $package) {
|
||||
$packageName = $package['name'] ?? '';
|
||||
$version = $package['version'] ?? '';
|
||||
$mappedPackage = $this->map[$packageName] ?? null;
|
||||
$direct = false;
|
||||
$constraint = $version;
|
||||
|
||||
if (is_null($mappedPackage)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (! is_array($mappedPackage)) {
|
||||
$mappedPackage = [$mappedPackage];
|
||||
}
|
||||
|
||||
if (array_key_exists($packageName, $this->directPackages) === true) {
|
||||
$direct = true;
|
||||
$constraint = $this->directPackages[$packageName]['constraint'];
|
||||
}
|
||||
|
||||
foreach ($mappedPackage as $mapped) {
|
||||
$niceVersion = preg_replace('/[^0-9.]/', '', $version) ?? '';
|
||||
$mappedItems->push(match (get_class($mapped)) {
|
||||
Packages::class => (new Package($mapped, $packageName, $niceVersion, $isDev))->setDirect($direct)->setConstraint($constraint),
|
||||
Approaches::class => new Approach($mapped),
|
||||
default => throw new \InvalidArgumentException('Unsupported mapping')
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return $mappedItems;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace Laravel\Roster\Scanners;
|
||||
|
||||
use Illuminate\Support\Collection;
|
||||
use Laravel\Roster\Approach;
|
||||
use Laravel\Roster\Enums\Approaches;
|
||||
|
||||
class DirectoryStructure
|
||||
{
|
||||
public function __construct(protected string $path) {}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Support\Collection<int, \Laravel\Roster\Package|\Laravel\Roster\Approach>
|
||||
*/
|
||||
public function scan(): Collection
|
||||
{
|
||||
$items = collect();
|
||||
|
||||
$actions = $this->path.DIRECTORY_SEPARATOR.'/app/'.DIRECTORY_SEPARATOR.'Actions';
|
||||
if (is_dir($actions)) {
|
||||
$items->push(new Approach(Approaches::ACTION));
|
||||
}
|
||||
|
||||
$domains = $this->path.DIRECTORY_SEPARATOR.'/app/'.DIRECTORY_SEPARATOR.'Domains';
|
||||
if (is_dir($domains)) {
|
||||
$items->push(new Approach(Approaches::DDD));
|
||||
}
|
||||
|
||||
return $items;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace Laravel\Roster\Scanners;
|
||||
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class NpmPackageLock extends BasePackageScanner
|
||||
{
|
||||
/**
|
||||
* @return \Illuminate\Support\Collection<int, \Laravel\Roster\Package|\Laravel\Roster\Approach>
|
||||
*/
|
||||
public function scan(): Collection
|
||||
{
|
||||
$mappedItems = collect();
|
||||
$lockFilePath = $this->path.'package-lock.json';
|
||||
|
||||
$contents = $this->validateFile($lockFilePath);
|
||||
if ($contents === null) {
|
||||
return $mappedItems;
|
||||
}
|
||||
|
||||
$json = json_decode($contents, true);
|
||||
if (json_last_error() !== JSON_ERROR_NONE || ! is_array($json)) {
|
||||
Log::warning('Failed to decode Package: '.$lockFilePath.'. '.json_last_error_msg());
|
||||
|
||||
return $mappedItems;
|
||||
}
|
||||
|
||||
if (! array_key_exists('packages', $json)) {
|
||||
Log::warning('Malformed package-lock');
|
||||
|
||||
return $mappedItems;
|
||||
}
|
||||
|
||||
$dependencies = $json['packages']['']['dependencies'] ?? [];
|
||||
$devDependencies = $json['packages']['']['devDependencies'] ?? [];
|
||||
$packages = array_filter($json['packages'], fn ($key) => $key !== '', ARRAY_FILTER_USE_KEY);
|
||||
|
||||
$versionCb = function (string $packageName, string $version) use ($packages): string {
|
||||
$key = "node_modules/{$packageName}";
|
||||
if (array_key_exists($key, $packages)) {
|
||||
return $packages[$key]['version'];
|
||||
}
|
||||
|
||||
return $version;
|
||||
};
|
||||
|
||||
$this->processDependencies($dependencies, $mappedItems, false, $versionCb);
|
||||
$this->processDependencies($devDependencies, $mappedItems, true, $versionCb);
|
||||
|
||||
return $mappedItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the scanner can handle the given path
|
||||
*/
|
||||
public function canScan(): bool
|
||||
{
|
||||
return file_exists($this->path.'package-lock.json');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace Laravel\Roster\Scanners;
|
||||
|
||||
use Illuminate\Support\Collection;
|
||||
use Laravel\Roster\Enums\NodePackageManager;
|
||||
|
||||
class PackageLock
|
||||
{
|
||||
/**
|
||||
* @param string $path - Base path to scan for lock files (package-lock.json, pnpm-lock.yaml, yarn.lock, ...)
|
||||
*/
|
||||
public function __construct(protected string $path) {}
|
||||
|
||||
/**
|
||||
* @return \Illuminate\Support\Collection<int, \Laravel\Roster\Package|\Laravel\Roster\Approach>
|
||||
*/
|
||||
public function scan(): Collection
|
||||
{
|
||||
foreach (NodePackageManager::cases() as $case) {
|
||||
$scanner = $case->scanner($this->path);
|
||||
if ($scanner->canScan()) {
|
||||
return $scanner->scan();
|
||||
}
|
||||
}
|
||||
|
||||
return collect();
|
||||
}
|
||||
|
||||
public function detect(): NodePackageManager
|
||||
{
|
||||
foreach (NodePackageManager::cases() as $case) {
|
||||
$scanner = $case->scanner($this->path);
|
||||
if ($scanner->canScan()) {
|
||||
return $case;
|
||||
}
|
||||
}
|
||||
|
||||
return NodePackageManager::NPM;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace Laravel\Roster\Scanners;
|
||||
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
|
||||
class PnpmPackageLock extends BasePackageScanner
|
||||
{
|
||||
/**
|
||||
* @return \Illuminate\Support\Collection<int, \Laravel\Roster\Package|\Laravel\Roster\Approach>
|
||||
*/
|
||||
public function scan(): Collection
|
||||
{
|
||||
$mappedItems = collect();
|
||||
$lockFilePath = $this->path.'pnpm-lock.yaml';
|
||||
|
||||
$contents = $this->validateFile($lockFilePath, 'PNPM lock');
|
||||
if ($contents === null) {
|
||||
return $mappedItems;
|
||||
}
|
||||
|
||||
try {
|
||||
/** @var array<string, mixed> $parsed */
|
||||
$parsed = Yaml::parse($contents);
|
||||
} catch (\Exception $e) {
|
||||
Log::error('Failed to parse YAML: '.$e->getMessage());
|
||||
|
||||
return $mappedItems;
|
||||
}
|
||||
|
||||
/** @var array<string, string> $dependencies */
|
||||
$dependencies = [];
|
||||
/** @var array<string, string> $devDependencies */
|
||||
$devDependencies = [];
|
||||
|
||||
/** @var array<string, array<string, mixed>> $importers */
|
||||
$importers = $parsed['importers'] ?? [];
|
||||
$root = $importers['.'] ?? [];
|
||||
/** @var array<string, array<string, mixed>> $rootDependencies */
|
||||
$rootDependencies = $root['dependencies'] ?? [];
|
||||
/** @var array<string, array<string, mixed>> $rootDevDependencies */
|
||||
$rootDevDependencies = $root['devDependencies'] ?? [];
|
||||
|
||||
foreach ($rootDependencies as $name => $data) {
|
||||
if (isset($data['version'])) {
|
||||
$dependencies[$name] = $data['version'];
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($rootDevDependencies as $name => $data) {
|
||||
if (isset($data['version'])) {
|
||||
$devDependencies[$name] = $data['version'];
|
||||
}
|
||||
}
|
||||
|
||||
/** @var array<string, string> $dependencies */
|
||||
/** @var array<string, string> $devDependencies */
|
||||
$this->processDependencies($dependencies, $mappedItems, false);
|
||||
$this->processDependencies($devDependencies, $mappedItems, true);
|
||||
|
||||
return $mappedItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the scanner can handle the given path
|
||||
*/
|
||||
public function canScan(): bool
|
||||
{
|
||||
return file_exists($this->path.'pnpm-lock.yaml');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace Laravel\Roster\Scanners;
|
||||
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
class YarnPackageLock extends BasePackageScanner
|
||||
{
|
||||
/**
|
||||
* @return \Illuminate\Support\Collection<int, \Laravel\Roster\Package|\Laravel\Roster\Approach>
|
||||
*/
|
||||
public function scan(): Collection
|
||||
{
|
||||
$mappedItems = collect([]);
|
||||
$lockFilePath = $this->path.'yarn.lock';
|
||||
|
||||
$contents = $this->validateFile($lockFilePath, 'Yarn lock');
|
||||
if ($contents === null) {
|
||||
return $mappedItems;
|
||||
}
|
||||
|
||||
$dependencies = [];
|
||||
$lines = explode("\n", $contents);
|
||||
$currentPackage = null;
|
||||
|
||||
foreach ($lines as $line) {
|
||||
$line = trim($line);
|
||||
|
||||
// Skip comments and empty lines
|
||||
if ($line === '' || str_starts_with($line, '#')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Package header line (e.g. tailwindcss@^3.4.3:)
|
||||
if (preg_match('/^("?)([^@"]+)(@[^:]+)?:\1$/', $line, $matches)) {
|
||||
$currentPackage = $matches[2];
|
||||
}
|
||||
// Version line
|
||||
elseif ($currentPackage && preg_match('/^version\s+"?([^"]+)"?$/', $line, $matches)) {
|
||||
$version = $matches[1];
|
||||
$dependencies[$currentPackage] = $version;
|
||||
$currentPackage = null; // Reset until next package block
|
||||
}
|
||||
}
|
||||
|
||||
// Yarn lock does not distinguish devDependencies :/
|
||||
$this->processDependencies($dependencies, $mappedItems, false);
|
||||
|
||||
return $mappedItems;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the scanner can handle the given path
|
||||
*/
|
||||
public function canScan(): bool
|
||||
{
|
||||
return file_exists($this->path.'yarn.lock');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user