Symfony2:仅更新一个供应商包

发布于 2024-12-29 07:43:28 字数 90 浏览 3 评论 0原文

有没有一种方法可以只更新一个包而不更新 deps 文件中的每个包?我目前正在使用“php供应商安装”来安装所有供应商捆绑包,并且不知道有任何命令一次只更新一个捆绑包。

Is there a way to update just one bundle without updating every bundle in your deps file? I am currently using "php vendors install" to install all vendor bundles and am not aware of any commands that will update just one bundle at a time.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

萌吟 2025-01-05 07:43:28

1) 只需打开您的 deps 文件 (./deps)

2) 删除除要更新的包之外的所有包并保存 deps 文件

3) 让我们运行命令: php bin/vendors update

它将更新包。

4) 返回 deps 文件并重写所有之前删除的捆绑行!

干杯!

1) Just open your deps file (./deps)

2) Remove all bundles except the one you want to update and save the deps file

3) Let's run the command: php bin/vendors update

It will update the bundle.

4) Go back in your deps file and rewrite all the previous removed bundle lines !

Cheers !

绝對不後悔。 2025-01-05 07:43:28

简短版本:
执行此操作的“最佳方法”取决于您的设置。如果您之前运行过“php bin/vendors update”,那么最好从 deps.lock 文件中删除要更新的包的行,然后从您的基础运行“php bin/vendors install” symfony 文件夹。

长版:
我认为对各种供应商命令的作用进行一些澄清是适当的。

1) php bin/vendors install

此命令下载(如果需要)供应商捆绑源文件并将其安装到 symfony/vendor 中。该命令将首先查看 deps.lock 以查看其中列出的 git 提交/版本,然后它将查看您的 deps 文件以查看其中列出的版本。如果没有为某个捆绑包指定版本,它将下载该捆绑包的最新版本的捆绑包代码。如果找到版本,它将下载并安装该版本的供应商捆绑代码。

此命令不会在 deps.lock 中放入任何内容。

2) php bin/vendors install --reinstall

该命令与 php bin/vendors install 执行相同的操作,不同之处在于它总是在将代码安装到 symfony/vendor 之前下载代码。

此命令不会在 deps.lock 中放入任何内容。

3) php bin/vendors update

此命令将忽略 deps.lock,并将下载(如有必要)并将 deps 文件中列出的捆绑代码版本安装到 symfony/vendor 中。

下载并安装代码后,它将把每个包的下载代码的 git commit id / 版本放入 deps.lock 文件中。这样,当您运行上面列出的安装命令之一时,下载的代码版本不会更改,除非您从 deps.lock 文件中删除相关行或者再次运行更新命令。

deps.lock 文件背后的想法是,它可以防止您意外地将捆绑包升级到第 3 方捆绑包代码的最新错误非工作版本。 Symfony 及其捆绑包正在不断开发中,因此更改(即使不是错误)非常频繁地发生,并且会破坏您的代码。您可能希望尽快将您的版本锁定在 deps.lock 中,并且仅在您想特意这样做时才进行更新。

一旦您在 deps.lock 中锁定了捆绑包版本,您只需从 deps.lock 文件中删除相关行,然后运行其中一个安装命令来更新特定捆绑包,就像我在简短回答中所说的那样多于。如果您想将该代码锁定到刚刚安装的版本,您需要自己向 deps.lock 添加一行,或者从 deps 中删除所有内容并运行 php bin/vendor update,如上面的答案所示。

Short version:
The "best way" to do this depends on your setup. If you've run "php bin/vendors update" before, then it would probably be best to remove the line for the bundle you want to update from your deps.lock file, then run "php bin/vendors install" from your base symfony folder.

Long version:
I think some clarification of what the various vendor commands do is in order.

1) php bin/vendors install

This command downloads (if necessary) and installs vendor bundle source files into symfony/vendor. This command will first look at deps.lock to see what git commits/versions are listed there, then it will look at your deps file to see what versions are listed there. If no version is specified in either for a certain bundle, it will download the most recent version of the bundle code for that bundle. If a version is found, it will download and install that version of the vendor bundle code.

This command will not put anything in deps.lock.

2) php bin/vendors install --reinstall

This command does the same thing as php bin/vendors install, except it will always download the code before installing it into symfony/vendor.

This command will not put anything in deps.lock.

3) php bin/vendors update

This command will ignore deps.lock, and will download (if necessary) and install the versions of bundle code listed in the deps file into symfony/vendor.

After it is done downloading and installing code, it will put the git commit id / version of the downloaded code for each bundle into your deps.lock file. That way, when you go to run one of the install commands listed above, the version of code that is downloaded won't change unless you remove the related line from the deps.lock file or if your run the update command again.

The idea behind the deps.lock file is that it prevents you from accidentally upgrading your bundles to a more recent bug non-working version of the 3rd party bundle code. Symfony and it's bundles are under constant development, so changes (even if they're not bugs) happen pretty frequently and will break your code. You'll probably want to get your versions locked down in deps.lock as soon as possible and only update when you feel like going out of your way to do so.

Once you've locked down your bundle versions in deps.lock, you'll just need to remove the related line from your deps.lock file the run one of the install commands to update a specific bundle, like I said in the short answer above. If you then want to lock that code down to the version you just installed, you'll want to add a line to deps.lock yourself, or remove everything from deps and run php bin/vendor update like the answer above indicates.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文