zero1/magento-dev

2.1.0 2024-06-25 14:07 UTC

This package is auto-updated.

Last update: 2024-09-25 14:51:32 UTC


README

本项目灵感来源于Laravel的artisan make命令。这是一个正在开发中的项目,欢迎任何反馈或贡献。

特性

待办事项

  • 重构路由逻辑为OOP(如观察者逻辑)
  • 重构CLI命令逻辑为OOP(如观察者逻辑)

供应商补丁

从供应商目录生成补丁的能力。例如,如果你需要为模块制作一个修复,而供应商还没有提供补丁。

摘要

./vendor/bin/magentodev vendor:diff

详细/补丁生成

./vendor/bin/magentodev vendor:diff --package=magento/framework

模块创建

摘要

./vendor/bin/magentodev module:make

创建CLI命令

Description:
  Add a CLI command to an existing extension.

Usage:
  make:cli-command [options] [--] [<--force>]

Arguments:
  --force                                        If supplied and class/file exists,  it will be overwritten [default: false]

Options:
      --name=NAME                                Name of the module (Magento module name, MyCompany_MyModule)
      --command-class-name[=COMMAND-CLASS-NAME]  Name of the class for the command (MyCommand)
      --command-signature[=COMMAND-SIGNATURE]    The signature of the command. (defaults to example:command)
      --command-help[=COMMAND-HELP]              The help/description of the command (default "")
  -h, --help                                     Display this help message
  -q, --quiet                                    Do not output any message
  -V, --version                                  Display this application version
      --ansi                                     Force ANSI output
      --no-ansi                                  Disable ANSI output
  -n, --no-interaction                           Do not ask any interactive question
  -v|vv|vvv, --verbose                           Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

示例

./vendor/bin/magentodev make:cli-command

创建控制器

Description:
  Create a controller

Usage:
  make:controller [options]

Options:
      --name=NAME                    Name of the module (Magento module name, MyCompany_MyModule)
      --area=AREA                    Area (frontend, adminhtml, rest-api)
      --frontname=FRONTNAME          Front name of the controller (e.g https://www.example.com/FRONTNAME/controller/action)
      --controller=CONTROLLER        Controller (e.g https://www.example.com/frontname/CONTROLLER/action)
      --action=ACTION                Action (e.g https://www.example.com/frontname/controller/ACTION)
      --response-type=RESPONSE-TYPE  Response type (html, json, txt)
      --http-method=HTTP-METHOD      HTTP Method (GET, POST)
      --force                        Overwrite files without asking.
  -h, --help                         Display help for the given command. When no command is given display help for the list command
  -q, --quiet                        Do not output any message
  -V, --version                      Display this application version
      --ansi|--no-ansi               Force (or disable --no-ansi) ANSI output
  -n, --no-interaction               Do not ask any interactive question
  -v|vv|vvv, --verbose               Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Help:
  This command allows you to create a controller within a module

创建观察者

Description:
  Create an observer

Usage:
  make:observer [options]

Options:
      --name=NAME       Name of the module (Magento module name, MyCompany_MyModule)
      --area=AREA       Area (global, adminhtml, crontab, frontend, graphql, webapi_rest, webapi_soap), provide comma separated list for multiple.
      --event=EVENT     Event name to listen to
      --force           Overwrite files without asking.
  -h, --help            Display help for the given command. When no command is given display help for the list command
  -q, --quiet           Do not output any message
  -V, --version         Display this application version
      --ansi|--no-ansi  Force (or disable --no-ansi) ANSI output
  -n, --no-interaction  Do not ask any interactive question
  -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Help:
  This command allows you to create an observer for a specific event within a module

计划特性

  • 模块模板
  • 更友好的子模块管理界面
  • 自动创建插件/组件/模型。

已知问题

  • 目前当文件更新时,XML文件中的注释会丢失。

模块开发中

  1. git submodule add --name Zero1_MagentoDeveloperUtils --branch dev git@github.com:zero1limited/magento2-developer-utils.git extensions/zero1/magento2-developer-utils
"zero1-dev-extensions": {
      "type": "path",
      "url": "extensions/zero1/magento2-developer-utils",
      "options": {
          "symlink": true
      }
  }
  1. composer require --dev zero1/magento-dev:@dev