pestle icon indicating copy to clipboard operation
pestle copied to clipboard

Command magento2:generate:module does not generate composer.json

Open Vinai opened this issue 7 years ago • 1 comments

Every module should have a composer.json file, so any dependencies can be added as thy occure during module development. By default the package composer name could be the module name (in lower case), converting CamelCase to kebab-case with a module- prefix (e.g. Pestle_FooBarBaz would become pestle/module-foo-bar-baz. The only dependency added from the start should be the PHP version. No idea about the license, maybe offer that as an argument, or default to proprietary, or add proprietary and an open source one so the owner of the code could delete the unwanted one. Here is an example of what I would find useful:

{
  "name": "example/module-foo-bar",
  "description": "n.a.",
  "require": {
    "php": "^7.0.0"
  },
  "type": "magento2-module",
  "license": [
    "proprietary",
    "BSD-3-Clause"
  ],
  "autoload": {
    "files": [
      "registration.php"
    ],
    "psr-4": {
      "Example\\FooBar\\": ""
    }
  }
}

Vinai avatar Apr 26 '17 04:04 Vinai

Also a good idea -- going to wait until I've reviewed @fooman's talk on working directly in vendor though (per https://github.com/astorm/pestle/issues/275) before we go ahead with this.

astorm avatar Apr 26 '17 16:04 astorm