Composer:在包升级到某个版本后显示自定义消息
Composer: display custom message after package is upgraded to a version
我在一个包中引入了一项更改,我希望所有从旧版本升级到该版本的用户都能看到。因此,当作曲家升级包时,它应该向开发人员显示一条消息。
我在 Yii2 中看到过这个,但我不知道他们是怎么做到的。 composer 似乎显示了文件 framework/UPGRADE.md
的相关部分,但我在 composer 文档或 composer.json
中没有看到对该文件的引用。一个 Yii2 升级示例:
$ composer update yiisoft/yii2
- Updating yiisoft/yii2 (2.0.32 => 2.0.37): Loading from cache
Seems you have upgraded Yii Framework from version 2.0.32 to 2.0.37.
Please check the upgrade notes for possible incompatible changes
and adjust your application code accordingly.
Upgrade from Yii 2.0.36
-----------------------
* `yii\db\Exception::getCode()` now returns full PDO code that is SQLSTATE string. If you have relied on comparing code
with an integer value, adjust your code.
...
Upgrade from Yii 2.0.34
-----------------------
* `ExistValidator` used as a rule of `EachValidator` now requires providing `targetClass` explicitely and it's not possible to use it with `targetRelation` in
that configuration.
...
You can find the upgrade notes for all versions online at:
https://github.com/yiisoft/yii2/blob/2.0.37/framework/UPGRADE.md
这是yiisoft/yii2-composer
package, which is Composer plugin, so it can react on some Composer events. You may find details in implementation的特点。这个没有捷径,需要自己去实现。
但我不鼓励这样做 - Yii 2 是一个框架,它的架构通常意味着它是项目中最重要的依赖项。在 Yii 2 的情况下显示这样的通知可能是合理的(注意它只显示次要版本中潜在的 BC 破坏性更改,而不是更改日志中的所有更改),但如果每个依赖项都这样做,它将导致不可读的混乱。如果有人想跟踪更新依赖项的变化,他可以使用 pyrech/composer-changelogs
.
我在一个包中引入了一项更改,我希望所有从旧版本升级到该版本的用户都能看到。因此,当作曲家升级包时,它应该向开发人员显示一条消息。
我在 Yii2 中看到过这个,但我不知道他们是怎么做到的。 composer 似乎显示了文件 framework/UPGRADE.md
的相关部分,但我在 composer 文档或 composer.json
中没有看到对该文件的引用。一个 Yii2 升级示例:
$ composer update yiisoft/yii2
- Updating yiisoft/yii2 (2.0.32 => 2.0.37): Loading from cache
Seems you have upgraded Yii Framework from version 2.0.32 to 2.0.37.
Please check the upgrade notes for possible incompatible changes
and adjust your application code accordingly.
Upgrade from Yii 2.0.36
-----------------------
* `yii\db\Exception::getCode()` now returns full PDO code that is SQLSTATE string. If you have relied on comparing code
with an integer value, adjust your code.
...
Upgrade from Yii 2.0.34
-----------------------
* `ExistValidator` used as a rule of `EachValidator` now requires providing `targetClass` explicitely and it's not possible to use it with `targetRelation` in
that configuration.
...
You can find the upgrade notes for all versions online at:
https://github.com/yiisoft/yii2/blob/2.0.37/framework/UPGRADE.md
这是yiisoft/yii2-composer
package, which is Composer plugin, so it can react on some Composer events. You may find details in implementation的特点。这个没有捷径,需要自己去实现。
但我不鼓励这样做 - Yii 2 是一个框架,它的架构通常意味着它是项目中最重要的依赖项。在 Yii 2 的情况下显示这样的通知可能是合理的(注意它只显示次要版本中潜在的 BC 破坏性更改,而不是更改日志中的所有更改),但如果每个依赖项都这样做,它将导致不可读的混乱。如果有人想跟踪更新依赖项的变化,他可以使用 pyrech/composer-changelogs
.