它使用一些M2工具创建一个新的shell命令

dev-master 2019-11-13 18:02 UTC

This package is auto-updated.

Last update: 2024-09-24 22:55:14 UTC


README

WH通过一些M2工具创建一个新的shell命令 {wh}

v.0.1.3

  • 添加了配置选项以在页面顶部显示所有布局句柄

v.0.1.1

  • 添加了 {tools:regenerate} 命令

v.0.1.0

  • 重构了代码并向 {create:module} 命令添加了几个选项

v.0.0.7

  • 添加了 {cloud} 命令

👁️ 安装

  • 转到您的Magento根目录并运行
$ composer require hammer/wh:dev-master
  • 在以下数组中输入您的公司名称、主题、商店和其他可选参数,并将其添加到 app/etc/env.php 文件中
'wh' =>
  array (
      'company_name' => 'CompanyName', // required, where you place your modules (app/code/[CompanyName] or extensions/[CompanyName])
      'default_theme' => 'CompanyName/ThemeName', // required, theme you're currently working on
      'default_store' => 'Default Store View', // required, store you're currently working on
      'localization' => 'en_US', // default localization code
      'composer_files' => 1, // 1 or 0, 1 creates a composer.json on new modules
      'module_version' => '0.0.1', // default version of new modules 
      'dummy_categories' => 1, // default qty of dummy categories
      'dummy_products' => 1, // default qty of dummy products
      'view_product_link' => 1, // 1 or 0, 1 shows 'View Product' link on Admin
      'ask_if_multistore' => 0, // 1 or 0, 1 asks for desired theme/store if multistore
      'save_db_folder' => 'var/dump', // folder to save the database dump
      'display_handles' => 0, // display all layout handles at the top of all pages
      'admin_credentials' => 'username::password', // display credentials on the admin login page 
      'magento_cloud' => 0, // 1 or 0, 1 if using Magento Cloud	
      'magento_cloud_project_id' => '', // magento cloud project ID, if any
      'magento_command' => 'bin/magento' // magento command line
  )  

关于快速开发的注意事项

  1. 我们建议为 "bin/magento" 创建一个系统别名。例如:"bm"
  2. 如果有多站点,我们建议设置 "default_theme" 配置以及 "ask_if_multistore=0"
  • 启用 WH 模块
$ bin/magento module:enable Hammer_WH
$ bin/magento s:up
$ bin/magento c:f
  • 您就可以使用了!您可以通过运行来检查是否正确安装
$ bin/magento wh

更新 WH 模块到最新版本

  • 转到您的Magento根目录并运行
$ composer update hammer/wh

注意:请记住始终在 开发者 模式下开发

👁️ INFO 命令

显示所有可用命令

$ bin/magento wh --help

显示所有可用命令,并可选择其中之一

$ bin/magento wh options (alias op)

显示您的Magento实例信息(版本、版本、模式、会话、加密密钥和安装日期)

$ bin/magento wh info:m2 (alias i:m2)

显示您的所有商店信息(ID、标题和代码)

$ bin/magento wh info:store (alias i:s)

列出模块(及其代码版本)

  • (多选) 模块类型
$ bin/magento wh info:modules (alias i:m)

👁️ CACHE 命令

删除特定缓存以重新生成模板

$ bin/magento wh cache:templates (alias c:t)

删除特定缓存以重新生成布局

$ bin/magento wh cache:layouts (alias c:l)

在更改管理员配置后删除特定缓存

$ bin/magento wh cache:config (alias c:c)

删除 var/cache & var/page_cache

$ bin/magento wh cache:layouts (alias c:v)

删除特定缓存以重新生成DI

$ bin/magento wh cache:generated (alias c:g)

删除特定缓存以重新生成样式

  • (字符串) 主题名称
$ bin/magento wh cache:styles (alias c:s)

删除所有缓存(/var 和 /pub/static 中的所有内容,以及 /generated(如果使用云服务))

$ bin/magento wh cache:all (alias c:a)

删除选定的缓存(用逗号分隔)

  • (多选) 要删除的文件夹(例如:1,3,5)
$ bin/magento wh cache:custom (alias c:cu)

删除特定缓存以重新生成管理员

$ bin/magento wh cache:admin (alias c:ad)

👁️ CREATION 命令

创建新模块

  • (字符串) 模块名称
  • (多选) 安装文件(例如:1,3 以创建 InstallData.php 和 InstallSchema.php)
  • (选择) 功能
    • 扩展 Block/Model 类
    • 为方法创建插件
    • 创建用于显示模板的前端页面
    • 使用 view_model 创建用于显示模板的前端页面
    • 创建用于返回JSON的前端页面
    • 将观察者附加到事件
    • 替换构造函数参数
    • 创建新的命令行
    • 创建带有ACL的REST API
  • (其他选项) 根据选定的功能创建
$ bin/magento wh create:module (alias cr:m)

创建新主题

  • (字符串) 主题名称
  • (整数) 要扩展的主题:空白、Luma(beta)或自定义
$ bin/magento wh create:theme (alias cr:t)

创建虚拟数据

  • (整数) 类别数量
  • (整数) 产品数量
$ bin/magento wh create:dummy (alias cr:d)

👁️ CUSTOMER 命令

创建新客户

  • (字符串) 姓氏
  • (字符串) 名字
  • (字符串) 电子邮件
  • (字符串) 密码
$ bin/magento wh customer:create (alias c:cr)

更新现有客户的密码

  • (字符串) 现有客户的电子邮件(自动完成)
  • (字符串) 新密码
$ bin/magento wh customer:password (alias c:p)

👁️ ADMIN 命令

创建新管理员用户

  • (字符串) 电子邮件
  • (字符串) 用户名
  • (字符串) 密码
$ bin/magento wh admin:create (alias a:cr)

更新现有管理员的密码

  • (字符串) 现有管理员的电子邮件(自动完成)
  • (字符串) 新密码
$ bin/magento wh admin:password (alias a:p)

👁️ 前端工具命令

为指定主题部署前端静态内容

  • (字符串) 主题名称
$ bin/magento wh tools:static (alias t:s)

将核心模板复制到主题以覆盖它

  • (字符串) 主题名称
  • (字符串) 已有模板的路径(例如:vendor/magento/module-checkout/view/frontend/templates/cart.phtml)
$ bin/magento wh override:template (alias o:t)

启用模板提示

$ bin/magento wh hints:on (alias h:on)

禁用模板提示

$ bin/magento wh hints:off (alias h:off)

👁️ 其他工具命令

Magento Cloud 命令列表

$ bin/magento wh cloud
Select a Magento Cloud command for the project:
  [0 ] See project info
  [1 ] See your account info
  [2 ] See all users
  [3 ] See all envs
  [4 ] See env info
  [5 ] See env URLs
  [6 ] See env logs
  [7 ] See env activity (last 10)
  [8 ] Create branch
  [9 ] Activate env
  [10] Download dump of env database
  [11] Get command to connect to env through SSH

在给定文件夹中创建数据库转储

$ bin/magento wh dump

将数据库模块的版本降级到代码中的版本

(在更改分支后使用)

  • (字符串) 已有模块的名称
$ bin/magento wh module:downgrade (alias m:d)

在所有/特定店铺/中重新生成产品/分类的URL重写

  • (多选) 店铺
$ bin/magento wh tools:regenerate (alias t:r)

部署到指定模式

  • (选择) 模式的名称(显示、开发者或生产)
$ bin/magento wh deploy:mode (alias d:m)

显示 M2 片段

  • (选择) 要显示的片段
$ bin/magento wh snippets (alias sn)

向我们发送您的反馈!

📧 wh@magento.com.ar

¯\_(ツ)_/¯

徽章