From 6384707a148be8a867b10e8a9697c09a06638596 Mon Sep 17 00:00:00 2001 From: YuCheng Hu Date: Mon, 8 Apr 2024 22:11:25 -0400 Subject: [PATCH] =?UTF-8?q?=E5=9B=A0=E4=B8=BA=20Composer=20=E7=9A=84?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E6=AF=94=E8=BE=83=E5=B0=91=EF=BC=8C=E6=89=80?= =?UTF-8?q?=E4=BB=A5=E6=88=91=E4=BB=AC=E5=B0=B1=E5=AF=B9=E7=85=A7=E8=8B=B1?= =?UTF-8?q?=E6=96=87=E7=89=88=E6=9C=AC=E7=9A=84=E5=86=85=E5=AE=B9=E8=BF=9B?= =?UTF-8?q?=E8=A1=8C=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cn-introduction/00-intro.md => 00-intro.md | 0 .../01-basic-usage.md => 01-basic-usage.md | 0 cn-introduction/02-libraries.md => 02-libraries.md | 2 +- cn-introduction/03-cli.md => 03-cli.md | 4 ++-- cn-introduction/04-schema.md => 04-schema.md | 10 +++++----- .../05-repositories.md => 05-repositories.md | 6 +++--- cn-introduction/06-community.md => 06-community.md | 0 README.md | 14 +++++++------- articles/custom-installers.md | 4 ++-- articles/handling-private-packages-with-satis.md | 4 ++-- articles/plugins.md | 4 ++-- articles/troubleshooting.md | 6 +++--- {cn-introduction/dev => dev}/DefaultPolicy.md | 0 {en-back => en-doc}/00-intro.md | 0 {en-back => en-doc}/01-basic-usage.md | 0 {en-back => en-doc}/02-libraries.md | 0 {en-back => en-doc}/03-cli.md | 0 {en-back => en-doc}/04-schema.md | 0 {en-back => en-doc}/05-repositories.md | 0 {en-back => en-doc}/06-config.md | 0 {en-back => en-doc}/07-community.md | 0 {en-back => en-doc}/articles/aliases.md | 0 {en-back => en-doc}/articles/custom-installers.md | 0 .../handling-private-packages-with-satis.md | 0 {en-back => en-doc}/articles/plugins.md | 0 {en-back => en-doc}/articles/scripts.md | 0 {en-back => en-doc}/articles/troubleshooting.md | 0 {en-back => en-doc}/articles/vendor-binaries.md | 0 {en-back => en-doc}/dev/DefaultPolicy.md | 0 ...-a-package-to-a-custom-path-for-my-framework.md | 0 ...mmit-the-dependencies-in-my-vendor-directory.md | 0 ...y-are-unbound-version-constraints-a-bad-idea.md | 0 ...mbining-comparisons-and-wildcards-a-bad-idea.md | 0 ...can't-composer-load-repositories-recursively.md | 0 ...mmit-the-dependencies-in-my-vendor-directory.md | 2 +- 35 files changed, 28 insertions(+), 28 deletions(-) rename cn-introduction/00-intro.md => 00-intro.md (100%) rename cn-introduction/01-basic-usage.md => 01-basic-usage.md (100%) rename cn-introduction/02-libraries.md => 02-libraries.md (99%) rename cn-introduction/03-cli.md => 03-cli.md (98%) rename cn-introduction/04-schema.md => 04-schema.md (98%) rename cn-introduction/05-repositories.md => 05-repositories.md (98%) rename cn-introduction/06-community.md => 06-community.md (100%) rename {cn-introduction/dev => dev}/DefaultPolicy.md (100%) rename {en-back => en-doc}/00-intro.md (100%) rename {en-back => en-doc}/01-basic-usage.md (100%) rename {en-back => en-doc}/02-libraries.md (100%) rename {en-back => en-doc}/03-cli.md (100%) rename {en-back => en-doc}/04-schema.md (100%) rename {en-back => en-doc}/05-repositories.md (100%) rename {en-back => en-doc}/06-config.md (100%) rename {en-back => en-doc}/07-community.md (100%) rename {en-back => en-doc}/articles/aliases.md (100%) rename {en-back => en-doc}/articles/custom-installers.md (100%) rename {en-back => en-doc}/articles/handling-private-packages-with-satis.md (100%) rename {en-back => en-doc}/articles/plugins.md (100%) rename {en-back => en-doc}/articles/scripts.md (100%) rename {en-back => en-doc}/articles/troubleshooting.md (100%) rename {en-back => en-doc}/articles/vendor-binaries.md (100%) rename {en-back => en-doc}/dev/DefaultPolicy.md (100%) rename {en-back => en-doc}/faqs/how-do-i-install-a-package-to-a-custom-path-for-my-framework.md (100%) rename {en-back => en-doc}/faqs/should-i-commit-the-dependencies-in-my-vendor-directory.md (100%) rename {en-back => en-doc}/faqs/why-are-unbound-version-constraints-a-bad-idea.md (100%) rename {en-back => en-doc}/faqs/why-are-version-constraints-combining-comparisons-and-wildcards-a-bad-idea.md (100%) rename {en-back => en-doc}/faqs/why-can't-composer-load-repositories-recursively.md (100%) diff --git a/cn-introduction/00-intro.md b/00-intro.md similarity index 100% rename from cn-introduction/00-intro.md rename to 00-intro.md diff --git a/cn-introduction/01-basic-usage.md b/01-basic-usage.md similarity index 100% rename from cn-introduction/01-basic-usage.md rename to 01-basic-usage.md diff --git a/cn-introduction/02-libraries.md b/02-libraries.md similarity index 99% rename from cn-introduction/02-libraries.md rename to 02-libraries.md index 0adde66..e716db4 100644 --- a/cn-introduction/02-libraries.md +++ b/02-libraries.md @@ -110,7 +110,7 @@ hg) 的信息推断出包的版本,因此你不必手动指明版本号,并 它表示一个包版本的别名。例如,你可以为 `dev-master` 设置别名 `1.0.x-dev`,这样就可以通过 require `1.0.x-dev` 来得到 `dev-master` 版本的包。 -详细请查看[“别名”](../articles/aliases.md)。 +详细请查看[“别名”](articles/aliases.md)。 ## 锁文件 diff --git a/cn-introduction/03-cli.md b/03-cli.md similarity index 98% rename from cn-introduction/03-cli.md rename to 03-cli.md index 5c01531..bc28218 100644 --- a/cn-introduction/03-cli.md +++ b/03-cli.md @@ -434,7 +434,7 @@ php composer.phar create-project doctrine/orm path 2.2.* ## 执行脚本 `run-script` -你可以运行此命令来手动执行 [脚本](../articles/scripts.md),只需要指定脚本的名称,可选的 `--no-dev` 参数允许你禁用开发者模式。 +你可以运行此命令来手动执行 [脚本](articles/scripts.md),只需要指定脚本的名称,可选的 `--no-dev` 参数允许你禁用开发者模式。 ## 诊断 `diagnose` @@ -498,7 +498,7 @@ COMPOSER=composer-other.json php composer.phar install ### COMPOSER_BIN_DIR -通过设置这个环境变量,你可以指定 `bin`([Vendor Binaries](../articles/vendor-binaries.md))目录到 `vendor/bin` 以外的其它目录。 +通过设置这个环境变量,你可以指定 `bin`([Vendor Binaries](articles/vendor-binaries.md))目录到 `vendor/bin` 以外的其它目录。 ### http_proxy or HTTP_PROXY diff --git a/cn-introduction/04-schema.md b/04-schema.md similarity index 98% rename from cn-introduction/04-schema.md rename to 04-schema.md index d7f4d88..bedc4e5 100644 --- a/cn-introduction/04-schema.md +++ b/04-schema.md @@ -120,7 +120,7 @@ composer 原生支持以下4种类型: - **library:** 这是默认类型,它会简单的将文件复制到 `vendor` 目录。 - **project:** 这表示当前包是一个项目,而不是一个库。例:框架应用程序 [Symfony standard edition](https://github.com/symfony/symfony-standard),内容管理系统 [SilverStripe installer](https://github.com/silverstripe/silverstripe-installer) 或者完全成熟的分布式应用程序。使用 IDE 创建一个新的工作区时,这可以为其提供项目列表的初始化。 - **metapackage:** 当一个空的包,包含依赖并且需要触发依赖的安装,这将不会对系统写入额外的文件。因此这种安装类型并不需要一个 dist 或 source。 -- **composer-plugin:** 一个安装类型为 `composer-plugin` 的包,它有一个自定义安装类型,可以为其它包提供一个 installler。详细请查看 [自定义安装类型](../articles/custom-installers.md)。 +- **composer-plugin:** 一个安装类型为 `composer-plugin` 的包,它有一个自定义安装类型,可以为其它包提供一个 installler。详细请查看 [自定义安装类型](articles/custom-installers.md)。 仅在你需要一个自定义的安装逻辑时才使用它。建议忽略这个属性,采用默认的 `library`。 @@ -334,7 +334,7 @@ composer 原生支持以下4种类型: > 正因为如此,在某些情况下,它不会是一个实用的解决方法, > 如果可能,你应该总是尝试切换到拥有标签的版本。 -它也可以应用于行内别名,这样它将匹配一个约束,否则不会。更多信息请参考 [别名](../articles/aliases.md)。 +它也可以应用于行内别名,这样它将匹配一个约束,否则不会。更多信息请参考 [别名](articles/aliases.md)。 #### require @@ -694,7 +694,7 @@ Repositories 并不是递归调用的,只能在“Root包”的 `composer.json * **github-oauth:** 一个域名和 oauth keys 的列表。 例如:使用 `{"github.com": "oauthtoken"}` 作为此选项的值, 将使用 `oauthtoken` 来访问 github 上的私人仓库,并绕过 low IP-based rate 的 API 限制。 - [关联知识](../articles/troubleshooting.md#api-rate-limit-and-oauth-tokens) + [关联知识](articles/troubleshooting.md#api-rate-limit-and-oauth-tokens) 关于如何获取 GitHub 的 OAuth token。 * **vendor-dir:** 默认为 `vendor`。通过设置你可以安装依赖到不同的目录。 * **bin-dir:** 默认为 `vendor/bin`。如果一个项目包含二进制文件,它们将被连接到这个目录。 @@ -727,7 +727,7 @@ Repositories 并不是递归调用的,只能在“Root包”的 `composer.json Composer 允许你在安装过程中的各个阶段挂接脚本。 -更多细节和案例请查看 [脚本](../articles/scripts.md)。 +更多细节和案例请查看 [脚本](articles/scripts.md)。 ### extra @@ -747,7 +747,7 @@ $extra = $event->getComposer()->getPackage()->getExtra(); 该属性用于标注一组应被视为二进制脚本的文件,他们会被软链接到(config 对象中的)`bin-dir` 属性所标注的目录,以供其他依赖包调用。 -详细请查看 [Vendor Binaries](../articles/vendor-binaries.md)。 +详细请查看 [Vendor Binaries](articles/vendor-binaries.md)。 可选。 diff --git a/cn-introduction/05-repositories.md b/05-repositories.md similarity index 98% rename from cn-introduction/05-repositories.md rename to 05-repositories.md index 8bde2e5..488113a 100644 --- a/cn-introduction/05-repositories.md +++ b/05-repositories.md @@ -59,7 +59,7 @@ Composer 是一个依赖管理工具。它在本地安装一些资源包。一 默认情况下已经将 Packagist.org 注册到 Composer。你可以在 `composer.json` 中申明更多的资源库,把它们加入你的项目中。 -资源库的定义仅可用于“root 包”,而在你依赖的包中定义的资源库将不会被加载。如果你想了解其中的原因,请阅读 [FAQ entry](../faq/why-can't-composer-load-repositories-recursively.md)。 +资源库的定义仅可用于“root 包”,而在你依赖的包中定义的资源库将不会被加载。如果你想了解其中的原因,请阅读 [FAQ entry](faq/why-can't-composer-load-repositories-recursively.md)。 ## Types @@ -241,7 +241,7 @@ VCS 表示版本控制系统。这包括像 git、svn 或 hg 这样的版本管 注意,你不应该对包进行重命名,除非你真的打算摆脱原来的包,并长期的使用你自己的 fork。这样 Composer 就会正确获取你的包了。如果你确定要重命名这个包,你应该在默认分支(通常是 master 分支)上操作,而不是特性分支,因为包的名字取自默认分支。 -如果其它包依赖你 fork 的这个分支,可能要对它做版本号的行内别名设置,才能够准确的识别版本约束。更多相关信息请查看 [别名](../articles/aliases.md)。 +如果其它包依赖你 fork 的这个分支,可能要对它做版本号的行内别名设置,才能够准确的识别版本约束。更多相关信息请查看 [别名](articles/aliases.md)。 #### 使用私有资源库 @@ -456,7 +456,7 @@ Satis 是一个静态的 `composer` 资源库生成器。它像是一个超轻 你给它一个包含 `composer.json` 的存储库,定义好 VCS 和 资源库。它会获取所有你列出的包,并打印 `packages.json` 文件,作为 `composer` 类型的资源库。 -更多详细信息请查看 [github.com/composer/satis](https://github.com/composer/satis) 和 [Satis article](../articles/handling-private-packages-with-satis.md)。 +更多详细信息请查看 [github.com/composer/satis](https://github.com/composer/satis) 和 [Satis article](articles/handling-private-packages-with-satis.md)。 ### Artifact diff --git a/cn-introduction/06-community.md b/06-community.md similarity index 100% rename from cn-introduction/06-community.md rename to 06-community.md diff --git a/README.md b/README.md index 756a407..ae820fc 100644 --- a/README.md +++ b/README.md @@ -13,13 +13,13 @@ Composer 中文文档 --- ## Book -- [简介](/cn-introduction/00-intro.md) -- [基本用法](/cn-introduction/01-basic-usage.md) -- [库(资源包)](/cn-introduction/02-libraries.md) -- [命令行](/cn-introduction/03-cli.md) -- [架构](/cn-introduction/04-schema.md) -- [资源库](/cn-introduction/05-repositories.md) -- [社区](/cn-introduction/06-community.md) +- [简介](/00-intro.md) +- [基本用法](/01-basic-usage.md) +- [库(资源包)](/02-libraries.md) +- [命令行](/03-cli.md) +- [架构](/04-schema.md) +- [资源库](/05-repositories.md) +- [社区](/06-community.md) ## Articles - [别名](/articles/aliases.md) diff --git a/articles/custom-installers.md b/articles/custom-installers.md index e77f38b..cb532d2 100644 --- a/articles/custom-installers.md +++ b/articles/custom-installers.md @@ -158,8 +158,8 @@ class TemplateInstaller extends LibraryInstaller > _并非安装在 `/vendor` 目录,任何使用这个安装程序的资源包,将被放置在 `/data/templates/` 目录中。_ -[1]: ../cn-introduction/04-schema.md#type -[2]: ../cn-introduction/04-schema.md#extra +[1]: ../04-schema.md#type +[2]: ../04-schema.md#extra [3]: https://github.com/composer/composer/blob/master/src/Composer/Plugin/PluginInterface.php [4]: https://github.com/composer/composer/blob/master/src/Composer/Installer/InstallerInterface.php [5]: https://github.com/composer/composer/blob/master/src/Composer/Installer/LibraryInstaller.php diff --git a/articles/handling-private-packages-with-satis.md b/articles/handling-private-packages-with-satis.md index c78d502..6988441 100644 --- a/articles/handling-private-packages-with-satis.md +++ b/articles/handling-private-packages-with-satis.md @@ -18,10 +18,10 @@ Satis 是一个静态的 `composer` 代码库生成器。 For example let's assume you have a few packages you want to reuse across your company but don't really want to open-source. You would first define a Satis configuration: a json file with an arbitrary name that lists your curated -[repositories](../cn-introduction/05-repositories.md). +[repositories](../05-repositories.md). Here is an example configuration, you see that it holds a few VCS repositories, -but those could be any types of [repositories](../cn-introduction/05-repositories.md). Then it +but those could be any types of [repositories](../05-repositories.md). Then it uses `"require-all": true` which selects all versions of all packages in the repositories you defined. diff --git a/articles/plugins.md b/articles/plugins.md index e7464fe..9d53b60 100644 --- a/articles/plugins.md +++ b/articles/plugins.md @@ -124,8 +124,8 @@ class AwsPlugin implements PluginInterface, EventSubscriberInterface > 你可以通过 `--no-plugins` 选项让 composer 的命令禁用所有已经安装的插件。这或许是特别有用的,如果任何插件会导致错误,而你想要升级或卸载它。 -[1]: ../cn-introduction/04-schema.md#type -[2]: ../cn-introduction/04-schema.md#extra +[1]: ../04-schema.md#type +[2]: ../04-schema.md#extra [3]: https://github.com/composer/composer/blob/master/src/Composer/Plugin/PluginInterface.php [4]: https://github.com/composer/composer/blob/master/src/Composer/Composer.php [5]: https://github.com/composer/composer/blob/master/src/Composer/IO/IOInterface.php diff --git a/articles/troubleshooting.md b/articles/troubleshooting.md index ef63aa6..838b761 100644 --- a/articles/troubleshooting.md +++ b/articles/troubleshooting.md @@ -7,11 +7,11 @@ This is a list of common pitfalls on using Composer, and how to avoid them. ## General -1. Before asking anyone, run [`composer diagnose`](../cn-introduction/03-cli.md#diagnose) to check +1. Before asking anyone, run [`composer diagnose`](../03-cli.md#diagnose) to check for common problems. If it all checks out, proceed to the next steps. 2. When facing any kind of problems using Composer, be sure to **work with the - latest version**. See [self-update](../cn-introduction/03-cli.md#self-update) for details. + latest version**. See [self-update](../03-cli.md#self-update) for details. 3. Make sure you have no problems with your setup by running the installer's checks via `curl -sS https://getcomposer.org/installer | php -- --check`. @@ -27,7 +27,7 @@ This is a list of common pitfalls on using Composer, and how to avoid them. branches and tag names. 2. Be sure to **set the right - [minimum-stability](../cn-introduction/04-schema.md#minimum-stability)**. To get started or be + [minimum-stability](../04-schema.md#minimum-stability)**. To get started or be sure this is no issue, set `minimum-stability` to "dev". 3. Packages **not coming from [Packagist](https://packagist.org/)** should diff --git a/cn-introduction/dev/DefaultPolicy.md b/dev/DefaultPolicy.md similarity index 100% rename from cn-introduction/dev/DefaultPolicy.md rename to dev/DefaultPolicy.md diff --git a/en-back/00-intro.md b/en-doc/00-intro.md similarity index 100% rename from en-back/00-intro.md rename to en-doc/00-intro.md diff --git a/en-back/01-basic-usage.md b/en-doc/01-basic-usage.md similarity index 100% rename from en-back/01-basic-usage.md rename to en-doc/01-basic-usage.md diff --git a/en-back/02-libraries.md b/en-doc/02-libraries.md similarity index 100% rename from en-back/02-libraries.md rename to en-doc/02-libraries.md diff --git a/en-back/03-cli.md b/en-doc/03-cli.md similarity index 100% rename from en-back/03-cli.md rename to en-doc/03-cli.md diff --git a/en-back/04-schema.md b/en-doc/04-schema.md similarity index 100% rename from en-back/04-schema.md rename to en-doc/04-schema.md diff --git a/en-back/05-repositories.md b/en-doc/05-repositories.md similarity index 100% rename from en-back/05-repositories.md rename to en-doc/05-repositories.md diff --git a/en-back/06-config.md b/en-doc/06-config.md similarity index 100% rename from en-back/06-config.md rename to en-doc/06-config.md diff --git a/en-back/07-community.md b/en-doc/07-community.md similarity index 100% rename from en-back/07-community.md rename to en-doc/07-community.md diff --git a/en-back/articles/aliases.md b/en-doc/articles/aliases.md similarity index 100% rename from en-back/articles/aliases.md rename to en-doc/articles/aliases.md diff --git a/en-back/articles/custom-installers.md b/en-doc/articles/custom-installers.md similarity index 100% rename from en-back/articles/custom-installers.md rename to en-doc/articles/custom-installers.md diff --git a/en-back/articles/handling-private-packages-with-satis.md b/en-doc/articles/handling-private-packages-with-satis.md similarity index 100% rename from en-back/articles/handling-private-packages-with-satis.md rename to en-doc/articles/handling-private-packages-with-satis.md diff --git a/en-back/articles/plugins.md b/en-doc/articles/plugins.md similarity index 100% rename from en-back/articles/plugins.md rename to en-doc/articles/plugins.md diff --git a/en-back/articles/scripts.md b/en-doc/articles/scripts.md similarity index 100% rename from en-back/articles/scripts.md rename to en-doc/articles/scripts.md diff --git a/en-back/articles/troubleshooting.md b/en-doc/articles/troubleshooting.md similarity index 100% rename from en-back/articles/troubleshooting.md rename to en-doc/articles/troubleshooting.md diff --git a/en-back/articles/vendor-binaries.md b/en-doc/articles/vendor-binaries.md similarity index 100% rename from en-back/articles/vendor-binaries.md rename to en-doc/articles/vendor-binaries.md diff --git a/en-back/dev/DefaultPolicy.md b/en-doc/dev/DefaultPolicy.md similarity index 100% rename from en-back/dev/DefaultPolicy.md rename to en-doc/dev/DefaultPolicy.md diff --git a/en-back/faqs/how-do-i-install-a-package-to-a-custom-path-for-my-framework.md b/en-doc/faqs/how-do-i-install-a-package-to-a-custom-path-for-my-framework.md similarity index 100% rename from en-back/faqs/how-do-i-install-a-package-to-a-custom-path-for-my-framework.md rename to en-doc/faqs/how-do-i-install-a-package-to-a-custom-path-for-my-framework.md diff --git a/en-back/faqs/should-i-commit-the-dependencies-in-my-vendor-directory.md b/en-doc/faqs/should-i-commit-the-dependencies-in-my-vendor-directory.md similarity index 100% rename from en-back/faqs/should-i-commit-the-dependencies-in-my-vendor-directory.md rename to en-doc/faqs/should-i-commit-the-dependencies-in-my-vendor-directory.md diff --git a/en-back/faqs/why-are-unbound-version-constraints-a-bad-idea.md b/en-doc/faqs/why-are-unbound-version-constraints-a-bad-idea.md similarity index 100% rename from en-back/faqs/why-are-unbound-version-constraints-a-bad-idea.md rename to en-doc/faqs/why-are-unbound-version-constraints-a-bad-idea.md diff --git a/en-back/faqs/why-are-version-constraints-combining-comparisons-and-wildcards-a-bad-idea.md b/en-doc/faqs/why-are-version-constraints-combining-comparisons-and-wildcards-a-bad-idea.md similarity index 100% rename from en-back/faqs/why-are-version-constraints-combining-comparisons-and-wildcards-a-bad-idea.md rename to en-doc/faqs/why-are-version-constraints-combining-comparisons-and-wildcards-a-bad-idea.md diff --git a/en-back/faqs/why-can't-composer-load-repositories-recursively.md b/en-doc/faqs/why-can't-composer-load-repositories-recursively.md similarity index 100% rename from en-back/faqs/why-can't-composer-load-repositories-recursively.md rename to en-doc/faqs/why-can't-composer-load-repositories-recursively.md diff --git a/faq/should-i-commit-the-dependencies-in-my-vendor-directory.md b/faq/should-i-commit-the-dependencies-in-my-vendor-directory.md index cdbf956..43534aa 100644 --- a/faq/should-i-commit-the-dependencies-in-my-vendor-directory.md +++ b/faq/should-i-commit-the-dependencies-in-my-vendor-directory.md @@ -13,6 +13,6 @@ 如果你真的觉得你必须这样做,你有几个选择: 1. 限制自己安装标记版本(无 dev 版本),这样你只会得到 zip 压缩的安装,并避免 git“子模块”出现的问题。 -2. 使用 --prefer-dist 或在 [config](../cn-introduction/04-schema.md#config) 选项中设置 `preferred-install` 为 `dist`。 +2. 使用 --prefer-dist 或在 [config](../04-schema.md#config) 选项中设置 `preferred-install` 为 `dist`。 3. 在每一个依赖安装后删除其下的 `.git` 文件夹,然后你就可以添加它们到你的 git repo 中。你可以运行 `rm -rf vendor/**/.git` 命令快捷的操作,但这意味着你在运行 composer update 命令前需要先删除磁盘中的依赖文件。 4. 新增一个 .gitignore 规则(`vendor/.git`)来忽略 vendor 下所有 `.git` 目录。这种方法不需要你在运行 composer update 命令前删除你磁盘中的依赖文件。