shel/yaml-splitter
Composer 安装命令:
composer require shel/yaml-splitter
包简介
Splits YAML files
README 文档
README
Features:
- split YAML files containing multiple nodetypes into separate files each containing one nodetype
- reorganize nodetypes files from the old style
Configurationfolder to the newNodeTypesfolder and will also create subfolders based on their naming scheme
Installation
Recommended
Download the Phar version of the latest release.
You can find it after the individual change log in the Assets section.
Afterwards you should make the file executable by running
chmod a+x yaml-splitter.phar
Now you can follow the usage examples below.
Via composer
Add this tool as dependency to your project via
composer require --dev shel/yaml-splitter
Or install the package globally via
composer global require shel/yaml-splitter
Afterwards you can run the commands in your project by prefixing the usage examples like this:
bin/yaml-splitter.php split ...
Usage
List commands
./yaml-splitter.phar list
Show options for split command
./yaml-splitter.phar help split
Split a file
./yaml-splitter.phar split [options] [--] <path> [<output-path>]
This will copy each node type found in the input file into a new file.
Each new file be have a name like NodeTypes.MyNodeType.yaml.
Additionally, each filename will get a prefix after NodeTypes like Document, Content or Mixin
based on the name of the actual node type.
Also, when the option package-key is provided, node types matching the package key will
have the standard naming and others will get names like NodeTypes.Override.SomeOtherNodeType.yaml.
Options
dry-runallows seeing what would happen without writing any fileuse-folderssplits the nodetypes into a folder structure for Neos 7.2+package-keyallows to define the main package key of your node types, so node types with different package keys would be written toNodeTypes.Override.xyzfiles.indentationnumber of spaces for indentation in the resulting YAML files
Example
./yaml-splitter.phar split --dry-run --package-key MyVendor path/to/MyVendor.NodeTypes.yaml path/to/package
Reorganize the nodetypes in a Configuration folder into Neos 7.2+ nodetype subfolders
With Neos 7.2 it's possible to organize nodetypes into separate folders than Configuration.
It also allows you to use subfolders.
With the following command you can move all NodeTypes.*.yaml from a Configuration folder into
another folder. They will automatically be put into subfolders based on their naming scheme.
So for example you have the following files in your Configuration folder of your site package:
Configuration ├── NodeTypes.Content.Image.yaml ├── NodeTypes.Content.Text.yaml ├── NodeTypes.Document.Abstract.Page.yaml ├── NodeTypes.Document.Home.yaml ├── NodeTypes.Document.Page.yaml ├── NodeTypes.Override.Content.Popup.yaml ├── NodeTypes.Override.Mixin.Document.yaml └── NodeTypes.Override.Mixin.MarginMixin.yaml
Now you run the reorganize command:
./yaml-splitter.phar reorganize path/to/sitepackage/Configuration path/to/sitepackage/NodeTypes
After you execute the command you will have the following structure:
NodeTypes ├── Content │ ├── Image.yaml │ └── Text.yaml ├── Document │ ├── Abstract │ │ └── Page.yaml │ ├── Home.yaml │ └── Page.yaml └── Override ├── Content │ └── Popup.yaml └── Mixin ├── Document.yaml └── MarginMixin.yaml
Note: If you still have multiple nodetypes inside one file, it's recommended to first run the split command and then reorganize.
Contributing
The tool is based on the Symfony console component.
Building the phar
First install box.
Then run
composer run compile
shel/yaml-splitter 适用场景与选型建议
shel/yaml-splitter 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 831 次下载、GitHub Stars 达 11, 最近一次更新时间为 2021 年 10 月 11 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「yaml」 「neoscms」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 shel/yaml-splitter 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 shel/yaml-splitter 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 shel/yaml-splitter 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Graphical analysis & visualizer for the Neos CMS nodetypes as backend module
Sync files from various sources to neos assets.
A plugin for Neos CMS which provides a toggle editor.
A plugin for Neos CMS which provides a toggle editor.
A package to render Fusion Out of Band in complex application fun & easy
SUML for PHP
统计信息
- 总下载量: 831
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 11
- 点击次数: 13
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-10-11