ThePHPF / pie-design

94 stars 1 forks source link

Future scope: ability to install any missing extensions for a project using `pie install` #13

Open asgrim opened 3 months ago

asgrim commented 3 months ago

A nice end user improvement in the future, could be something like:

Given a project has a `composer.json` which has dependencies on extensions
When I run `pie install` (with no other parameters)
Then PIE will check `composer.json` for the project's dependencies and install anything missing

So, for example a project depends on ext-json, ext-foo, and ext-imap. Lets say only ext-json exists on the system PHP install. When you run pie install (with no other parameters), it could list the required extensions by the project, and either prompt, or automatically install missing ones, so a hypothetical execution might look like:

$ cat composer.json
{
    "require": {
        "ext-json": "*",
        "ext-foo": "*",
        "ext-imap": "*",
    }
}
$ pie install
Checking currently installed extensions...
 - ✅ ext-json
 - ⚠️ ext-foo - missing
 - ⚠️ ext-imap - missing

Would you like to install ext-foo? The following extensions may be compatible:
  1. user1/foo
  2. user2/foo
Select the extension to install: 1
<installs `user1/foo` - equivalent of `pie install user1/foo`>

Would you like to install ext-imap? The following extensions may be compatible:
  1. php/imap
  2. someone-else/imap
Select the extension to install: 1
<installs `php/imap` - equivalent of `pie install php/imap`>

Re-checking currently installed extensions...
✅ All extensions required by the composer.json are now installed!
$
Tomyh99095 commented 2 months ago

A nice end user improvement in the future, could be something like:

Given a project has a `composer.json` which has dependencies on extensions
When I run `pie install` (with no other parameters)
Then PIE will check `composer.json` for the project's dependencies and install anything missing

So, for example a project depends on ext-json, ext-foo, and ext-imap. Lets say only ext-json exists on the system PHP install. When you run pie install (with no other parameters), it could list the required extensions by the project, and either prompt, or automatically install missing ones, so a hypothetical execution might look like:

$ cat composer.json
{
    "require": {
        "ext-json": "*",
        "ext-foo": "*",
        "ext-imap": "*",
    }
}
$ pie install
Checking currently installed extensions...
 - ✅ ext-json
 - ⚠️ ext-foo - missing
 - ⚠️ ext-imap - missing

Would you like to install ext-foo? The following extensions may be compatible:
  1. user1/foo
  2. user2/foo
Select the extension to install: 1
<installs `user1/foo` - equivalent of `pie install user1/foo`>

Would you like to install ext-imap? The following extensions may be compatible:
  1. php/imap
  2. someone-else/imap
Select the extension to install: 1
<installs `php/imap` - equivalent of `pie install php/imap`>

Re-checking currently installed extensions...
✅ All extensions required by the composer.json are now installed!
$