scaffold-command
scaffold-command copied to clipboard
Add template/composer.json
Adding a composer.json template would encourage developers to make their plugins available via Packagist, and also allow local install of dependencies.
Currently, WPCS + PHPCS is made available via a global composer install here for Travis.
I haven't yet found a template for the plugin's composer.json, but adding WPCS + PHPCS + PHPCompatibility + DealerDirect/phpcodesniffer-composer-installer to a composer.json would make PHPCS runnable from local, without Travis.
I can't think of any issues with adding a composer.json for wp scaffold plugin.
However, the original reason for installing WPCS as a global install was to avoid overwriting an existing composer.json in wp scaffold plugin-tests. As such, an implementation for wp scaffold plugin-tests that wanted to create a composer.json would also need to programmatically modify an existing composer.json.
As noted in #161, I'd strongly advise to use the phpcompatibility/phpcompatibility-wp dependency instead of PHPCompatibility.
I was thinking about this and I agree that editing an existing composer file is a potential issue. However, that could be a potential issue regardless. Someone might have an existing project they want to add tests to.
So I thought instead of reinventing the wheel in order to update the composer.json file, can/should the wp scaffold plugin file check to see if the composer file exists and if it does use shell_exec() or something similar to run the composer commands to add the packages to the project?