忽略php composer中的dev依赖项 [英] ignore dev dependencies in php composer

查看:94
本文介绍了忽略php composer中的dev依赖项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开发了一个基于作曲家laravel的项目,需要将其安装在远程生产服务器上.问题是我的权限/访问受限,所以我的选择是存档"包(使用composer archive)并在生产中解压缩.

I have developed a composer laravel based project that I need to install on a remote production server. The problem is I have limited permission/ access so my option is to "archive" the package( using composer archive) and unpack on the production.

我需要归档哪些文件夹,如何忽略软件包的dev依赖关系以及供应商的dev依赖关系?

What folders do I need to archive and how can I ignore the dev dependencies of the package as well as vendor dev dependencies?

推荐答案

composer archive可能无济于事,因为此命令将创建软件包定义版本的存档.

composer archive is likely not to help you, because this command creates an archive of a defined version of a package.

您可能希望上传整个工作应用程序,而不仅仅是一个软件包.您应该创建一个小脚本,该脚本将为您创建存档文件,该脚本应该执行以下操作:

You probably want to upload the whole working application, and not only one package. You should create a little script that will create the archive file for you, which should do:

  • 从存储库中的新目录中签出应用程序
  • 运行composer install --no-dev以安装所有必需的依赖,而没有开发依赖
  • (可选)删除服务器上不需要的文件,例如文档,.git文件夹和其他内容
  • 从所有这些文件创建存档文件
  • (可选)将该存档上传到目标服务器,然后在其中取消存档
  • 可以选择检查基本功能并切换到服务器上的新上载版本
  • checkout the application from the repository in a new directory
  • run composer install --no-dev to install all required dependencies without dev-dependencies
  • optionally delete files that are not necessary on the server, like documentation, the .git folder, and other stuff
  • create the archive file from all these files
  • optionally upload that archive to the target server and unarchive there
  • optionally check basic functions and switch to the new uploaded version on the server

这篇关于忽略php composer中的dev依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆