craftcms/generator

Handle bug when making a private plugin

marcusgaius opened this issue ยท 3 comments

Description

While making a private plugin, I opted for a handle without an underscore. The generator ignored it, and added an underscore to the beginning of the handle anyway at the end. Whether this is an intended behavior or not, I couldn't say, however, it seems to be counterintuitive, and should specify how private plugins will always get a leading underscore at the end or something like that.

Related key in composer.json:
image

Steps to reproduce

  1. In terminal, run command php craft make plugin --with-docblocks
  2. At the step Plugin Handle, type a handle without an underscore, ie test-plugin

Additional info

  • Craft version: 4.4.8
  • PHP version: 8.0.28
  • Database driver & version: MySQL 8.0.32
  • Plugins & versions:
    • Amazon S3 2.0.3
    • Craft Commerce 4.2.7
    • Formie 2.0.27.1
    • Navigation 2.0.17
    • Neo 3.7.7
    • Read-only Field 2.0.1
    • Redactor 3.0.4
    • SEOmatic 4.0.24

Yeah private plugins are identified by the fact that their handle begins with an underscore. Just updated the validation error to clarify that, for the next release:

> Plugin handle: [_foo] foo
Private plugin handles must begin with an underscore.

After I have reported the issue, I realized that the underscore might be the defining characteristic of a private plugin.
An error response for the prompt is the perfect fit.

Generator 1.5.0 is out with that change!