允许opensourced项目的用户将自己的文件添加到他们的副本中 [英] Allow users of an opensourced project to add their own files to their copy
问题描述
基本上我没有经验使用作曲家,并且没有使用git子模块。
/ ROOT
---- /子目录/
--------- / another.file.php
---- / main.class.php
---- / config.default.php
这对用户来说能够复制 config.default.php
到相同的目录,将它重命名为 config.php
(并且这样做会覆盖默认配置值) - 我希望它们能够添加它们自己的文件到 /子目录/
,这样他们就可以将工具扩展到他们独特的需求。
我的问题是,当拉(在git子模块的情况下)或Composer更新被执行时,那些文件不会被修剪?如果是这样,我怎么才能达到要求,尽可能为最终用户做一些小事:
- 一个单一的,可选的,可自由编辑的配置文件
- 两个可以包含用户创建文件的目录
- 以上更改保留在用户自己的版本控制系统中,并且在新版本
非常感谢您的耐心等待。
大多数应用程序框架/ CMS最近做的事情是将这个过程分成两个包:
So I'm creating a semi-popular open source project and am looking for ways for its users to customize their copy.
Basically I've zero experience using Composer and next to none with git submodules. I have this file structure pushed to git:
/ROOT
----/subdirectory/
---------/another.file.php
----/main.class.php
----/config.default.php
It would be ideal for users to be able to copy config.default.php
to the same directory, rename it to config.php
(and by doing that override the default configuration values) - and I'd like them to be able to add their own files to the /subdirectory/
too, allowing them to extend the tool to their unique requirements.
My question is, don't those files get trimmed when pull (in the case of git submodule) or Composer update is performed? If so, how do I achieve the requirements with as little fuss for the end user as possible:
- A single, optional, freely editable configuration file
- Two directories that can contain files that users create
- Above alterations stay within the users own version control system and are not removed when a new version is fetched.
Thank you for your patience in advance.
What most application frameworks/CMSs are doing these days is to split this process in two packages:
- one library package (e.g. symfony/symfony, laravel/framework) that contains the bulk of the code, and that will be installed in vendor/
- one "bootstrap" package (e.g. symfony/framework-standard-edition, laravel/laravel) that contains an application shell that your users can start from. That would contain default config and a composer.json that includes the library package + whatever else is needed in the "require" section. This bootstrap package is typically not updated via composer since it becomes the application/site of your users. Therefore it should contain as little code as possible, and be essentially only configuration.
这篇关于允许opensourced项目的用户将自己的文件添加到他们的副本中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!