GithubHelp home page GithubHelp logo

Comments (8)

pyrech avatar pyrech commented on May 27, 2024

Hi,

Thanks for your interest :)

Yes, removing the manual parts was something we quickly discussed on twitter yesterday. I'm still thinking about what would be the best way to remove these parts. I thought something could be done with the prepare-commit-msg git hook. But as nothing is ready now, I'm quite open for new ideas :)

What would be the workflow with your command?

  • you run the composer update as usual
  • then you run the command commit-lockfile ?

So, unless I'm wrong, we will need to store the summary somewhere, maybe a file in the temp directory? Or do you see another way?

from composer-changelogs.

jakoch avatar jakoch commented on May 27, 2024

Ok, let's throw some ideas around..

  • Yes, a prepare-commit-msg or commit-msg git hook would work

  • I initially thought that a single run of composer update --commit-lockfile could work, because its not used by Composer itself, yet. When the "Changelog Summary" is a buffered output you could display it on screen and then do a exec('git commit -m "' . $changelogSummary . '" path/to/composer.lock');. Probably followed by a message that the lock file was committed automatically.

  • For a two command approach: the composer update run could generate a file bin/commit-lockfile.sh using a template approach for the file content.

    The output could look like:

    #!/bin/sh
    # File generated by Composer Plugin "Changelogs".
    git commit -m "Changelog Summary ..." path/to/composer.lock
    

    The second command is then simply bin/commit-lockfile.sh.

  • Another idea: use CLI interaction. The plugin could question the user by default, if he wants to commit the composer.lock file - directly after displaying the Change Summary.
    This would work because Composer has the CLI argument --no-interaction (-n) to stop asking any interactive question. That leaves there cases to handle:

    • Question "Do you want to commit the composer.lock file?"
      • if Yes, commit the file with summary
      • if No, output changelog and end
    • If --no-interaction output changelog and end (internally probably skipping the question handler).

Maybe leave the issue open for a while to fetch more opinions..

from composer-changelogs.

pyrech avatar pyrech commented on May 27, 2024

Wooot, quite good ideas here :-)

I really like the interactive one. No other command required, integrate smoothly in Composer and the behavior can be controlled by the user.

Let's see if we can get others opinions.

from composer-changelogs.

Fabex avatar Fabex commented on May 27, 2024

Hi
I actually try your plugin and I had the same thought as jakoch about remove manual action.

So, is that issue still alive and do you work on it ?

And for me I like the interactive solution too.

from composer-changelogs.

pyrech avatar pyrech commented on May 27, 2024

Hi :)

The issue is still opened but I didn't start working on it. I'm afraid that automatically trigger a commit could be something that a lot of people could consider surprizing/bad, even in an interactive way.

Maybe we could add an extra setting in the composer.json (global or local) to trigger the interactive question. This default setting would not display the question. Does this workflow could satisfy your use case, you and @jakoch?

from composer-changelogs.

Fabex avatar Fabex commented on May 27, 2024

May be I have another idea.

can we just add an extra setting in the composer.json in order to set a bin file (.sh, .php, .bat, ...) who will be run at the end of update. And your plugin create a tmp file with the changelog output.

So, the dev should just add the option in composer.json and create a bin file who he can do what he want like read the tmp file and add it to a commit message.

from composer-changelogs.

Fabex avatar Fabex commented on May 27, 2024

With an example it will be more clear:

 public function postUpdate(Event $event)
    {
        $extra = $event->getComposer()->getPackage()->getExtra();
        if (array_key_exists('changelog', $extra)) {
            $logFile = $extra['changelog']['log-file'];
            $binFile = $extra['changelog']['bin-file'];
            exec($binFile);
        }
        $this->io->write($this->outputter->getOutput());
    }
#!/bin/sh sh

value=`cat /tmp/changelog.log`
git commit -m"$value" composer.lock

Something like that, with check if files exists and maybe some other check but it's the main idea.

from composer-changelogs.

pyrech avatar pyrech commented on May 27, 2024

Hi, thanks for all your propositions. Before your message, I started a POC for extra settings in ee0aaa0

I started with the previous idea of asking, then eventually commiting but it's obviously only coupled to git. I will look to your solution soon as it's enable others possibilies 😉

from composer-changelogs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.