diff --git a/admin/RELEASE.md b/admin/RELEASE.md index 98089ae8181f..731527de0ed7 100644 --- a/admin/RELEASE.md +++ b/admin/RELEASE.md @@ -2,7 +2,7 @@ > Documentation guide based on the releases of `4.0.5` and `4.1.0` on January 31, 2021. > -> Updated for `4.3.0` on January 10, 2023. +> Updated for `4.4.3` on October 27, 2023. > > -MGatner, kenjis @@ -53,12 +53,18 @@ Work off direct clones of the repos so the release branches persist for a time. * [ ] Clone both **codeigniter4/CodeIgniter4** and **codeigniter4/userguide** and resolve any necessary PRs ```console + rm -rf CodeIgniter4.bk userguide.bk + mv CodeIgniter4 CodeIgniter4.bk + mv userguide userguide.bk git clone git@github.com:codeigniter4/CodeIgniter4.git git clone git@github.com:codeigniter4/userguide.git ``` * [ ] Vet the **admin/** folders for any removed hidden files (Action deploy scripts *do not remove these*) - * git diff --name-status origin/master admin/ + ```console + cd CodeIgniter4 + git diff --name-status origin/master admin/ + ``` * [ ] Merge any Security Advisory PRs in private forks ## Process @@ -67,21 +73,24 @@ Work off direct clones of the repos so the release branches persist for a time. > been included with their PR, so this process assumes you will not be > generating much new content. -* [ ] Create a new branch `release-4.x.x` -* [ ] Update **system/CodeIgniter.php** with the new version number: - `const CI_VERSION = '4.x.x';` -* [ ] Update **user_guide_src/source/conf.py** with the new `version = '4.x'` (if applicable) - and `release = '4.x.x'` * [ ] Replace **CHANGELOG.md** with the new version generated above * [ ] Update **user_guide_src/source/changelogs/{version}.rst** - * Set the date to format `Release Date: January 31, 2021` * Remove the section titles that have no items * [ ] Update **user_guide_src/source/installation/upgrade_{ver}.rst** * fill in the "All Changes" section, and add it to **upgrading.rst** * git diff --name-status origin/master -- . ':!system' * Remove the section titles that have no items * [Minor version only] Update the "from" version in the title. E.g., `from 4.3.x` → `from 4.3.8` -* [ ] Commit the changes with `Prep for 4.x.x release` and push to origin +* [ ] Run `php admin/prepare-release.php 4.x.x` and push to origin + * The above command does the following: + * Create a new branch `release-4.x.x` + * Update **system/CodeIgniter.php** with the new version number: + `const CI_VERSION = '4.x.x';` + * Update **user_guide_src/source/conf.py** with the new `version = '4.x'` (if applicable) + and `release = '4.x.x'` + * Update **user_guide_src/source/changelogs/{version}.rst** + * Set the date to format `Release Date: January 31, 2021` + * Commit the changes with `Prep for 4.x.x release` * [ ] Create a new PR from `release-4.x.x` to `develop`: * Title: `Prep for 4.x.x release` * Description: @@ -119,6 +128,7 @@ Work off direct clones of the repos so the release branches persist for a time. * [ ] Run the following commands to install and test `appstarter` and verify the new version: ```console + rm -rf release-test composer create-project codeigniter4/appstarter release-test cd release-test composer test && composer info codeigniter4/framework @@ -152,7 +162,7 @@ Work off direct clones of the repos so the release branches persist for a time. git switch -c 4.x git push origin HEAD ``` -* [ ] Publish any Security Advisories that were resolved from private forks +* [ ] Request CVEs and Publish any Security Advisories that were resolved from private forks (note: publishing is restricted to administrators): * [ ] Announce the release on the forums and Slack channel (note: this forum is restricted to administrators): @@ -160,11 +170,13 @@ Work off direct clones of the repos so the release branches persist for a time. https://forum.codeigniter.com/forum-2.html * The content is somewhat organic, but should include any major features and changes as well as a link to the User Guide's changelog +* [ ] Run `php admin/create-new-changelog.php ` + * The above command does the following: + * Create **user_guide_src/source/changelogs/{next_version}.rst** and add it to + **index.rst** (See **next-changelog-*.rst**) + * Create **user_guide_src/source/installation/upgrade_{next_version}.rst** and add it to + **upgrading.rst** (See **next-upgrading-guide.rst**) * [ ] Create a PR for new changelog and upgrade for the next version - * Create **user_guide_src/source/changelogs/{next_version}.rst** and add it to - **index.rst** (See **next-changelog-*.rst**) - * Create **user_guide_src/source/installation/upgrade_{next_version}.rst** and add it to - **upgrading.rst** (See **next-upgrading-guide.rst**) ## Appendix diff --git a/admin/create-new-changelog.php b/admin/create-new-changelog.php new file mode 100644 index 000000000000..ff371345d166 --- /dev/null +++ b/admin/create-new-changelog.php @@ -0,0 +1,87 @@ + " . PHP_EOL; + echo "E.g.,: php {$argv[0]} 4.4.3 4.4.4" . PHP_EOL; + + exit(1); +} + +// Gets version number from argument. +$versionCurrent = $argv[1]; // e.g., '4.4.3' +$versionCurrentParts = explode('.', $versionCurrent); +$minorCurrent = $versionCurrentParts[0] . '.' . $versionCurrentParts[1]; +$version = $argv[2]; // e.g., '4.4.4' +$versionParts = explode('.', $version); +$minor = $versionParts[0] . '.' . $versionParts[1]; +$isMinorUpdate = ($minorCurrent !== $minor); + +// Creates a branch for release. +system('git switch develop'); +system('git switch -c docs-changelog-' . $version); +system('git switch docs-changelog-' . $version); + +// Copy changelog +$changelog = "./user_guide_src/source/changelogs/v{$version}.rst"; +$changelogIndex = './user_guide_src/source/changelogs/index.rst'; +if ($isMinorUpdate) { + copy('./admin/next-changelog-minor.rst', $changelog); +} else { + copy('./admin/next-changelog-patch.rst', $changelog); +} +// Add changelog to index.rst. +replace_file_content( + $changelogIndex, + '/\.\. toctree::\n :titlesonly:\n/u', + ".. toctree::\n :titlesonly:\n\n v{$version}" +); +// Replace {version} +$length = mb_strlen("Version {$version}"); +$underline = str_repeat('#', $length); +replace_file_content( + $changelog, + '/#################\nVersion {version}\n#################/u', + "{$underline}\nVersion {$version}\n{$underline}" +); +replace_file_content( + $changelog, + '/{version}/u', + "{$version}" +); + +// Copy upgrading +$versionWithoutDots = str_replace('.', '', $version); +$upgrading = "./user_guide_src/source/installation/upgrade_{$versionWithoutDots}.rst"; +$upgradingIndex = './user_guide_src/source/installation/upgrading.rst'; +copy('./admin/next-upgrading-guide.rst', $upgrading); +// Add upgrading to upgrading.rst. +replace_file_content( + $upgradingIndex, + '/ backward_compatibility_notes\n/u', + " backward_compatibility_notes\n\n upgrade_{$versionWithoutDots}" +); +// Replace {version} +$length = mb_strlen("Upgrading from {$versionCurrent} to {$version}"); +$underline = str_repeat('#', $length); +replace_file_content( + $upgrading, + '/##############################\nUpgrading from {version} to {version}\n##############################/u', + "{$underline}\nUpgrading from {$versionCurrent} to {$version}\n{$underline}" +); + +// Commits +system("git add {$changelog} {$changelogIndex}"); +system("git add {$upgrading} {$upgradingIndex}"); +system('git commit -m "docs: add changelog and upgrade for v' . $version . '"'); diff --git a/admin/next-changelog-minor.rst b/admin/next-changelog-minor.rst index f5bb20004d77..c22f0be7d9f3 100644 --- a/admin/next-changelog-minor.rst +++ b/admin/next-changelog-minor.rst @@ -1,3 +1,4 @@ +################# Version {version} ################# @@ -9,11 +10,13 @@ Release Date: Unreleased :local: :depth: 3 +********** Highlights ********** - TBD +******** BREAKING ******** @@ -26,6 +29,7 @@ Interface Changes Method Signature Changes ======================== +************ Enhancements ************ @@ -59,15 +63,19 @@ Helpers and Functions Others ====== +*************** Message Changes *************** +******* Changes ******* +************ Deprecations ************ +********** Bugs Fixed ********** diff --git a/admin/next-changelog-patch.rst b/admin/next-changelog-patch.rst index 4c76ca01a112..ed2ba70570b3 100644 --- a/admin/next-changelog-patch.rst +++ b/admin/next-changelog-patch.rst @@ -1,3 +1,4 @@ +################# Version {version} ################# @@ -9,18 +10,23 @@ Release Date: Unreleased :local: :depth: 3 +******** BREAKING ******** +*************** Message Changes *************** +******* Changes ******* +************ Deprecations ************ +********** Bugs Fixed ********** diff --git a/admin/next-upgrading-guide.rst b/admin/next-upgrading-guide.rst index fb97f320e95a..bcffc3fe3de5 100644 --- a/admin/next-upgrading-guide.rst +++ b/admin/next-upgrading-guide.rst @@ -12,15 +12,19 @@ Please refer to the upgrade instructions corresponding to your installation meth :local: :depth: 2 +********************** Mandatory File Changes ********************** +**************** Breaking Changes **************** +********************* Breaking Enhancements ********************* +************* Project Files ************* diff --git a/admin/prepare-release.php b/admin/prepare-release.php new file mode 100644 index 000000000000..1b173a0f75d6 --- /dev/null +++ b/admin/prepare-release.php @@ -0,0 +1,61 @@ +" . PHP_EOL; + echo "E.g.,: php {$argv[0]} 4.4.3" . PHP_EOL; + + exit(1); +} + +// Gets version number from argument. +$version = $argv[1]; // e.g., '4.4.3' +$versionParts = explode('.', $version); +$minor = $versionParts[0] . '.' . $versionParts[1]; + +// Creates a branch for release. +system('git switch develop'); +system('git switch -c release-' . $version); +system('git switch docs-changelog-' . $version); + +// Updates version number in "CodeIgniter.php". +replace_file_content( + './system/CodeIgniter.php', + '/public const CI_VERSION = \'.*?\';/u', + "public const CI_VERSION = '{$version}';" +); + +// Updates version number in "conf.py". +replace_file_content( + './user_guide_src/source/conf.py', + '/^version = \'.*?\'/mu', + "version = '{$minor}'" +); +replace_file_content( + './user_guide_src/source/conf.py', + '/^release = \'.*?\'/mu', + "release = '{$version}'" +); + +// Updates release date in changelogs. +$date = date('F j, Y'); +replace_file_content( + "./user_guide_src/source/changelogs/v{$version}.rst", + '/^Release Date: .*/mu', + "Release Date: {$date}" +); + +// Commits +system('git add -u'); +system('git commit -m "Prep for ' . $version . ' release"'); diff --git a/app/Config/Modules.php b/app/Config/Modules.php index f84580c856d3..8d4bf56544b0 100644 --- a/app/Config/Modules.php +++ b/app/Config/Modules.php @@ -58,7 +58,7 @@ class Modules extends BaseModules * ], * ] * - * @var array + * @var array{only?: list, exclude?: list} */ public $composerPackages = []; @@ -72,7 +72,7 @@ class Modules extends BaseModules * * If it is not listed, only the base application elements will be used. * - * @var string[] + * @var list */ public $aliases = [ 'events', diff --git a/phpstan-baseline.php b/phpstan-baseline.php index 1c22f0ee903d..c5416e9c2971 100644 --- a/phpstan-baseline.php +++ b/phpstan-baseline.php @@ -1,11 +1,6 @@ '#^PHPDoc type array\\ of property Config\\\\Modules\\:\\:\\$aliases is not the same as PHPDoc type array of overridden property CodeIgniter\\\\Modules\\\\Modules\\:\\:\\$aliases\\.$#', - 'count' => 1, - 'path' => __DIR__ . '/app/Config/Modules.php', -]; $ignoreErrors[] = [ 'message' => '#^PHPDoc type CodeIgniter\\\\HTTP\\\\CLIRequest\\|CodeIgniter\\\\HTTP\\\\IncomingRequest of property App\\\\Controllers\\\\BaseController\\:\\:\\$request is not the same as PHPDoc type CodeIgniter\\\\HTTP\\\\RequestInterface of overridden property CodeIgniter\\\\Controller\\:\\:\\$request\\.$#', 'count' => 1, diff --git a/system/Commands/Generators/CommandGenerator.php b/system/Commands/Generators/CommandGenerator.php index 4b2ec360ad38..b844666a794e 100644 --- a/system/Commands/Generators/CommandGenerator.php +++ b/system/Commands/Generators/CommandGenerator.php @@ -67,7 +67,7 @@ class CommandGenerator extends BaseCommand protected $options = [ '--command' => 'The command name. Default: "command:name"', '--type' => 'The command type. Options [basic, generator]. Default: "basic".', - '--group' => 'The command group. Default: [basic -> "CodeIgniter", generator -> "Generators"].', + '--group' => 'The command group. Default: [basic -> "App", generator -> "Generators"].', '--namespace' => 'Set root namespace. Default: "APP_NAMESPACE".', '--suffix' => 'Append the component title to the class name (e.g. User => UserCommand).', '--force' => 'Force overwrite existing file.', @@ -106,7 +106,7 @@ protected function prepare(string $class): string } if (! is_string($group)) { - $group = $type === 'generator' ? 'Generators' : 'CodeIgniter'; + $group = $type === 'generator' ? 'Generators' : 'App'; } return $this->parseTemplate( diff --git a/system/Modules/Modules.php b/system/Modules/Modules.php index f99e7215e733..e17b9f3c2415 100644 --- a/system/Modules/Modules.php +++ b/system/Modules/Modules.php @@ -37,7 +37,7 @@ class Modules /** * Auto-Discover Rules Handler * - * @var array + * @var list */ public $aliases = []; diff --git a/tests/system/Commands/CommandGeneratorTest.php b/tests/system/Commands/CommandGeneratorTest.php index 64ab5a21d2d9..aabb86f9a843 100644 --- a/tests/system/Commands/CommandGeneratorTest.php +++ b/tests/system/Commands/CommandGeneratorTest.php @@ -52,7 +52,7 @@ public function testGenerateCommand(): void $file = APPPATH . 'Commands/Deliver.php'; $this->assertFileExists($file); $contents = $this->getFileContents($file); - $this->assertStringContainsString('protected $group = \'CodeIgniter\';', $contents); + $this->assertStringContainsString('protected $group = \'App\';', $contents); $this->assertStringContainsString('protected $name = \'command:name\';', $contents); } @@ -72,7 +72,7 @@ public function testGenerateCommandWithOptionTypeBasic(): void $file = APPPATH . 'Commands/Deliver.php'; $this->assertFileExists($file); $contents = $this->getFileContents($file); - $this->assertStringContainsString('protected $group = \'CodeIgniter\';', $contents); + $this->assertStringContainsString('protected $group = \'App\';', $contents); $this->assertStringContainsString('protected $name = \'command:name\';', $contents); } diff --git a/user_guide_src/source/cli/cli_generators.rst b/user_guide_src/source/cli/cli_generators.rst index 3e11954b6d79..017b8851c64a 100644 --- a/user_guide_src/source/cli/cli_generators.rst +++ b/user_guide_src/source/cli/cli_generators.rst @@ -82,7 +82,7 @@ Argument: Options: ======== * ``--command``: The command name to run in spark. Defaults to ``command:name``. -* ``--group``: The group/namespace of the command. Defaults to ``CodeIgniter`` for basic commands, and ``Generators`` for generator commands. +* ``--group``: The group/namespace of the command. Defaults to ``App`` for basic commands, and ``Generators`` for generator commands. * ``--type``: The type of command, whether a ``basic`` command or a ``generator`` command. Defaults to ``basic``. * ``--namespace``: Set the root namespace. Defaults to value of ``APP_NAMESPACE``. * ``--suffix``: Append the component suffix to the generated class name.