scaffold-command icon indicating copy to clipboard operation
scaffold-command copied to clipboard

Add template/composer.json

Open GaryJones opened this issue 6 years ago • 3 comments

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.

GaryJones avatar Oct 10 '17 23:10 GaryJones

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.

danielbachhuber avatar Oct 10 '17 23:10 danielbachhuber

As noted in #161, I'd strongly advise to use the phpcompatibility/phpcompatibility-wp dependency instead of PHPCompatibility.

jrfnl avatar Jul 20 '18 18:07 jrfnl

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?

NicktheGeek avatar Jul 21 '18 13:07 NicktheGeek