mindscreen/yarnlock
Composer 安装命令:
composer require mindscreen/yarnlock
包简介
A package for parsing and interpreting yarn.lock files
README 文档
README
A php-package for parsing and evaluating the yarn.lock format.
Basic Usage
<?php use Mindscreen\YarnLock; $yarnLock = YarnLock::fromString(file_get_contents('yarn.lock')); $allPackages = $yarnLock->getPackages(); $hasBabelCore = $yarnLock->hasPackage('babel-core', '^6.0.0'); $babelCorePackages = $yarnLock->getPackagesByName('babel-core'); $babelCoreDependencies = $babelCorePackages[0]->getDependencies();
Package Depth
If you maybe don't just want all packages but only the direct dependencies plus one level of indirection, you have to go a little extra mile:
<?php use Mindscreen\YarnLock; // read the dependencies from the package.json file $packageDependencies = (json_decode(file_get_contents('package.json')))->dependencies; // get these packages from the yarn lock-file $rootDependencies = array_map(function($packageName, $packageVersion) use ($yarnLock) { return $yarnLock->getPackage($packageName, $packageVersion); }, array_keys($packageDependencies), array_values($packageDependencies)); // some of our dependencies might be used by other dependencies deeper down the tree so // they wouldn't appear in the top levels, if we wouldn't explicitly set them there. $yarnLock->calculateDepth($rootDependencies); // get the first two levels; the second argument is the exclusive upper limit $yarnLock->getPackagesByDepth(0, 2);
mindscreen/yarnlock 适用场景与选型建议
mindscreen/yarnlock 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 170.49k 次下载、GitHub Stars 达 4, 最近一次更新时间为 2018 年 02 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 mindscreen/yarnlock 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mindscreen/yarnlock 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 170.49k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 2
- 依赖项目数: 4
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-02-21