Coder Social home page Coder Social logo

pronamic-cli's People

Contributors

remcotolsma avatar rvdsteege avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar

pronamic-cli's Issues

Array to string conversion in `VersionCommand`

I stumbled upon this error today:

Warning: Array to string conversion in /vendor/pronamic/pronamic-cli/src/VersionCommand.php on line 356

$changelog_entry = $changelog->new_entry( $new_version );
$changelog_entry->url = $url_repository;
$changelog_entry->version_previous = $version;
$changelog_entry->body .= $this->add_git_log( $cwd, $version, $output, $url_repository );
if ( isset( $composer_json ) ) {
$changelog_entry->body .= $this->generate_composer_json_changelog( $cwd, $version, $output );
}

if ( ! is_object( $composer_json_old ) ) {
return [];
}
if ( ! is_object( $composer_json_new ) ) {
return [];
}

Add feature to convert `CHANGELOG.md` to WordPress `readme.txt` changelog

As for your changelog, we recommend keeping the current release in the readme and splitting the rest out out into it’s own file β€” changelog.txt for example. By storing all the older changelog data there, you keep your readme small and allow the people who get really into long changelogs to read things on their own.

https://developer.wordpress.org/plugins/wordpress-org/how-your-readme-txt-works/

https://plugins.trac.wordpress.org/browser/akismet/trunk/readme.txt

Ideas for `version` command

  • Before running check if working tree is clean (git status or git status --short)
  • Before release type choice show git log information.
  • Display auto generated changelog first, and let user choose to open editor.
  • Add support for PR's in auto genereated changelog (gh pr list).
  • Add support for issues in auto genereated changelog (gh issue list).
  • Auto create tag like npm version
  • Auto create draf GitHub release gh release create <tag> --draft --generate-notes
  • Check for new added Composer requirements.
  • Check for removed Composer requirements.
  • Add option to include changelog of Composer updates.
    • Read vendor/pronamic/repository/CHANGELOG.md version entry.
  • Warn about dev- requirements in composer.json?
  • Check composer outdated or composer outdated --direct for outdated packages?
  • Rename vendor/bin/wp-deployer to vendor/bin/pronamic-deployer for branding?

Errors with no `CHANGELOG.md` file

PHP Warning:  Undefined variable $changelog_entry in /Users/remco/Projects/easycruit/vendor/pronamic/wp-deployer/src/VersionCommand.php on line 602

Warning: Undefined variable $changelog_entry in /Users/remco/Projects/easycruit/vendor/pronamic/wp-deployer/src/VersionCommand.php on line 602
PHP Warning:  Attempt to read property "body" on null in /Users/remco/Projects/easycruit/vendor/pronamic/wp-deployer/src/VersionCommand.php on line 602

Warning: Attempt to read property "body" on null in /Users/remco/Projects/easycruit/vendor/pronamic/wp-deployer/src/VersionCommand.php on line 602
https://github.com/pronamic/wp-easycruit/releases/tag/v2.1.0

Explain how the `version` command works

The version command does several things, but this is not immediately clear to users beforehand.

  • git pull
  • Working tree status (git status)
  • git branch --show-current
  • Check tagnames without v prefix.'
  • Run Composer script preversion
  • Check composer.json type property.
  • Check composer outdated
  • Check non-comparable Composer package versions (dev-*)
  • Check package.json version property
  • Check WordPress plugin file headers from *.php files
  • Check multiple WordPress plugins in working directory
  • Ask user for bump method (patch, minor, major)
  • Compose changelog
  • Set plugin file header version
  • Set theme style.css header version
  • Set Stable tag in readme.txt header
  • Set version in package.json
  • Run Composer script version
  • Git commit changes (git commit)
  • Git tag (git tag)
  • Git push (git push)
  • Run Composer script postversion

Exclude build directory by default in `wp-build`

// Build - Sync.
$io->section( 'Rsync' );
$io->text( 'The build command uses <fg=green>rsync</fg=green> to copy files from the working directory to the build directory.' );
$options = [
'--recursive',
'--delete',
'--verbose',
'--exclude-from=' . $exclude_file,
];
if ( \is_readable( $working_dir . '/.pronamic-build-ignore' ) ) {
$options[] = '--exclude-from=' . Path::makeRelative(
$working_dir . '/.pronamic-build-ignore',
getcwd()
);
}
$command = [
'rsync',
...$options,
$working_dir . '/',
$build_dir . '/',
];
$process = new Process( $command );
$helper->mustRun( $output, $process );

Add "generate release notes" class/function/command

Currently we generate the release notes quite late in the version command:

The version command does several things, but this is not immediately clear to users beforehand.

  • git pull
  • Working tree status (git status)
  • git branch --show-current
  • Check tagnames without v prefix.'
  • Run Composer script preversion
  • Check composer.json type property.
  • Check composer outdated
  • Check non-comparable Composer package versions (dev-*)
  • Check package.json version property
  • Check WordPress plugin file headers from *.php files
  • Check multiple WordPress plugins in working directory
  • Ask user for bump method (patch, minor, major)
  • Compose changelog
  • Set plugin file header version
  • Set theme style.css header version
  • Set Stable tag in readme.txt header
  • Set version in package.json
  • Run Composer script version
  • Git commit changes (git commit)
  • Git tag (git tag)
  • Git push (git push)
  • Run Composer script postversion

/**
* If CHANGELOG.md check if new version is part of it?
*/
$file_changelog_md = $cwd . '/CHANGELOG.md';
if ( ! is_readable( $file_changelog_md ) ) {
$io->note( 'It is a good idea to keep track of the changes in a `CHANGELOG.md` file: https://keepachangelog.com/.' );
}
if ( is_readable( $file_changelog_md ) ) {
/**
* Remote URL.
*
* @link https://github.com/cookpete/auto-changelog/blob/0991f17ce936a9db490e2ad1a04121755038b78d/src/remote.js
*/
$process = $this->new_process( 'git remote get-url origin', $cwd );
$process_helper->mustRun( $output, $process );
$url = $process->getOutput();
$components = $this->parse_git_url( $url );
$url_repository = 'https://' . $components['host'] . '/' . $components['organisation'] . '/' . $components['repository'];
$changelog = new Changelog( $file_changelog_md );
if ( ! $changelog->has_entry( $new_version ) ) {
$changelog_entry = $changelog->new_entry( $new_version );
$changelog_entry->url = $url_repository;
$changelog_entry->version_previous = $version;
$changelog_entry->body .= $this->add_git_log( $cwd, $version, $output, $url_repository );
if ( isset( $composer_json ) ) {
$changelog_entry->body .= $this->generate_composer_json_changelog( $cwd, $version, $output );
}
$choice = '';
$iteration = 0;
while ( 'ok' !== $choice ) {
$iteration++;
$io->title( 'Changelog' );
$io->text( $changelog_entry->body );
$choice = $io->choice(
'πŸ” ' . $iteration . ': Is the above changelog OK?',
[
'ok',
'subl',
],
'subl'
);
if ( 'subl' === $choice ) {
$process = $this->new_process( 'subl -', $cwd, null, $changelog_entry->body );
$process_helper->mustRun( $output, $process );
$changelog_entry->body = $process->getOutput();
}
}
$changelog_entry_string = trim( $changelog_entry->render() ) . "\n\n";
$changelog->insert( $changelog->get_insert_position(), $changelog_entry_string );
$changelog->save();
}
}

It would be more convenient if we could generate and display the changelog before the "Ask user for bump method". Based on the generated changelog, a user can more easily choose the desired bump method.

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.