jonathantorres / construct

A PHP project/micro-package generator for PDS compliant projects or micro-packages.
MIT License
266 stars 16 forks source link

Add a Composer script namespace option #159

Open raphaelstolt opened 7 years ago

raphaelstolt commented 7 years ago

The generated Composer script could be namespaced. With a new --composer-script-namespace option the namespace could be injected.

When not set the Composer script namespace should be derived from the project name.

If it's a short name (<=9 characters) it should be taken as is while being lowercased.

 Logger => logger

If it's a long name it should be build from the initial letters while also being lowercased. .

SomeUsefulLibrary => sul
Some-useful-Library => sul
some_Useful_library => sul

Having namespaced Composer scripts adds documentation while also introducing a typing overhead.

> composer 
 sul
  sul:application-version-guard  Run the sul:application-version-guard script as defined in composer.json.
  sul:configure-commit-template  Run the sul:configure-commit-template script as defined in composer.json.
  sul:cs-fix                     Run the sul:cs-fix script as defined in composer.json.
  sul:cs-lint                    Run the sul:cs-lint script as defined in composer.json.
  sul:test                       Run the sul:test script as defined in composer.json.
  sul:test-with-coverage         Run the sul:test-with-coverage script as defined in composer.json.
  sul:travis-lint                Run the sul:travis-lint script as defined in composer.json.

What's your opinion on this?

Should we also namespace the construct Composer scripts?